Skip to content
This repository has been archived by the owner on Aug 6, 2024. It is now read-only.

Commit

Permalink
Updated bwa disambiguation to ignore missing AS tag that can result f…
Browse files Browse the repository at this point in the history
…rom ALT-alignments in e.g. hg38
  • Loading branch information
Ahdesmaki, Miika J authored and Ahdesmaki, Miika J committed Feb 23, 2016
1 parent 4c6e4fb commit 38d9626
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
4 changes: 4 additions & 0 deletions disambiguate.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ def disambiguate(humanlist, mouselist, disambalgo):
except KeyError:
if bwatags[x] == 'NM':
bwatags[x] = 'nM' # oddity of STAR
elif bwatags[x] == 'AS':
continue # this can happen for e.g. hg38 ALT-alignments (missing AS)
QScore = bwatagsigns[x]*read.opt(bwatags[x])

if AS[x][d12]<QScore:
Expand All @@ -115,6 +117,8 @@ def disambiguate(humanlist, mouselist, disambalgo):
except KeyError:
if bwatags[x] == 'NM':
bwatags[x] = 'nM' # oddity of STAR
elif bwatags[x] == 'AS':
continue # this can happen for e.g. hg38 ALT-alignments (missing AS)
QScore = bwatagsigns[x]*read.opt(bwatags[x])

if AS[x][d12]<QScore:
Expand Down
13 changes: 11 additions & 2 deletions dismain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,11 @@ int disambiguate(list<BamAlignment>& hlist,list<BamAlignment>& mlist, string dis
//creating a temp value to store the gettag results
uint32_t *bwatagvaluetemp = new uint32_t(1);
//we use x to get the right tagname
temp.GetTag<uint32_t>(bwatagname[x],*bwatagvaluetemp);
bool wasfound = temp.GetTag<uint32_t>(bwatagname[x],*bwatagvaluetemp);
if (!wasfound && bwatagname[x] == "AS"){ // this can happen in bwa e.g. for hg38 ALT-alignments and AS missing
delete bwatagvaluetemp;
continue;
}
//and then get the corresponding tag sign
//bwa is done sequentially over grouped so the Qscores are calculated per Tag
//maths tagsign * tagvalue from gettag
Expand Down Expand Up @@ -367,7 +371,12 @@ int disambiguate(list<BamAlignment>& hlist,list<BamAlignment>& mlist, string dis
{
uint32_t *bwatagvaluetemp = new uint32_t(1);

temp.GetTag<uint32_t>(bwatagname[x],*bwatagvaluetemp);
bool wasfound = temp.GetTag<uint32_t>(bwatagname[x],*bwatagvaluetemp);
if (!wasfound && bwatagname[x] == "AS"){ // this can happen in bwa e.g. for hg38 ALT-alignments and AS missing
delete bwatagvaluetemp;
continue;
}


QScore = ((bwatagsigns[x]) * (int)(*bwatagvaluetemp));

Expand Down

0 comments on commit 38d9626

Please sign in to comment.