Skip to content

Commit

Permalink
Merge pull request #193 from VariantEffect/jstone-uw/heatmap-ter
Browse files Browse the repository at this point in the history
Allow Ter in the heatmap.
  • Loading branch information
jstone-dev authored May 15, 2024
2 parents c1475ca + 3460d1e commit 6b9848e
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
12 changes: 9 additions & 3 deletions src/components/ScoreSetHeatmap.vue
Original file line number Diff line number Diff line change
Expand Up @@ -165,23 +165,29 @@ export default {
prepareSimpleVariantInstances: function(scores) {
let numComplexVariantInstances = 0
// Count of variants that do not appear to be complex but are don't have a valid substitution
let numIgnoredVariantInstances = 0
const simpleVariantInstances = _.filter(
scores.map((score) => {
const variant = parseSimpleProVariant(score.hgvs_pro)
if (!variant) {
numComplexVariantInstances++
return null
}
if (variant.substitution == 'Ter') {
const row = heatmapRowForVariant(variant.substitution)
if (row == null) {
numIgnoredVariantInstances++
return null
}
const x = variant.position
const y = HEATMAP_ROWS.length - 1 - heatmapRowForVariant(variant.substitution)
const y = HEATMAP_ROWS.length - 1 - row
return {x, y, score: score.score, details: _.omit(score, 'score')}
}),
(x) => x != null
)
return {simpleVariantInstances, numComplexVariantInstances}
return {simpleVariantInstances, numComplexVariantInstances, numIgnoredVariantInstances}
},
prepareSimpleVariants: function(scores) {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/heatmap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {AMINO_ACIDS, AMINO_ACIDS_BY_HYDROPHILIA} from './amino-acids.js'
/** Codes used in the right part of a MaveHGVS-pro string representing a single variation in a protein sequence. */
const MAVE_HGVS_PRO_CHANGE_CODES = [
{codes: {single: '='}}, // Synonymous AA variant
{codes: {single: '*'}}, // Stop codon
{codes: {single: '*', triple: 'TER'}}, // Stop codon
{codes: {single: '-', triple: 'DEL'}} // Deletion
]

Expand Down
9 changes: 7 additions & 2 deletions src/lib/mave-hgvs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,13 @@ interface SimpleProteinVariation {
substitution: string
}

/** Regular expression for parsing simple MaveHGVS-pro expressions. */
const proVariantRegex = /^p\.([A-Za-z]{3})([0-9]+)([A-Za-z]{3}|=)$/
/**
* Regular expression for parsing simple MaveHGVS-pro expressions.
*
* MaveHGVS doesn't allow single-character codes in substitutions, but for flexibility we allow * and - here. These are
* properly represented as Ter and del in MaveHGVS.
*/
const proVariantRegex = /^p\.([A-Za-z]{3})([0-9]+)([A-Za-z]{3}|=|\*|-)$/

/**
* Parse a MaveHGVS protein variant representing a variation at one locus.
Expand Down

0 comments on commit 6b9848e

Please sign in to comment.