-
Notifications
You must be signed in to change notification settings - Fork 287
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bedtools tag broken for small input files since 2.27.1 #762
Comments
This might have to do with the very tiny input file, larger files seem to work fine. |
Actually it's probably because the header doesn't contain the |
A similar issue also seem to happen with |
The generated header looks fine fwiw:
|
I should note that bamtofastq also fails with a segmentation fault on the https://github.com/galaxyproject/tools-iuc/blob/3e955a4c015cdb4df68fb530ace165be9877f94a/tools/bedtools/test-data/srma_in3.bam?raw=true |
Also reported in arq5x/bedtools2#762
BAM files contain two representations of the headers: the same text as in a SAM file, and a binary table of the
The index 30c0a968..1f88a351 100644
--- a/src/bamToFastq/bamToFastq.cpp
+++ b/src/bamToFastq/bamToFastq.cpp
@@ -38,8 +38,8 @@ BamToFastq::~BamToFastq(void) {}
void BamToFastq::SingleFastq() {
// open the 1st fastq file for writing
_fq = new ofstream(_fastq1.c_str(), ios::out);
- if ( !*_fq1 ) {
- cerr << "Error: The first fastq file (" << _fastq1 << ") could not be opened. Exiting!" << endl;
+ if ( !*_fq ) {
+ cerr << "Error: The fastq file (" << _fastq1 << ") could not be opened. Exiting!" << endl;
exit (1);
}
// open the BAM file |
Awesome, thanks for the detailed explanation @jmarshall! I guess I was able to fix the test file by doing a bam->sam->bam conversion. That only leaves the bedpetobam issue as unexplained. |
Ugh, nice catch @jmarshall - burnt by a missing test again. |
We caught this with our test suite in galaxyproject/tools-iuc#2399, if you ping us before a release we're happy to flag any surprising changes or bugs. |
Indeed, I was expecting the bedpetobam issue to be the same problem, but it turns out to be another separate problem with a simple fix: index 4afa3cdc..7e6721d9 100644
--- a/src/bedpeToBam/bedpeToBam.cpp
+++ b/src/bedpeToBam/bedpeToBam.cpp
@@ -189,8 +189,8 @@ void ProcessBedPE(BedFilePE *bedpe, GenomeFile *genome, int mapQual, bool uncom
if (bedpe->bedType >= 10) {
ConvertBedPEToBam(bedpeEntry, bamEntry1, bamEntry2, chromToId, mapQual, lineNum);
- writer->SaveAlignment(bamEntry1);
- writer->SaveAlignment(bamEntry2);
+ writer->SaveAlignment(bamEntry1, true);
+ writer->SaveAlignment(bamEntry2, true); However somewhere in or nearby |
Thanks @jmarshall - @38 could you address this and add a few tests? |
Sorry for the delay, I finally applied and pushed @jmarshall's suggested patch above. I missed this previously. |
bedtools tag -names -i srma_in3.bam -files tagBed1.bed|samtools view
works fine on 2.27.1, but is broken on 2.28.0 and 2.29.0 and returnsYou can find the test data in https://github.com/galaxyproject/tools-iuc/blob/3e955a4c015cdb4df68fb530ace165be9877f94a/tools/bedtools/test-data/srma_in3.bam?raw=true
Let me know if you need more details.
The text was updated successfully, but these errors were encountered: