Skip to content

Commit

Permalink
handle more chrMT namings
Browse files Browse the repository at this point in the history
  • Loading branch information
brentp committed Apr 9, 2021
1 parent 87b8ffb commit 7be61a8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
v0.0.5
======
+ handle more chrMT namings

v0.0.4
============
+ plot aesthetics (#23)
Expand Down
5 changes: 5 additions & 0 deletions src/seqcoverpkg/transcript.nim
Original file line number Diff line number Diff line change
Expand Up @@ -161,12 +161,17 @@ proc `%`*[T](table: TableRef[string, T]): JsonNode =

proc get_chrom(chrom:string, dp:var Cover, fai:Fai): string =
## add or remove "chr" to match chromosome names.
const MTs = ["MT", "CHRM", "CHRMT", "M"]
var chroms = dp.chromosomes(fai)
if chrom in chroms: return chrom
if chrom[0] != 'c' and ("chr" & chrom) in chroms:
result = "chr" & chrom
elif chrom[0] == 'c' and chrom.len > 3 and chrom[1] == 'h' and chrom[2] == 'r' and chrom[3..chrom.high] in chroms:
result = chrom[3..chrom.high]
elif chrom.toUpperAscii in MTs: # try all the MT chroms.
for c in MTs:
if c in chroms:
return c
else:
raise newException(KeyError, "chromosome not found:" & chrom)

Expand Down

0 comments on commit 7be61a8

Please sign in to comment.