Skip to content

Commit

Permalink
Merge pull request #17 from cjdjpj/main
Browse files Browse the repository at this point in the history
Enable lowercase reference bases in pileup
  • Loading branch information
jeffersonfparil authored May 29, 2024
2 parents ed4588b + 0931c2a commit 8df4b2e
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/base/pileup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,15 @@ impl Parse<PileupLine> for String {
// 'C'/'c' == 67/99,
// 'G'/'g' == 71/103, and
// '*' == 42 codes for deletion on the current locus which is different from the \-[0-9]+[ACGTNacgtn]+ which encodes for indels in the next position/s)
let a: u8 = if (code == 44) | (code == 46) {
let base: u8 = if (code == 44) | (code == 46) {
// whatever the reference allele is
reference_allele.to_string().as_bytes()[0]
} else {
match code {
// alternative allele or D/N
code
};

let a: u8 = match base {
65 => 65, // A
97 => 65, // a -> A
84 => 84, // T
Expand All @@ -123,8 +127,7 @@ impl Parse<PileupLine> for String {
103 => 71, // g -> G
42 => 68, // * -> D
_ => 78, // N
}
};
};
alleles.push(a);
}
read_codes.push(alleles);
Expand Down

0 comments on commit 8df4b2e

Please sign in to comment.