Skip to content

Commit

Permalink
account for wildcard "N"
Browse files Browse the repository at this point in the history
  • Loading branch information
jrobinso committed Nov 29, 2023
1 parent 2792a5d commit cce4cc3
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/main/java/org/broad/igv/sam/SAMAlignment.java
Original file line number Diff line number Diff line change
Expand Up @@ -407,13 +407,19 @@ boolean validateMMTag(String mm, byte[] sequence) {
String[] mmTokens = mm.split(";");
for (String mmi : mmTokens) {
String[] tokens = mmi.split(","); //Globals.commaPattern.split(mm);
byte base = (byte) tokens[0].charAt(0);
char strand = tokens[0].charAt(1);
if (strand == '-') {
base = SequenceUtil.complement(base);
int baseCount;
if(tokens[0].charAt(0) == 'N') {
baseCount = sequence.length;
} else {
byte base = (byte) tokens[0].charAt(0);
char strand = tokens[0].charAt(1);
if (strand == '-') {
base = SequenceUtil.complement(base);
}
baseCount = 0;
for (int i = 0; i < sequence.length; i++) if (sequence[i] == base) baseCount++;
}
int baseCount = 0;
for (int i = 0; i < sequence.length; i++) if (sequence[i] == base) baseCount++;

// Count # of bases implied by tag
int modified = tokens.length - 1; // All tokens but the first are "skip" numbers
int skipped = 0;
Expand Down

0 comments on commit cce4cc3

Please sign in to comment.