Skip to content

Commit

Permalink
make BAM feature IDs truly unique. should have thought of this 6 year…
Browse files Browse the repository at this point in the history
…s ago. (cc @cmdcolin)
  • Loading branch information
rbuels committed Jul 3, 2018
1 parent fd86983 commit 0b148fd
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
3 changes: 3 additions & 0 deletions release-notes.md
Expand Up @@ -5,6 +5,9 @@
* Fixed a memory leak that was introduced in JBrowse 1.13.1 in generate-names.pl. Thanks to
@scottcain for reporting (issue #1058, @cmdcolin).

* Fixed a bug in which duplicate BAM features would sometimes not be shown separately in the
view if they contain the same data. (@rbuels)

# Release 1.14.2 2018-06-04 23:41:52 UTC

## Minor improvements
Expand Down
3 changes: 2 additions & 1 deletion src/JBrowse/Store/SeqFeature/BAM/File.js
Expand Up @@ -449,7 +449,8 @@ var BamFile = declare( null,
var feature = new BAMFeature({
store: this.store,
file: this,
bytes: { byteArray: ba, start: blockStart, end: blockEnd }
bytes: { byteArray: ba, start: blockStart, end: blockEnd },
featureNumber: featureCount,
});
sink.push(feature);
featureCount++;
Expand Down
7 changes: 6 additions & 1 deletion src/JBrowse/Store/SeqFeature/BAM/LazyFeature.js
Expand Up @@ -27,6 +27,8 @@ var Feature = Util.fastDeclare(
byteArray: args.bytes.byteArray
};

this.featureNumber = args.featureNumber // feature number within the block

this._coreParse();
},

Expand Down Expand Up @@ -100,7 +102,10 @@ var Feature = Util.fastDeclare(
},

id: function() {
return this._get('name')+'/'+this._get('md')+'/'+this._get('cigar')+'/'+this._get('start')+'/'+this._get('multi_segment_next_segment_reversed');
// the guaranteed unique ID of the feature is the byte
// offset in the file of the block that it is in,
// plus the sequential number of this feature's place in the block.
return `${this.bytes.start}-${this.featureNumber}`
},

multi_segment_all_aligned: function() {
Expand Down

0 comments on commit 0b148fd

Please sign in to comment.