This is a test version of Biostars. For the public version, visit https://www.biostars.org.
python importing featureCounts to automate multiple files

Hello I'm trying to use featureCounts for multiple files using python script

but python doesn't seem to be able to load featureCounts feature.

My python script is as below.


import os  
import sys 
number=['ss','sss',ssss','ssss'] 
for a in number: 
     os.system("featureCounts -a /home/biguser/systems_biology_2021/TA/gtf/gencode.v34.gtf -p -o /home/biguser/xxxxxxxxxxxx/xxxxxxxxxxx/organizedF/feaC/%s/%s_feaCon.txt /home/biguser/xxxxxxx/xxxxxxxx/organizedF/mappedControl/%s/%s_Aligned.sortedByCoord.out.bam -T 4"%(a,a,a,a))

And the result.


[biguser@xxxx-master finalP]$ python pyfeaCon.py 

sh: featureCounts: command not found 
sh: featureCounts: command not found 
sh: featureCounts: command not found 
sh: featureCounts: command not found

I'm pretty new to these stuff, so I was wondering if i could get any help

Thanks.

P.S How do I create a new line in this thing? Even if I 'enter' it just stays in a paragraph.

featurecounts python

How do I create a new line in this thing? Even if I 'enter' it just stays in a paragraph.

Markdown formatting rules are that 2 new line characters move to a new paragraph in the rendered markdown (like an HTML <br> tag) while one new line just moves the cursor in the raw markdown text (again, like in HTML).

Thanks! I guess I didn't know much about web formats.

1 answer

Ideally, you should use something like snakemake, not a raw python script. In any case, try providing the full path to featureCounts in your system().

wow thanks! it solve the problem

Glad it helped! A small educational note: if an answer was helpful, you should upvote it; if the answer resolved your question, you should mark it as accepted. You can accept more than one answer if they work. This will help future users that might find this post find the right answer.

upvote_bookmark_accept

Log in to answer this question.