I am trying to pass the below command through subprocess.call()
command = ['htseq-count', '-t', 'miRNA', '-i', 'Name', f, annot_file, out_file]
Upon runtime, I receive the notice that htseq-count requires at least 2 arguments, meaning it's not recognizing that there are input files in the command.
Printing the command out at runtime gives the following:
['htseq-count', '-t', 'miRNA', '-i', 'Name', 'KDRD1XX_ACAGTG_L001_R1_001_trimmedaligned.sam', 'hsa.gff3', 'KDRD1XX.htseq.sam']
Which is the proper file inputs.
Inserting the printed out command (sans commas and quotations of course) works fine, so no issues there.
I have had no issue using variable lists before with subprocess.call() so any help would be appreciated!
Full code:
import sys
import subprocess
import os
annot_file='hsa.gff3'
dirs= os.listdir('.')
for f in dirs:
if f.endswith("_trimmedaligned.sam"):
of=f.split('_')
outfile='>'+of[0]+'.htseq.sam'
command=['htseq-count','-t','miRNA','-i','Name',f,annot_file, out_file]
#print(command)
subprocess.call(command)