SEQanswers

Go Back   SEQanswers > Bioinformatics > Bioinformatics



Similar Threads
Thread Thread Starter Forum Replies Last Post
Cuffdiff error [bam_header_read] invalid BAM binary header (this is not a BAM file). adrian Bioinformatics 0 12-29-2016 02:23 PM
sam to bam conversion error, no @SQ lines in the header, missing header? efoss Bioinformatics 17 12-03-2015 05:28 AM
strip header off sam header using bam cmccabe Bioinformatics 3 09-19-2015 06:01 AM
Bad assembly or bad sequence data? cyanoevo Metagenomics 7 01-31-2015 10:00 AM
GATK Error: Bad input-no usable data in BAM Cable Bioinformatics 0 07-11-2012 08:10 PM

Reply
 
Thread Tools
Old 09-08-2017, 11:31 AM   #1
jmartin
Member
 
Location: St. Louis

Join Date: Dec 2009
Posts: 61
Default help recovering data from bam w/ bad header

I have a bam file that I need to work with to reproduce an issue for some troubleshooting. This bam file was left by a student in a collaborator's lab and we pretty much only have this bam file (no upstream or downstream derivatives of the file). Samtools view gives this error message:

[bam_header_read] invalid BAM binary header (this is not a BAM file).
[main_samview] fail to read the header from "7_2.bam".

Picard's ValidateSamFile produces only the message:

ERROR: Read groups is empty
SAMFormatException on record 01

along with STDERR that looks like the java code is erroring out. Bamtools stats gives this error:

bamtools stats ERROR: could not open input BAM file(s)... Aborting.


This file is of a size that would be appropriate for the mapping done, and somehow the person who created it used it. It is a rather old copy that has now been passed around a bit but if it was truncated from a transfer I'd have expected different errors (I think...).

Is there some way I can dump just the data from a bam file without dealing with the bad header? Or is there some way I can read in a generic 'dummy' header over the bad one to save the data?


Thanks,
John
jmartin is offline   Reply With Quote
Old 09-11-2017, 01:27 AM   #2
dpryan
Devon Ryan
 
Location: Freiburg, Germany

Join Date: Jul 2011
Posts: 3,476
Default

How's your C programming? I suspect you're going to have to code something with htslib to figure out (A) where the problem is and (B) get around it as best as possible.
dpryan is offline   Reply With Quote
Old 09-11-2017, 01:03 PM   #3
jmartin
Member
 
Location: St. Louis

Join Date: Dec 2009
Posts: 61
Default

I've no experience with C coding, I mainly stick to scripting languages (perl & python). But I'll take a look at the htslib methods and see if I can muddle through.

Thanks,
John
jmartin is offline   Reply With Quote
Old 09-11-2017, 01:30 PM   #4
r.rosati
Member
 
Location: Brazil

Join Date: Aug 2015
Posts: 42
Default

Does this help?

https://gatkforums.broadinstitute.or...alidatesamfile
r.rosati is offline   Reply With Quote
Old 09-11-2017, 02:12 PM   #5
jmartin
Member
 
Location: St. Louis

Join Date: Dec 2009
Posts: 61
Default

I'll try the GATK ValidateSamFile and see what it says. GATK tools usually do give helpful error messages and I haven't tried that one yet.

Thanks,
John
jmartin is offline   Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off




All times are GMT -8. The time now is 05:29 AM.


Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Single Sign On provided by vBSSO