]> git.donarmstrong.com Git - bamtools.git/log
bamtools.git
13 years agoMerge branch 'master' of http://github.com/pezmaster31/bamtools
Erik Garrison [Thu, 23 Sep 2010 14:30:09 +0000 (10:30 -0400)]
Merge branch 'master' of http://github.com/pezmaster31/bamtools

13 years agoImplemented 'compound rule' logic in the FilterTool's script support.
Derek [Wed, 22 Sep 2010 02:00:14 +0000 (22:00 -0400)]
Implemented 'compound rule' logic in the FilterTool's script support.

 * Previously the script was limited to doing 'OR' comparisons on various
property sets (what I call here filters). Now, by providing each filter
with an id, you can use these id's to define a compound rule.

 * Documentation is severely lacking on this end at the moment, but I hope
to have a good explanation up soon.  I think this interface could provide
a powerful flexibility in querying BAM files for very specific cases for
further analyses.

13 years agoCleaned up SplitTool internal implementation. Use of template methods should make...
Derek [Mon, 20 Sep 2010 15:35:16 +0000 (11:35 -0400)]
Cleaned up SplitTool internal implementation. Use of template methods should make maintenance a bit easier.

13 years agoMerge branch 'master' of http://github.com/pezmaster31/bamtools
Erik Garrison [Mon, 20 Sep 2010 12:33:39 +0000 (08:33 -0400)]
Merge branch 'master' of http://github.com/pezmaster31/bamtools

13 years agoRemoved a backup text file that snuck into an earlier commit
Derek [Sun, 19 Sep 2010 21:06:02 +0000 (17:06 -0400)]
Removed a backup text file that snuck into an earlier commit

13 years agoAdded implementation of new SplitTool. This tool splits a single BAM file into multi...
Derek [Sun, 19 Sep 2010 21:05:16 +0000 (17:05 -0400)]
Added implementation of new SplitTool.  This tool splits a single BAM file into multiple BAMs, based on a user-specified property.  For now, properties supported are mapped/unmapped, paired/unpaired, split by reference, and split based on a given tag.

13 years agoAdded GetTagType() to BamAlignment
Derek [Sun, 19 Sep 2010 21:02:17 +0000 (17:02 -0400)]
Added GetTagType() to BamAlignment

13 years agoUpdated to match new BamAlignment.h includes
Derek [Sat, 18 Sep 2010 20:47:34 +0000 (16:47 -0400)]
Updated to match new BamAlignment.h includes

13 years agoMissed api/Makefile in last commit.
Derek [Sat, 18 Sep 2010 20:45:29 +0000 (16:45 -0400)]
Missed api/Makefile in last commit.

13 years agoMoved BamAlignment data structure out to its own .h/.cpp. BamAux.h was getting over...
Derek [Sat, 18 Sep 2010 20:43:37 +0000 (16:43 -0400)]
Moved BamAlignment data structure out to its own .h/.cpp.  BamAux.h was getting over-crowded. *NOTE - This means that if you were using the BamAlignment data structure in code without a reader/writer, you need to include BamAlignment.h instead of BamAux.h.  If your code was using reader/writer, no changes should be necessary on your end.

13 years agoMerge branch 'master' of http://github.com/pezmaster31/bamtools
Erik Garrison [Sat, 18 Sep 2010 20:04:58 +0000 (16:04 -0400)]
Merge branch 'master' of http://github.com/pezmaster31/bamtools

13 years agoFixed: bug related to accessing data (or regions with no alignments) near the ends...
Derek [Sat, 18 Sep 2010 04:42:23 +0000 (00:42 -0400)]
Fixed: bug related to accessing data (or regions with no alignments) near the ends of references, when using .bti index files. Required modifying the BamToolsIndex build step.  *NOTE: This update invalidates any existing .bti files, please re-generate any that you have currently.* Versioning system in BTI will not allow users to use the older, buggy version... so no chance of accidental usage.

13 years agoMerge branch 'master' of http://github.com/pezmaster31/bamtools
Erik Garrison [Fri, 17 Sep 2010 15:30:59 +0000 (11:30 -0400)]
Merge branch 'master' of http://github.com/pezmaster31/bamtools

Conflicts:
src/api/BamIndex.cpp

13 years agoOn second thought, moved the (non-indexing) constants back to BamAux.h, since they...
Derek [Thu, 16 Sep 2010 05:52:26 +0000 (01:52 -0400)]
On second thought, moved the (non-indexing) constants back to BamAux.h, since they are not technically specific to BamWriter only and clients may be using them in their code

13 years agoDid some housekeeping in BamAux.h - moved some constants to the files where they...
Derek [Thu, 16 Sep 2010 05:47:58 +0000 (01:47 -0400)]
Did some housekeeping in BamAux.h - moved some constants to the files where they are actually used.

13 years agoMissed an update to BamToolsIndex code in a previous commit
Derek [Thu, 16 Sep 2010 05:41:03 +0000 (01:41 -0400)]
Missed an update to BamToolsIndex code in a previous commit

13 years agoAdded new PileupEngine to the toolkit. This is used by CoverageTool as well as Conver...
Derek [Thu, 16 Sep 2010 05:37:28 +0000 (01:37 -0400)]
Added new PileupEngine to the toolkit. This is used by CoverageTool as well as ConvertTool for pileup format. Pileup conversion output before was buggy and overall incorrect.  Now should match SAMtools output to the best of my knowledge

13 years agoAdded option for users to specifiy half-open (1-based) return value for BamAlignment...
Derek [Wed, 15 Sep 2010 15:48:33 +0000 (11:48 -0400)]
Added option for users to specifiy half-open (1-based) return value for BamAlignment::GetEndPosition().  By default, returns 0-based coordinate after recent modification.

13 years agoMerge branch 'master' of http://github.com/pezmaster31/bamtools
Erik Garrison [Mon, 13 Sep 2010 19:10:08 +0000 (15:10 -0400)]
Merge branch 'master' of http://github.com/pezmaster31/bamtools

13 years agoFixed off-by-one error in BamAlignment::GetEndPosition()
Derek [Mon, 13 Sep 2010 18:50:05 +0000 (14:50 -0400)]
Fixed off-by-one error in BamAlignment::GetEndPosition()

13 years agoupdated debugging output in BamIndex, seek vs. calculate distinction
Erik Garrison [Sat, 11 Sep 2010 17:27:30 +0000 (13:27 -0400)]
updated debugging output in BamIndex, seek vs. calculate distinction

13 years agoAdded more verbose debugging output to BamMultiReader::SetRegion
Erik Garrison [Sat, 11 Sep 2010 14:55:22 +0000 (10:55 -0400)]
Added more verbose debugging output to BamMultiReader::SetRegion

13 years agoReimplemented BamToolsIndex for bug fix and performance upgrade. *** NOTE *** This...
Derek [Fri, 10 Sep 2010 21:38:03 +0000 (17:38 -0400)]
Reimplemented BamToolsIndex for bug fix and performance upgrade. *** NOTE *** This commit invalidats any previous BamToolsIndex files (.bti). Please re-run 'bamtools index -bti -in <yourBam>' to generate the new index files.

13 years agoRemoved debug output statement that slipped into last commit.
Derek [Fri, 10 Sep 2010 03:45:21 +0000 (23:45 -0400)]
Removed debug output statement that slipped into last commit.

13 years agoReorganizing index/jumping calls. Now all BamReader cares about is sending a Jump...
Derek [Fri, 10 Sep 2010 03:42:04 +0000 (23:42 -0400)]
Reorganizing index/jumping calls. Now all BamReader cares about is sending a Jump() request to a BamIndex with a desired region and receiving a success/fail flag. BamIndex-derived classes will now handle all index-format-specific offset calculation, overlap checking, etc and make sure its associated BGZF stream has seek-ed as close to the desired region as that index scheme allows.

13 years agoprefer bamtools index in BamMultiReader
Erik Garrison [Wed, 8 Sep 2010 20:17:20 +0000 (16:17 -0400)]
prefer bamtools index in BamMultiReader

13 years agoMerge branch 'master' of git://github.com/pezmaster31/bamtools
Erik Garrison [Wed, 8 Sep 2010 19:36:39 +0000 (15:36 -0400)]
Merge branch 'master' of git://github.com/pezmaster31/bamtools

Conflicts:
src/api/BamReader.cpp

13 years agoRelicensed the source code used in bamtools_options. Most of it derived from Mosaik...
Derek [Tue, 7 Sep 2010 18:42:03 +0000 (14:42 -0400)]
Relicensed the source code used in bamtools_options. Most of it derived from Mosaik source, which was originally released under GPL.  Now under MIT License with author's permission. This puts the entire BamTools codebase securely under one unrestrictive license.

13 years agoDocumentation update
Derek [Tue, 7 Sep 2010 18:30:08 +0000 (14:30 -0400)]
Documentation update

13 years agoAdded -region option to bamtools_merge
Derek [Tue, 7 Sep 2010 17:24:56 +0000 (13:24 -0400)]
Added -region option to bamtools_merge

13 years agoPreviously missed a line in BamReader.cpp with the recent index overhaul.
Derek [Tue, 7 Sep 2010 04:56:03 +0000 (00:56 -0400)]
Previously missed a line in BamReader.cpp with the recent index overhaul.

13 years agoLarge-scale API indexing re-organization:
Derek [Fri, 3 Sep 2010 21:14:05 +0000 (17:14 -0400)]
Large-scale API indexing re-organization:

 * Moved FileExists() to BamAux.h so that all API classes have access to its functionality.
 * Created 2 'factory methods' in BamIndex.h to return a BamIndex subclass, depending on client\'s specified PreferredIndexType & on what files actually exist on disk.
 * Renamed BamDefaultIndex as BamStandardIndex.  Hopefully this name should be a clearer description going forward than BamDefaultIndex, since the standardized index may not always be the 'default' in every situation.

13 years agoModified Utilities::FileExists() so it doesnt rely on sys/stat.h. While this header...
Derek [Fri, 3 Sep 2010 04:40:11 +0000 (00:40 -0400)]
Modified Utilities::FileExists() so it doesnt rely on sys/stat.h.  While this header is de facto provided and supported on *most* systems, it really is not standard C/C++, so cant be trusted to be fully portable.

13 years agoCleaned up index file handling throughout toolkit. Did this by adding a FileExists...
Derek [Fri, 3 Sep 2010 04:37:39 +0000 (00:37 -0400)]
Cleaned up index file handling throughout toolkit.  Did this by adding a FileExists() methods to BamMultiReader for determining which index file to load.

13 years agoAdded IsIndexLoaded() public method to BamReader. Allows client to make sure index...
Derek [Fri, 3 Sep 2010 04:35:05 +0000 (00:35 -0400)]
Added IsIndexLoaded() public method to BamReader. Allows client to make sure index data is available before attempting any random access ops

13 years agoModified help description for -bti option
Derek [Thu, 2 Sep 2010 19:58:06 +0000 (15:58 -0400)]
Modified help description for -bti option

13 years agoAdded uncompressed output as default behavior for Filter-, Merge-, and RandomTools...
Derek [Wed, 1 Sep 2010 03:09:20 +0000 (23:09 -0400)]
Added uncompressed output as default behavior for Filter-, Merge-, and RandomTools when sending results to stdout. User can override this behavior using the command line option: -forceCompression

13 years agoPosted implementation of FilterTool.
Derek [Mon, 30 Aug 2010 22:53:59 +0000 (18:53 -0400)]
Posted implementation of FilterTool.

13 years agoMinor formatting & commenting update
Derek [Mon, 30 Aug 2010 20:17:32 +0000 (16:17 -0400)]
Minor formatting & commenting update

13 years agoUpdated bamtools_utilities with #defines
Derek [Mon, 30 Aug 2010 20:12:23 +0000 (16:12 -0400)]
Updated bamtools_utilities with #defines

13 years agoUpdating bamtools_options
Derek [Mon, 30 Aug 2010 20:11:14 +0000 (16:11 -0400)]
Updating bamtools_options

13 years agoAdded bamtools_filter_engine.*
Derek [Mon, 30 Aug 2010 20:08:09 +0000 (16:08 -0400)]
Added bamtools_filter_engine.*

13 years agoRemoved -pg debug flag from Makefile CXXFLAGS, accidentally incorporated into a prior...
Derek [Mon, 30 Aug 2010 20:05:50 +0000 (16:05 -0400)]
Removed -pg debug flag from Makefile CXXFLAGS, accidentally incorporated into a prior commit

13 years agoForgot to add jsoncpp/json.h in a previous commit
Derek [Mon, 30 Aug 2010 20:04:04 +0000 (16:04 -0400)]
Forgot to add jsoncpp/json.h in a previous commit

13 years agoFixed: Calls to GetEndPosition() rely on CIGAR data being parsed. Previously this...
Derek [Mon, 30 Aug 2010 19:57:55 +0000 (15:57 -0400)]
Fixed: Calls to GetEndPosition() rely on CIGAR data being parsed. Previously this was not set if BamAlignment was retrieved via GetNextAlignmentCore().  Moved CIGAR parsing back to LoadNextAlignment() to ensure this works properly.

13 years agoAdded JsonCPP code to repo. Will be used by FilterTool for script parsing
Derek [Mon, 30 Aug 2010 19:55:20 +0000 (15:55 -0400)]
Added JsonCPP code to repo. Will be used by FilterTool for script parsing

13 years agochange printf's to fprint(stderr,
Erik Garrison [Fri, 20 Aug 2010 16:22:34 +0000 (12:22 -0400)]
change printf's to fprint(stderr,

This pushes errors to the expected output, stderr, instead of mixing
them into the standard output stream.

13 years agoMissed a Makefile in last commit - just adding header comments
Derek [Wed, 18 Aug 2010 19:59:10 +0000 (15:59 -0400)]
Missed a Makefile in last commit - just adding header comments

13 years agoAdded simple header comments to all Makefiles, to help distinguish between them easier
Derek [Wed, 18 Aug 2010 19:56:58 +0000 (15:56 -0400)]
Added simple header comments to all Makefiles, to help distinguish between them easier

13 years agoModified Makefile to ensure creation of bin/ and obj/ directories
Derek [Wed, 18 Aug 2010 19:28:51 +0000 (15:28 -0400)]
Modified Makefile to ensure creation of bin/ and obj/ directories

13 years agoReorganized source tree & build system
Derek [Wed, 18 Aug 2010 19:19:08 +0000 (15:19 -0400)]
Reorganized source tree & build system

13 years agoMinor formatting cleanup in BamIndex.*
Derek [Wed, 18 Aug 2010 01:51:51 +0000 (21:51 -0400)]
Minor formatting cleanup in BamIndex.*

13 years agoModified the way BGZF sets up uncompressed output. Modified BamWriter to support...
Derek [Tue, 17 Aug 2010 20:39:44 +0000 (16:39 -0400)]
Modified the way BGZF sets up uncompressed output. Modified BamWriter to support uncompressed option.

13 years agoModified BamWriter::Open() to return bool on success/fail - was silent before, so...
Derek [Tue, 17 Aug 2010 19:19:10 +0000 (15:19 -0400)]
Modified BamWriter::Open() to return bool on success/fail - was silent before, so clients had no way of handling errors

13 years agoAdded write-uncompressed flag to BGZF. Commit includes some other formatting cleanup...
Derek [Tue, 17 Aug 2010 16:04:51 +0000 (12:04 -0400)]
Added write-uncompressed flag to BGZF. Commit includes some other formatting cleanup as well.

13 years agoMerge git://github.com/ekg/bamtools
Derek [Fri, 6 Aug 2010 15:35:50 +0000 (11:35 -0400)]
Merge git://github.com/ekg/bamtools

13 years agoMinor formatting cleanup: really just an update to be able to pull in Erik's JSON...
Derek [Fri, 6 Aug 2010 15:35:43 +0000 (11:35 -0400)]
Minor formatting cleanup: really just an update to be able to pull in Erik's JSON changes.

13 years agofor json output in bamtools convert
Erik Garrison [Thu, 5 Aug 2010 13:01:02 +0000 (09:01 -0400)]
for json output in bamtools convert

Process qualities to provide a list of Q scores in the json output
instead of just a string of characters.

13 years agoBug fix in BamReader::Jump()
Derek [Wed, 4 Aug 2010 20:03:07 +0000 (16:03 -0400)]
Bug fix in BamReader::Jump()

13 years agoAdded AddTag/EditTag/RemoveTag methods to BamAlignment. Refactored existing GetTag...
Derek [Tue, 27 Jul 2010 16:52:58 +0000 (12:52 -0400)]
Added AddTag/EditTag/RemoveTag methods to BamAlignment. Refactored existing GetTag methods.

13 years agoReworded bamtools stats general help description
Derek [Fri, 23 Jul 2010 03:10:54 +0000 (23:10 -0400)]
Reworded bamtools stats general help description

13 years agoMostly cosmetic fixes. A few tweaks to subtool options/settings naming or default...
Derek [Fri, 23 Jul 2010 03:09:58 +0000 (23:09 -0400)]
Mostly cosmetic fixes. A few tweaks to subtool options/settings naming or default handling as well.

13 years agoImplemented basic alignment stats (count/%) for most of the alignment flags
Derek [Fri, 23 Jul 2010 02:58:15 +0000 (22:58 -0400)]
Implemented basic alignment stats (count/%) for most of the alignment flags

13 years agoVarious cleanups. Added -noheader to SAM conversion in ConvertTool
Derek [Thu, 22 Jul 2010 18:24:54 +0000 (14:24 -0400)]
Various cleanups.  Added -noheader to SAM conversion in ConvertTool

13 years agoForgot to update Makefile with last commit
Derek [Thu, 22 Jul 2010 18:23:48 +0000 (14:23 -0400)]
Forgot to update Makefile with last commit

13 years agoRemoved SamTool (bamtools sam ...) from toolkit. This functionality is covered by...
Derek [Thu, 22 Jul 2010 18:23:14 +0000 (14:23 -0400)]
Removed SamTool (bamtools sam ...) from toolkit.  This functionality is covered by ConvertTool.

13 years agoFixed variable length tag data retrieval in BamAlignment::GetTag(). To do this, remov...
Derek [Thu, 22 Jul 2010 16:18:16 +0000 (12:18 -0400)]
Fixed variable length tag data retrieval in BamAlignment::GetTag(). To do this, removed templated GetTag(). Now have explicit overridden string, unsigned int, signed int, and float flavors of the method.

13 years agoFixed: remove unnecessary EOF write attempt for read-only files in BGZF::Close()
Derek [Thu, 22 Jul 2010 16:16:06 +0000 (12:16 -0400)]
Fixed: remove unnecessary EOF write attempt for read-only files in  BGZF::Close()

13 years agoForgot to include updated bamtools 'main' with RandomTool commmit.
Derek [Wed, 21 Jul 2010 15:00:44 +0000 (11:00 -0400)]
Forgot to include updated bamtools 'main' with RandomTool commmit.

13 years agoAdded the <cctype> include to BamAux to explicitly support the toupper() fxn. It...
Derek [Wed, 21 Jul 2010 14:48:04 +0000 (10:48 -0400)]
Added the <cctype> include to BamAux to explicitly support the toupper() fxn.  It had slipped past newer compilers so far

13 years agoFixed fopen-related typo in bamtools_fasta.*
Derek [Tue, 20 Jul 2010 22:34:31 +0000 (18:34 -0400)]
Fixed fopen-related typo in bamtools_fasta.*

13 years agoAdded basic implementation of RandomTool. This generates a random (well, pseudo....
Derek [Tue, 20 Jul 2010 20:28:31 +0000 (16:28 -0400)]
Added basic implementation of RandomTool. This generates a random (well, pseudo... its based on rand()) subset of alignments from BAM file(s). User can specify REGION and/or number of alignments to generate. No duplicate checking implemented. TODO: Handle BAM files without existing index - tool currently depends heavily on being able to jump around randomly

13 years agoModified BamMultiReader::Open() to return bool. Still needs some tweaks to handle...
Derek [Tue, 20 Jul 2010 20:25:48 +0000 (16:25 -0400)]
Modified BamMultiReader::Open() to return bool. Still needs some tweaks to handle all error cases correctly.

13 years agoAdded cross-platform LFS for tell/seek. Removed fopen64/freopen64 - hopefully unecess...
Derek [Mon, 19 Jul 2010 23:05:51 +0000 (19:05 -0400)]
Added cross-platform LFS for tell/seek. Removed fopen64/freopen64 - hopefully unecessary with -D_FILE_OFFSET_BITS=64 compiler flag

13 years agoFixed Rewind(). Now using LoadNextAlignment() instead of GetNextAlignmentCore()...
Derek [Thu, 15 Jul 2010 18:04:16 +0000 (14:04 -0400)]
Fixed Rewind().  Now using LoadNextAlignment() instead of GetNextAlignmentCore(). GNAC() does region checks which, in this case of clearing prior region data, are unnecessary at best and most likely erroneous.

13 years agoModified Rewind() to check actual data present when resetting region markers, instead...
Derek [Thu, 15 Jul 2010 17:59:42 +0000 (13:59 -0400)]
Modified Rewind() to check actual data present when resetting region markers, instead of relying on potentially incorrect RefData::RefHasAlignments

13 years agoModified handling of BamAlignmentSupportData. This fix should allow BamWriter::SaveA...
Derek [Thu, 15 Jul 2010 17:44:53 +0000 (13:44 -0400)]
Modified handling of BamAlignmentSupportData.  This fix should allow BamWriter::SaveAlignment to still handle BamAlignments retrieved using the 'standard' GetNextAlignment[Core] correctly, while adding support for BamAlignments **generated directly** in client code. Switched BASD::IsParsed to HasCoreOnly, which is false by default and only set by BamReader::GetMextAlignmentCore() - therefore the client should never to touch the BASD struct.

13 years agoPurely cosmetic udpate. Cleaned up some commented blocks, added file header informati...
Derek [Tue, 13 Jul 2010 16:00:42 +0000 (12:00 -0400)]
Purely cosmetic udpate. Cleaned up some commented blocks, added file header information (author, description, etc)

13 years agoUpdated Makefile for fasta & pileup
Derek [Tue, 13 Jul 2010 14:47:17 +0000 (10:47 -0400)]
Updated Makefile for fasta & pileup

13 years agoAdded support for reading FASTA sequences, as well as generating FASTA index (.fai...
Derek [Tue, 13 Jul 2010 01:57:40 +0000 (21:57 -0400)]
Added support for reading FASTA sequences, as well as generating FASTA index (.fai) files. TODO: need to drop FASTA functionality into pileup conversion, as well as create command line feature to generate FASTA indices

13 years agoBegun basic pileup conversion
Derek [Tue, 13 Jul 2010 01:53:57 +0000 (21:53 -0400)]
Begun basic pileup conversion

13 years agoAdded simple PrintBed() method; plan to add PrintWiggle() next. Added use of function...
Derek [Fri, 9 Jul 2010 19:29:17 +0000 (15:29 -0400)]
Added simple PrintBed() method; plan to add PrintWiggle() next. Added use of function pointer to clean up code for conversion method selection.

13 years agoFixed typos in last commit.
Derek [Fri, 9 Jul 2010 17:02:07 +0000 (13:02 -0400)]
Fixed typos in last commit.

13 years agoReorganized convert tool code. Restored stdin by default. Implemented FASTA/FASTQ...
Derek [Fri, 9 Jul 2010 16:57:55 +0000 (12:57 -0400)]
Reorganized convert tool code. Restored stdin by default. Implemented FASTA/FASTQ convert methods. Still need to include support for new (.bti) index file format

13 years agoMerge http://github.com/ekg/bamtools
Derek [Fri, 9 Jul 2010 16:28:22 +0000 (12:28 -0400)]
Merge http://github.com/ekg/bamtools

13 years agoFixed: proper handling of BamAlignment::AlignedBases when QueryBases is empty. Thank...
Derek [Fri, 9 Jul 2010 16:20:39 +0000 (12:20 -0400)]
Fixed: proper handling of BamAlignment::AlignedBases when QueryBases is empty.  Thanks to Aaron Quinlan for catching this.

13 years agoUpdated index and count sub-tools to recognize new (.bti) index file format
Derek [Fri, 9 Jul 2010 16:08:31 +0000 (12:08 -0400)]
Updated index and count sub-tools to recognize new (.bti) index file format

13 years agoSeparated indexing ops to new class. Implemented a fixed-partition-size index format...
Derek [Fri, 9 Jul 2010 16:06:27 +0000 (12:06 -0400)]
Separated indexing ops to new class. Implemented a fixed-partition-size index format (.bti) as an alternative to the BAM default (.bai)

13 years agoEnforced proper handling of large files (>4Gb) on 32-bit systems.
Derek [Fri, 9 Jul 2010 16:04:07 +0000 (12:04 -0400)]
Enforced proper handling of large files (>4Gb) on 32-bit systems.

13 years agoMerge BamMultiReader and SetRegion into bamtools convert
Erik Garrison [Wed, 7 Jul 2010 19:54:39 +0000 (15:54 -0400)]
Merge BamMultiReader and SetRegion into bamtools convert

This commit merges the BamMultiReader and SetRegion method into the
conversion tool.  This greatly simplifies the process of dumping
alignments from regions in a set of bam files.

Breaking in this commit: stdin input by default.  To be fixed in a
subsequent commit.

13 years agoRemove heavy-handed failure mode in BamMultiReader::SetRegion
Erik Garrison [Wed, 7 Jul 2010 19:32:48 +0000 (15:32 -0400)]
Remove heavy-handed failure mode in BamMultiReader::SetRegion

In practice a failure of BamReader::SetRegion means that we can't get
alignments from the specified region.  It is simpler to ignore failures
of SetRegion as they are gracefully handled by UpdateAlignments, which
simply doesn't add alignments from the readers which don't have
alignments in the target region.

This resolves a bug in which bamtools count (and any other utility using
BamMultiReader::SetRegion) would crash when provided a target region
with no alignments.

13 years agoRemoved accidental commit of .o files
Derek [Mon, 28 Jun 2010 19:14:12 +0000 (15:14 -0400)]
Removed accidental commit of .o files

13 years agoModified BamReader(and BGZF)::Open() to return bool. Tried to eliminate most exit...
Derek [Mon, 28 Jun 2010 19:10:28 +0000 (15:10 -0400)]
Modified BamReader(and BGZF)::Open() to return bool. Tried to eliminate most exit() calls. These changes should allow for more graceful error handling. Some 'code cleanup' in BW, but no logic changes.

13 years agoUpdated temp file path stubs to reflect input BAM file stub, so that simultaneous...
Derek [Tue, 22 Jun 2010 03:17:38 +0000 (23:17 -0400)]
Updated temp file path stubs to reflect input BAM file stub, so that simultaneous sort runs don't interfere with each other.

13 years agoRough implementation of sort tool. Generate lots of smaller sorted (STL sort with...
Derek [Tue, 22 Jun 2010 02:23:32 +0000 (22:23 -0400)]
Rough implementation of sort tool.  Generate lots of smaller sorted (STL sort with 'custom' compare fxn) temp files in one pass, using a specified buffer size.  Uses BamMultiReader paired with BamWriter to re-merge all temp files back into a single output BAM, also in one pass. Some work remains on optimizing parameters (e.g. default buffer size), scalability (single pass generates lots of temp files), & parallelization to make tool more sophisticated & robust.

13 years agoGracefully handle empty files with the BamMultiReader
Erik Garrison [Mon, 21 Jun 2010 15:56:39 +0000 (11:56 -0400)]
Gracefully handle empty files with the BamMultiReader

This commit handles the case where an empty BAM file is passed in the
list of filenames given to BamMultiReader::Open(...).  Now a warning is
emitted if the file contains no alignments (or cannot be opened) and the
file is ignored.

13 years agointegration of SetRegion into BamMultiReader
Erik Garrison [Fri, 18 Jun 2010 19:13:46 +0000 (15:13 -0400)]
integration of SetRegion into BamMultiReader

Also includes update to bamtools_count which uses the BamMultiReader by
default and no longer requires the specification of an index file on the
command line, as this would be very cumbersome to parse for multiple
input files.  Added method to check for file existence using stat to
bamtools_utilities.cpp

13 years agomoved bamtools_count to use BamRegion
Erik Garrison [Fri, 18 Jun 2010 15:31:34 +0000 (11:31 -0400)]
moved bamtools_count to use BamRegion

This is more consistent than using a bespoke struct (Region) with the
same fields.

13 years agoModified Jump() scheme to take better account of specified region and drill down...
Derek [Thu, 17 Jun 2010 21:35:27 +0000 (17:35 -0400)]
Modified Jump() scheme to take better account of specified region and drill down closer to region beginning. Introduced RegionState to BRP in order to allow LoadNextAlignment to quit once an alignment is found beyond region.

13 years agoModified BamReaderPrivate::GetOffset() & BinsFromRegion() to make use of right bound...
Derek [Thu, 17 Jun 2010 16:31:29 +0000 (12:31 -0400)]
Modified BamReaderPrivate::GetOffset() & BinsFromRegion() to make use of right bound cutoffs