Problems with alignment in bash mode with hisat2
1
0
Entering edit mode
2.2 years ago
Peter ▴ 20

I'm trying to align paired-end sequences with the following loop:

for f in `ls *.fq.gz | sed 's/_0[12].fq.gz//g' | sort -u`

 do

hisat2 -p 8 -x /home/referenceData/GRCh37_index -1 ${f}_1 -2 ${f}_2 -S ${f}.sam | samtools view -@ 8 ${f}.sam > ${f}.bam | samtools sort -@ 8 ${f}.bam -o ${f}.sorted.bam
done

However, this command is not running, because I am getting this error:

"SRR10042682_1_val_1.fq.gz_1: No such file in the directory"

"SRR10042682_2_val_2.fq.gz_2: No such file in the directory"

My samples are named as follows: SRR10042682_1_val_1.fq.gz and SRR10042682_2_val_2

can anybody help me?

Thanks!

RNA-seq Linux histat2 • 533 views
ADD COMMENT
2
Entering edit mode

You are not reconstituting input files. Try this and echo before you run the command:

for f in `ls *.fq.gz | sed 's/_[12]_val_[12].fq.gz//g' | sort -u`

I would prefer this way, in a shell in the absence of parallel:

$ for f in *_1.fq.gz ; do echo $f ${f%%_*}_2_val_2.fq.gz; echo ${f%%_*}.{b,s}am;done

SRR10042682_1_val_1.fq.gz SRR10042682_2_val_2.fq.gz
SRR10042682.bam SRR10042682.sam
ADD REPLY
0
Entering edit mode

What's the zero in the sed command supposed to do in your opinion?

ADD REPLY

Login before adding your answer.

Traffic: 1636 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6