Permalink
Browse files

strand_proxy to make sort order consistent across systems

  • Loading branch information...
yang-yangfeng committed Jan 7, 2018
1 parent 93cd094 commit 95a451a39060be5759703ffc2d06ac46759d96f4
Showing with 15 additions and 2 deletions.
  1. +14 −1 src/junctions/junctions_extractor.cc
  2. +1 −1 src/junctions/junctions_extractor.h
@@ -144,7 +144,20 @@ int JunctionsExtractor::add_junction(Junction j1) {
string start, end;
s1 << j1.start; start = s1.str();
s1 << j1.end; end = s1.str();
string key = j1.chrom + string(":") + start + "-" + end + ":" + j1.strand;
//since ?,+,- sort differently on different systems
char strand_proxy;
switch(j1.strand) {
case '+':
strand_proxy = '0';
break;
case '-':
strand_proxy = '1';
break;
case '?':
strand_proxy = '2';
break;
}
string key = j1.chrom + string(":") + start + "-" + end + ":" + strand_proxy;
//Check if new junction
if(!junctions_.count(key)) {
@@ -134,7 +134,7 @@ class JunctionsExtractor {
//Maximum length of an intron, i.e max junction width
uint32_t max_intron_length_;
//Map to store the junctions
//The key is "chr:start-end"
//The key is "chr:start-end:strand"
//The value is an object of type Junction(see above)
map<string, Junction> junctions_;
//Maintain a sorted list of junctions

0 comments on commit 95a451a

Please sign in to comment.