Entering edit mode
2.9 years ago
Ap1438
▴
50
I have files with file names
SK_1-forward_paired.fq.gz
SK_2-forward_paired.fq.gz
SK_1-forward_unpaired.fq.gz
SK_2-forward_unpaired.fq.gz
So i created a file with filenames
SK_1
SK_2
SK_3
SK_4
SK_5
SK_6
SK_7
SK_8
SK_9
for 9 different files
And a while loop script
#!/bin/bash
#sh megahit.sh filenames.txt Path
file="$1";
path="$2";
while read filename
do
#mkdir $filename
/opt/apps/MEGAHIT-1.2.9-Linux-x86_64-static/bin/megahit -1 $path/"$filename"-forward_paired.fq.gz -2 $path/"$filename"-reverse_paired.fq.gz -r $path/"$filename"-forward_unpaired.fq.gz, $path/"$filename"-reverse_unpaired.fq.gz -t 10 --out-dir megahit/$filename --out-prefix $filename --keep-tmp-files
done < $file
But it creates default output folder megahit_out.
Please always keep the code sample. Add
echo
wherever possible. Naming conventions in example files is confusing IMO. Please let forum users know that you have mixed libraries (paired end and single end). In general, SE files belong to another samples.These files are output of Trimmomatic and for each PE read it generates 4 files out of which 2 are PE and the other 2 are SE reads. All these files are input for megahit with options -1 , -2 and -r .
-1 and -2 for PE forward and reverse reads respectively and -r for SE forward and reverse unpaired reads.
Since $file, $1, $2 are not clear to me, I have created some files in a test directory and assumption is that all samples have "forward_paired" reads and Assumption is that file naming format is identical for all the samples as given below. Following is the example code:
input:
output dry run:
This would create a megahit directory and within megahit directory, it would create sample specific directory.
Thank you for your valuable time and suggestion .It worked