Entering edit mode
3.4 years ago
dcjordan128
•
0
Hello,
I'm using v4.3.4 and I'm trying to run 30+ different samples through sortmerna. Everytime I run the code, it will work for the first sample and then will stop running for the others as I don't know how to have it make a new directory for each sample. How do I do this in my for loop? In the example script I've just declared an array of three files to keep the run time shorter.
Start for loop
declare -a arr=("51" "52" "53")
for i in "${arr[@]}";
do
echo "fornicata library ${i}"
R1=$(ls *${i}_R1_val_1.fq.gz)
R2=$(ls *${i}_R2_val_2.fq.gz)
echo "check R1_input is ${R1}"
echo "check R2_input is ${R2}"
echo "check paired libraries = ${R1} ${R2}"
sortmerna --ref /uoa/home/r01dj21/Software/sortmerna/sortmerna-2.1b/rRNA_databases/silva-euk-18s-id95.fasta --reads ${R1} --reads ${R2} --workdir /uoa/home/r01dj21/raw_data/C_fornicata/sortmerna_output/smr1/51
done
For multiple samples,
Create your for loop to iterative over the number of samples you have. Then specify the sortmerna command. Move the out directory of each file and remove the kvdb of each directory as well. End the loop.