@Dave Carlson your solution worked for me. Many thanks!
• 0 views
•
link
Hi,
I tried running bowtie2 in python using subprocess without any success.
Codes:
REFGENOME='/path-to-genome/genome.fasta'
P1='/path-to-fastq/P1.fastq.bz2'
P2='/path-to-fastq/P2.fastq.bz2'
cmd=['bowtie2','--quiet','-p','10','--dovetail','--no-head','--no-sq','-x',REFGENOME,'-1',P1,'-2',P2,'-S', 'out.sam']
subprocess.Popen(cmd, shell=True)
Error:
No index, query, or output file specified!
Does anyone know how to set up subprocess properly to get the code working?
I typically use subprocess.run for this sort of thing. The following works (tested with python 3.7):
#!/usr/bin/env python
import subprocess
REFGENOME='path/to/indexed/genome.fasta'
P1='/path/to/r1.fq.gz'
P2='path/to/r2.fq.gz'
cmd=['bowtie2','--quiet','-p','10','--dovetail','--no-head','--no-sq','-x',REFGENOME,'-1',P1,'-2',P2,'-S', 'out.sam']
subprocess.run(cmd)
@Dave Carlson your solution worked for me. Many thanks!
Log in to answer this question.