Thanks Ambu, I have already run the hisat2 build command and the produced .ht2 files are in my reference folder (equal to reference_index that you have mentioned). As I explained the command without rg tags is running without problem and it generates the sam file. But after adding rg tags it doesnt output any sam file. So I dont think the problem is related to reference index file.
Hi, I tried to run below command as suggested by histat2 manual:
./hisat2-2.2.1-Linux_x86_64/hisat2-2.2.1/hisat2 --no-spliced-alignment --no-unal --rg-id ID:D10_S24_L001 --rg SM:D10_S24_L001 --rg PL:ILLUMINA --rg PM:HISEQ -p 2 -x reference.fasta -1 ./Data/D1.fastq.gz -2 ./Data/D2.fastq.gz -S D10.sam
It does not throw any error but still does not generate sam file. before using --rg-id and --rg tags it would be able to generate sam files but after editing like this it does not give any error. The logs in both cases are something similar to below:
33583125 reads; of these: 33583125 (100.00%) were paired; of these: 33565755 (99.95%) aligned concordantly 0 times 17370 (0.05%) aligned concordantly exactly 1 time
0 (0.00%) aligned concordantly >1 times ---- 33565755 pairs aligned concordantly 0 times; of these: 4324 (0.01%) aligned discordantly 1 time ---- 33561431 pairs aligned 0 times concordantly or discordantly; of these: 67122862 mates make up the pairs; of these: 67107582 (99.98%) aligned 0 times 15280 (0.02%) aligned exactly 1 time 0 (0.00%) aligned >1 times0.09% overall alignment rate
I am not sure what is wrong in my command as it does not produce any error nor any sam output file.
I also tried to change --rg-id ID:D10_S24_L001 to --rg ID:D10_S24_L001 and run again but yet no error no output sam file and the log is the similiar to above.
I would be grateful if you can give me some ideas in this regard.
2 answers
First, create the index files from the reference file using this command $hisat2-build sample.fa sample_index
Then go for SAM creation : $hisat2 -x sample_index --known-splicesite-infile sample_splice_sites.txt -p 20 -1 Sample_R1_paired.fq.gz -2 Sample_R2_paired.fq.gz -S Sample.sam
The files you should add after -x is the sample index files and not the reference file.
In your case:
$hisat2-build reference.fasta reference_index
$./hisat2-2.2.1-Linux_x86_64/hisat2-2.2.1/hisat2 --no-spliced-alignment --no-unal --rg-id ID:D10_S24_L001 --rg SM:D10_S24_L001 --rg PL:ILLUMINA --rg PM:HISEQ -p 2 -x reference_index -1 ./Data/D1.fastq.gz -2 ./Data/D2.fastq.gz -S D10.sam
I found what was the problem. I just post it here if anybody faces with the same problem later maybe it helps. I had underscore in the sam filename like A_B_10.sam. When I changed the name to A.sam the above command works without any problem. Not very reasonable reason :) but yet I am happy I found the problem. Thanks everybody to share your ideas.
Log in to answer this question.
what does that mean ? what is the output of
samtools view -c D10.sam?The hisat2 does not output any sam file. I used to run the below command:
and it gives me sam file as output. but after adding rg tags (as I show above) the command does not output any sam file. I hope this explanation is clear enough. (I want to run command with rg tags and so I need sam file resulted with this command. )
If you don't use the
-Soptionhisat2should write the alignments tostdout.yes it prints out the alignment information when I removed -S D10.sam part from my command. So how can I save these as sam file?
You can redirect the output to a file eg.
> D.samor pipe it to samtools to convert into a bam file.