[bash] No result file is created after hisat2
1
0
Entering edit mode
2.5 years ago
Olajucan • 0

I can see that hisat2 is working because it shows the result on the terminal, but a result file is not created.

Here is my code.

#!/usr/bin bash

File='abc.txt'
Samples=$(cat $File)
IDX=/mnt/g/refs/wheat/iwgsc_refseqv2.1_assembly.fa
WD=/mnt/g/translocation

for Sample in $Samples
do
    hisat2 -x $IDX -p 16 -1 $WD/"$Sample"_R1.fastq.gz -2 $WD/"$Sample"_R2.fastq.gz | samtools sort > $WD/$Sample.bam
done

Please give me any advices. Thank you.

bash hisat2 • 754 views
ADD COMMENT
0
Entering edit mode

when in doubt, echo every thing and run main function with small sized files.

ADD REPLY
0
Entering edit mode
2.5 years ago

You can try decompose the pipe in two steps, set bash option -e (stops at first error) and add a few "echo" lines to know where you are in your script. Together, these changes should allow you to debug your code and see where you are getting an error or where the code is stuck. For instance:

set -e #stop script when it encounters an error

for Sample in $Samples
do
    echo ""; echo "processing sample : ${Sample}"; echo "... aligning..."
    hisat2 -x $IDX -p 16 -1 $WD/"$Sample"_R1.fastq.gz -2 $WD/"$Sample"_R2.fastq.gz -S temp.sam
    echo "... done"; echo "... sorting and indexing alignment..."
    samtools sort --write-index temp.sam > $WD/$Sample.bam
    echo "... done"
done
ADD COMMENT
0
Entering edit mode

Thank you. It really helped a lot :)

ADD REPLY

Login before adding your answer.

Traffic: 1785 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