This is a test version of Biostars. For the public version, visit https://www.biostars.org.
running HISAT2 with multiple samples

Hello all, I am running Hisat2 for my RNASeq alignment for many samples. My bash script is following,

#!/bin/bash

id="4B1
4B2
4B3
4B4
4W1
4W2
4W3
4W4
7B1
7B2
7B3
7B4
7W1
7W2
7W3
7W4
"
for sample in $id

do

echo hisat2 -p 8 -x ./insectgenome/rhod.index --un-conc ./${sample}_insect_unmapped.fastq -1 ./reads/${sample}_R1_001_paired.fq.gz -2 ./reads/${sample}_R2_001_paired.fq.gz | samtools view -Sb - > ./${sample}_insect_mapped.bam

done

But i am getting error saying that [main_samview] fail to read the header.

please help me to get rid of this problem.

thanks and looking forward to hear from you.

rna-seq

1 answer

Hi,

I don't know if is because of that or if it was a formatting error when you copied the message, but I would provide a list in id, instead of a list separated by tab, I would use space (perhaps tab is allowed but usually I use space). Apart from that you can't use echo. echo print information, it doesn't execute it, unless that you provide special characters to inform echo that is a command. Try the following:

#!/bin/bash

id="4B1 4B2 4B3 4B4 4W1 4W2 4W3 4W4 7B1 7B2 7B3 7B4 7W1 7W2 7W3 7W4"
for sample in $id

do

hisat2 -p 8 -x ./insectgenome/rhod.index --un-conc ./${sample}_insect_unmapped.fastq -1 ./reads/${sample}_R1_001_paired.fq.gz -2 ./reads/${sample}_R2_001_paired.fq.gz | samtools view -Sb - > ./${sample}_insect_mapped.bam

done

Let me know if it worked.

António

Log in to answer this question.