diff --git a/src/utils/Contexts/ContextBase.cpp b/src/utils/Contexts/ContextBase.cpp index adbc47afb4105c611661fa95c11a72aa990c25ed..16d2402c080b16d498fe3f767e9423ac7e61beda 100644 --- a/src/utils/Contexts/ContextBase.cpp +++ b/src/utils/Contexts/ContextBase.cpp @@ -94,15 +94,9 @@ bool ContextBase::determineOutputType() { return true; } - //Otherwise, if there are any BAM files in the input, - //then the output should be BAM. - for (_i = 0; _i < (int)_files.size(); _i++) { - if (_files[_i]->getFileType() == FileRecordTypeChecker::BAM_FILE_TYPE) { - setOutputFileType(FileRecordTypeChecker::BAM_FILE_TYPE); - _bamHeaderAndRefIdx = _i; - _outputTypeDetermined = true; - return true; - } + //Otherwise, if the input is BAM, then the output is BAM + if (getFile(0)->getFileType() == FileRecordTypeChecker::BAM_FILE_TYPE) { + setOutputFileType(FileRecordTypeChecker::BAM_FILE_TYPE); } //Okay, it's bed. diff --git a/test/intersect/test-intersect.sh b/test/intersect/test-intersect.sh index da0ba967e8530b2b6feb0f366c3acc6eb4e6ec5b..e6c2c670e1e78fd2ab66d6f6f25bbbca8129f6a0 100644 --- a/test/intersect/test-intersect.sh +++ b/test/intersect/test-intersect.sh @@ -446,7 +446,16 @@ echo \ "chr1^I10^I20^I345.7^Iwhy?^I-^Ichr1^I11^I21^I345.7^Iwhy?^I+" > exp $BT intersect -a bed6.strand.bed -b bed6.strand2.bed -wa -wb -S | cat -t > obs check obs exp - rm obs exp +################################################################## +# Test that intersect of bed query with BAM DB gives Bed output. +################################################################## +echo " intersect.t37...\c" +echo \ +"chr1 10 20 a1 1 + +chr1 100 200 a2 2 -" > exp +$BT intersect -a a.bed -b a.bam > obs + + rm one_block.bam two_blocks.bam three_blocks.bam \ No newline at end of file