Thank you. It really helped a lot :)
• 0 views
•
link
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.
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
Thank you. It really helped a lot :)
Log in to answer this question.
when in doubt, echo every thing and run main function with small sized files.