Hi everyone,
In advance excuse my ignorance if it is something obvious but I have been looking around and couldn’t find similar problems. I’m not sure if I have just one problem carrying on or several at different level of analyses...
I have 8 sam files created with bfast for 1 sample, I have tried and succeeded to create 1 merged BAM file using 2 different ways (8sam>8bam>8sortedbam>1mergedbam or 8sam>1mergedsam>1bam>1 sorted bam) to see if it could solve my problem. But each time I can’t visualize it in IGV or use it in downstream analyses (SRMA, samtools pileup). The error message I get from IGV is as followed:
Error loading SAM header: for sequence 0, text and binary have different names in file sample1.bam
Then when I hit ok a second message appear:
An error occurred while loading: sample1.bam [java.lang.nullPointerException]
With SRMA I got a similar error:
net.sf.samtools.SAMFormatException: For sequence 0, text and binary have different names in file ~/sample1/bfast.sample1.merged.bam
at net.sf.samtools.BAMFileReader.readHeader(BAMFileReader.java:354)
at net.sf.samtools.BAMFileReader.<init>(BAMFileReader.java:114)
at net.sf.samtools.BAMFileReader.<init>(BAMFileReader.java:93)
at net.sf.samtools.SAMFileReader.init(SAMFileReader.java:500)
at net.sf.samtools.SAMFileReader.<init>(SAMFileReader.java:148)
at srma.SAMRecordIO.<init>(SAMRecordIO.java:49)
at srma.SRMA.doWork(SRMA.java:141)
at net.sf.picard.cmdline.CommandLineProgram.instanceMain(CommandLineProgram.java:150)
at srma.SRMA.main(SRMA.java:92)
I have tried samtools view to look at my header which looked ok.
@HD VN:0.1.2 SO:unsorted GO:none
@SQ SN:chr1 LN:249250621
@SQ SN:chr2 LN:243199373
@SQ SN:chr3 LN:198022430
@SQ SN:chr4 LN:191154276
@SQ SN:chr5 LN:180915260
@SQ SN:chr6 LN:171115067
@SQ SN:chr7 LN:159138663
@SQ SN:chr8 LN:146364022
@SQ SN:chr9 LN:141213431
@SQ SN:chr10 LN:135534747
@SQ SN:chr11 LN:135006516
@SQ SN:chr12 LN:133851895
@SQ SN:chr13 LN:115169878
@SQ SN:chr14 LN:107349540
@SQ SN:chr15 LN:102531392
@SQ SN:chr16 LN:90354753
@SQ SN:chr17 LN:81195210
@SQ SN:chr18 LN:78077248
@SQ SN:chr19 LN:59128983
@SQ SN:chr20 LN:63025520
@SQ SN:chr21 LN:48129895
@SQ SN:chr22 LN:51304566
@SQ SN:chrX LN:155270560
@SQ SN:chrY LN:59373566
@SQ SN:chrM LN:16571
@PG ID:bfast VN:0.6.4c
One strange thing is that when I sort, the header indicates chr 1 then chr2 etc..., Whereas the main mapped read start with chrM then Y... it is true that within each chr each read are sorted from beginning to end of the chr but the chr are not sorted from 1 to M...could it be the problem? I couldn’t find any option in samtools sort to specify the sorting from chr 1 to M...
I have tried to remove all unmapped reads thinking that it could cause the error but it didn’t do anything. I have tried also to work only with 1 sam file in case the merging was causing the problem just doing the compression in bam and then the sorting but the problem was still there...
thanks in advance for any help you could provide!
Fabrice
In advance excuse my ignorance if it is something obvious but I have been looking around and couldn’t find similar problems. I’m not sure if I have just one problem carrying on or several at different level of analyses...
I have 8 sam files created with bfast for 1 sample, I have tried and succeeded to create 1 merged BAM file using 2 different ways (8sam>8bam>8sortedbam>1mergedbam or 8sam>1mergedsam>1bam>1 sorted bam) to see if it could solve my problem. But each time I can’t visualize it in IGV or use it in downstream analyses (SRMA, samtools pileup). The error message I get from IGV is as followed:
Error loading SAM header: for sequence 0, text and binary have different names in file sample1.bam
Then when I hit ok a second message appear:
An error occurred while loading: sample1.bam [java.lang.nullPointerException]
With SRMA I got a similar error:
net.sf.samtools.SAMFormatException: For sequence 0, text and binary have different names in file ~/sample1/bfast.sample1.merged.bam
at net.sf.samtools.BAMFileReader.readHeader(BAMFileReader.java:354)
at net.sf.samtools.BAMFileReader.<init>(BAMFileReader.java:114)
at net.sf.samtools.BAMFileReader.<init>(BAMFileReader.java:93)
at net.sf.samtools.SAMFileReader.init(SAMFileReader.java:500)
at net.sf.samtools.SAMFileReader.<init>(SAMFileReader.java:148)
at srma.SAMRecordIO.<init>(SAMRecordIO.java:49)
at srma.SRMA.doWork(SRMA.java:141)
at net.sf.picard.cmdline.CommandLineProgram.instanceMain(CommandLineProgram.java:150)
at srma.SRMA.main(SRMA.java:92)
I have tried samtools view to look at my header which looked ok.
@HD VN:0.1.2 SO:unsorted GO:none
@SQ SN:chr1 LN:249250621
@SQ SN:chr2 LN:243199373
@SQ SN:chr3 LN:198022430
@SQ SN:chr4 LN:191154276
@SQ SN:chr5 LN:180915260
@SQ SN:chr6 LN:171115067
@SQ SN:chr7 LN:159138663
@SQ SN:chr8 LN:146364022
@SQ SN:chr9 LN:141213431
@SQ SN:chr10 LN:135534747
@SQ SN:chr11 LN:135006516
@SQ SN:chr12 LN:133851895
@SQ SN:chr13 LN:115169878
@SQ SN:chr14 LN:107349540
@SQ SN:chr15 LN:102531392
@SQ SN:chr16 LN:90354753
@SQ SN:chr17 LN:81195210
@SQ SN:chr18 LN:78077248
@SQ SN:chr19 LN:59128983
@SQ SN:chr20 LN:63025520
@SQ SN:chr21 LN:48129895
@SQ SN:chr22 LN:51304566
@SQ SN:chrX LN:155270560
@SQ SN:chrY LN:59373566
@SQ SN:chrM LN:16571
@PG ID:bfast VN:0.6.4c
One strange thing is that when I sort, the header indicates chr 1 then chr2 etc..., Whereas the main mapped read start with chrM then Y... it is true that within each chr each read are sorted from beginning to end of the chr but the chr are not sorted from 1 to M...could it be the problem? I couldn’t find any option in samtools sort to specify the sorting from chr 1 to M...
I have tried to remove all unmapped reads thinking that it could cause the error but it didn’t do anything. I have tried also to work only with 1 sam file in case the merging was causing the problem just doing the compression in bam and then the sorting but the problem was still there...
thanks in advance for any help you could provide!
Fabrice
Comment