Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Fixed: Allow Heatmap to Display Variants Reported w/ Respect to a Protein Accession #236

Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/lib/mave-hgvs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ interface SimpleProteinVariation {
* change of another sort.
*/
substitution: string
/** The genomic target (accession) from a fully qualified MaveHGVS-pro string. */
target: null | string
}

/**
Expand All @@ -30,15 +32,19 @@ const proVariantRegex = /^p\.([A-Za-z]{3})([0-9]+)([A-Za-z]{3}|=|\*|-)$/
* @returns An object with properties indicating
*/
export function parseSimpleProVariant(variant: string): SimpleProteinVariation | null {
const match = variant.match(proVariantRegex)
const parts = variant.split(":")
const variation = parts.length == 1 ? parts[0] : parts[1]
const target = parts.length == 1 ? null : parts[0]
const match = variation.match(proVariantRegex)
if (!match) {
// console.log(`WARNING: Unrecognized pro variant: ${variant}`)
return null
}
return {
position: parseInt(match[2]),
original: match[1],
substitution: match[3]
substitution: match[3],
target: target
}
}

Expand Down