SEQanswers

Go Back   SEQanswers > General



Similar Threads
Thread Thread Starter Forum Replies Last Post
Calling Quiver from within a Python script verheytb Pacific Biosciences 2 05-28-2015 08:39 AM
R script to Python conversion bvk Bioinformatics 9 05-18-2015 01:35 AM
How would I go about calling BWA from a python script? prs321 Bioinformatics 6 07-15-2013 07:48 AM
python script modification of LSC0.2.4 ? arthur.yxt Bioinformatics 0 06-11-2013 01:32 PM
gatk python script m_elena_bioinfo Bioinformatics 7 11-20-2011 06:40 AM

Reply
 
Thread Tools
Old 11-10-2016, 08:59 AM   #1
mavadhani
Junior Member
 
Location: baltimore

Join Date: Jul 2016
Posts: 9
Default Python script for bowtie2 alignment

Hello All!

I am new to coding and am trying to write a python script to analyze a bunch of fastq files from RNASeq analysis. I am using the subprocess module to call bowtie2 in order to index the genome that is in fasta format. That works just fine. But I am stuck in the next step which is using bowtie2 to align the unpaired short reads to the genome. I know I am using the correct command as it works at the terminal generating a .sam file. But my python code is not working. Here are some of the ones I have tried--

#process = subprocess.call (['bowtie2_align', indexfiles, fastqFile1, Outputfile])
#process = subprocess.Popen(['bowtie2_align', stdin= indexfile, fastqFile1, stdout=Outputfile])

#process2 = subprocess.call(["bowtie2_align" (-x indexfile, -U fastqFile1, -S 'Outputfile.sam')],shell=True)

align = 'bowtie2_align' -x cellvibrio_index -U fastqFile1 -S initial_aligns.sam'

I would really appreciate any help/suggestions to fix this code.

Thanks,
-M
mavadhani is offline   Reply With Quote
Old 11-10-2016, 11:15 AM   #2
dpryan
Devon Ryan
 
Location: Freiburg, Germany

Join Date: Jul 2011
Posts: 3,467
Default

It'd be something like:

Code:
subprocess.call(["bowtie2", "-x", indexBaseName, "-U", fastqFile1, "S", "Outpufile.sam"])
However, I highly encourage you to not do this and instead use something like snakemake. This lets you do things directly in python when you need to but also abstracts all of that away when you don't (like this example). Plus, you can use a cluster and in general more easily control things without reinventing the wheel for the umpteenth time.
dpryan is offline   Reply With Quote
Old 11-10-2016, 06:22 PM   #3
mavadhani
Junior Member
 
Location: baltimore

Join Date: Jul 2016
Posts: 9
Default

Thank you very much dpryan. I will certainly give snakemake a shot.

-Madhavi
mavadhani is offline   Reply With Quote
Reply

Tags
bowtie2 align, python, subprocess

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off




All times are GMT -8. The time now is 12:42 AM.


Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Single Sign On provided by vBSSO