Entering edit mode
22 months ago
qudrat.nii
▴
40
Hello, I am trying to do bowtie2 alignment for 100 fastq files. To run bowtie2 alignment I am trying to write a python script but I am stuck at writing ''for loop''. Please help me. Thank you
A simple bash script would probably serve you better, or a Makefile. Alternatively a workflow manager such as Snakemake which is python-ish. Please show what you tried.
import subprocess folder = "/Desktop/RNA-Seq" fastq_file = [] try: for files in folder: if files.endswith('fastq'): fastq_files.append(files) subprocess.run("bowtie2 -x folder/bt2_idx -1 f1.q -2 f2.q -S f.sam") except: print('some error')
What is error you're getting here? What are the
f1.q
andf2.q
. Also, please format your code blocks.f1.q and f2.q is fastq file. Actually I am not able to write the script which can take pairs of files as input for bowtie2
Here is a snippet that can help you do that:
https://stackoverflow.com/questions/312443/how-do-i-split-a-list-into-equally-sized-chunks
However, you should listen to other's advices here and look into shell or workflow managers.
using bash for multiple files: bowtie2; using for multiple fastq files, linux loop code