Is there a way to merge multiple files in one script in Vsearch. Or I need to do one by one (I have 300 samples) ?
vsearch –fastq_mergepairs filename.fastq –reverse filename.fastq –fastq_maxdiffs 15 –fastq_minovlen 100 –eetabbedout filename.txt –fastaout filename.fasta
I’ve never used vsearch myself, but according to the documentation you can do something like this.
Considering that your samples names has *_R1_* for forward and *_R2_* for reverse you can use this simple bash script.
for f in *_R1_*.fastq; do
r=$(sed -e "s/_R1_/_R2_/" <<< "$f")
s=$(cut -d_ -f1 <<< "$f")
echo Processing sample $s
$VSEARCH --threads $THREADS \
--fastq_mergepairs $f \
--reverse $r \
--fastq_minovlen 100 \
--fastq_maxdiffs 15 \
--fastqout $s.merged.fastq \
You can modify the THREADS to the number of threads available in your computer, and in the for loop and sed modify __R1__ to whatever differentiate forward and reverse in you samples.
Ok i’m very new in bio-informatic. I’m not sure to understand the first line of your script
When I want to use vsearch on windows. I go to my document that contain vsearch.exe, right clic on the mouse, Git bash here, cmd-enter and now i start to enter command
Sorry but i don’t know how to start your simple bash script. Could you help me ?