Hi,
I want to convert my bam file (from tophat) to a fasta file. First, I used samtools view to convert sam to bam and then I used picard's SamToFastq to convert to fastq, but I received the following error:
Exception in thread "main" net.sf.samtools.SAMFormatException: Error parsing text SAM file. MAPQ must be zero if RNAME is not specified; Line 1
Line: DB775P1:275:C27JRACXX:1:2307:16302:100526 133 * 0 255 * * 0 0 CGGAAACCTTGTTACGACTTTTACTTCCTCTAGATAGTCAAGTTCGACCGTCTTCTCAGCGCTCCGCCAGGGCCGTGGGCCGACCCCGGCGGGGCCGATCC CCCFFFFFHHHHHJJJJJJJJJJJJJJJJJJJJJJJJJJIJJJJJJIJJJJJJJJJJJIJJHHFFFDDDDDDDDDDDDDCDDDDDDDDDDDDDDDDDDDD?
Here is the command I ran:
java -jar picard-tools-1.103/SamToFastq.jar INPUT=unmapped1.sam FASTQ=tophat_1914_unmapped_R1.fq SECOND_END_FASTQ=tophat_1914_unmapped_R2.fq
Also I used Picards ValidateSamFile program to check my samfile and the output is as follows:
ERROR: Record 1, Read name DB775P1:275:C27JRACXX:1:1101:1661:1847, Mapped mate should have mate reference name
ERROR: Record 1, Read name DB775P1:275:C27JRACXX:1:1101:1661:1847, MAPQ should be 0 for unmapped read.
Does anyone know how to fix this problem or another way to convert bam to fastq or fasta.
I used the below command to convert bam to fasta, but it looks like I loose the pair-end data information.
samtools view unmapped.bam | awk '{OFS="\t"; print ">"$1"\n"$10}' - > unmapped.fasta
So I need something that takes into consideration that I have pair-end data.
Thanks
I want to convert my bam file (from tophat) to a fasta file. First, I used samtools view to convert sam to bam and then I used picard's SamToFastq to convert to fastq, but I received the following error:
Exception in thread "main" net.sf.samtools.SAMFormatException: Error parsing text SAM file. MAPQ must be zero if RNAME is not specified; Line 1
Line: DB775P1:275:C27JRACXX:1:2307:16302:100526 133 * 0 255 * * 0 0 CGGAAACCTTGTTACGACTTTTACTTCCTCTAGATAGTCAAGTTCGACCGTCTTCTCAGCGCTCCGCCAGGGCCGTGGGCCGACCCCGGCGGGGCCGATCC CCCFFFFFHHHHHJJJJJJJJJJJJJJJJJJJJJJJJJJIJJJJJJIJJJJJJJJJJJIJJHHFFFDDDDDDDDDDDDDCDDDDDDDDDDDDDDDDDDDD?
Here is the command I ran:
java -jar picard-tools-1.103/SamToFastq.jar INPUT=unmapped1.sam FASTQ=tophat_1914_unmapped_R1.fq SECOND_END_FASTQ=tophat_1914_unmapped_R2.fq
Also I used Picards ValidateSamFile program to check my samfile and the output is as follows:
ERROR: Record 1, Read name DB775P1:275:C27JRACXX:1:1101:1661:1847, Mapped mate should have mate reference name
ERROR: Record 1, Read name DB775P1:275:C27JRACXX:1:1101:1661:1847, MAPQ should be 0 for unmapped read.
Does anyone know how to fix this problem or another way to convert bam to fastq or fasta.
I used the below command to convert bam to fasta, but it looks like I loose the pair-end data information.
samtools view unmapped.bam | awk '{OFS="\t"; print ">"$1"\n"$10}' - > unmapped.fasta
So I need something that takes into consideration that I have pair-end data.
Thanks
Comment