Although this solution works it should be avoided. As someone who spent a lot of time doing such things I can assure you that you will have to run this command more than once (a lot more actually), with different parameters, different datasets, maybe combine two samples (have I removed adapters?), you got the idea. You'll end up hacking this bash script in some unknown location, not sure which version of it you used to generate the results and when you'll write your manuscript you'll avoid sharing this code because it's, well, I'll say it. Ugly. What should you do? Make your results disposable. Save the input in a well documented, backed-up location and use pipelines to run the analysis, you can either use flowcraft for metagenomics assembly or craft your own. I can't stress this enough, learn how to use pipeline management systems like wdl, nextflow, snakemake, choose one, doesn't really matter which.
how to de novo assemble a large number of bacterial genome with spades in Linux
Hi, I am a freshman in sequencing data analysis. When i have one fastq file for only one bacteria , i know how to assemble using Spades. For example, "spades.py --pe1-1 name.fq.gz --pe1-2 name.fq.gz -o spades_test". But I don't know how to deal with a large number of samples with one linux command. For example, when i have 10 fastq data (name1~name10), i won't like to assemble them one by one by hand. Can you tell me how can i do ? Thanks!
• 2,423 views
•
link
1 answer
You can do it with the help of shell
#!/bin/bash
for fol in "your fastq directory" ; do
echo $fol
for i in `ls $fol | tr "_" "\t" | cut -f4 | sort | uniq`; do
fitag=`ls $fol | grep $i | head -n1 | sed -e 's/L/\t/g' | cut -f1`
spades.py --pe1-1 $fol$fitag$i"_R1.fastq.gz" --pe1-2 $fol$fitag$i"_R2.fastq.gz" -o $fol$fitag$i".out"
done
done
• 0 views
•
link
• 0 views
•
link
Log in to answer this question.
Type bash loop in google.
Take a look at
bash for loops.Just putting these commands in a loop is not going to make these go any faster. If you have access to a cluster you could potentially use a
forloop to submit 10 parallelspadesjobs otherwise they will run one after the other.Do you have access to a HPC or computing cluster? You should up your skills and use submission scripts or pipelines to manage this.
You can do it with the help of shell
spades.py --pe1-1 name.fq.gz --pe1-2 name.fq.gz -o spades_test"I guess this says that you have paired end, but fragmented reads. But you have only one fragment per end. I guess you can use -1 and -2 direct. There is also a problem with naming convention in OP.