Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

hide leading 1 for offset PositionalVariants #17

Open
mathieulemieux opened this issue Sep 1, 2022 · 2 comments
Open

hide leading 1 for offset PositionalVariants #17

mathieulemieux opened this issue Sep 1, 2022 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@mathieulemieux
Copy link
Member

From JIRA https://www.bcgsc.ca/jira/browse/KBDEV-990

Problem:
PositionalVariant with a negative offset from the 1st position should hide the position '1' in their displayName as per HGVS standards (https://varnomen.hgvs.org/bg-material/numbering/), which is not the case at the moment.

Ex.:
"CEP72:c.1-2384C>T" should read "CEP72:c.-2384C>T"

Context:
When a PositionalVariant is added to GraphKB (let say through the web client interface, which uses the '/positionalvariants' POST route), the payload doesn't contain a displayName, neither a break1Repr nor a break2Repr. The parser is then used to format these fields.

@mathieulemieux mathieulemieux added the enhancement New feature or request label Sep 1, 2022
@mathieulemieux mathieulemieux self-assigned this Sep 1, 2022
@mathieulemieux
Copy link
Member Author

@creisle & @elewis2 ,

Following the issue's description, when a POST request is sent to the GraphKB Api on the '/positionalvariants' route, the create() function is called (pori_graphkb_api/src/repo/commands/create.js), which will eventually lead to the GraphKB Parser :

1- the convertPositionToString() function will provide values for the break1Repr and break2Repr properties:

const convertPositionToString = (position) => {
if (position.prefix === 'y') {
let result = `${position.arm}`;
if (position.majorBand !== undefined) {
result = `${result}${position.majorBand || '?'}`;
if (position.minorBand !== undefined) {
result = `${result}.${position.minorBand || '?'}`;
}
}
return result;
} if (['c', 'r', 'n'].includes(position.prefix)) {
let offset = '';
if (position.offset === null) {
offset = '?';
} else if (position.offset) {
if (position.offset > 0) {
offset = '+';
}
offset = `${offset}${position.offset}`;
}
return `${position.pos || '?'}${offset}`;
} if (position.prefix === 'p') {
return `${position.refAA || '?'}${position.pos || '?'}`;
}
return `${position.pos || '?'}`;
};

2- based in part on those properties, the stringifyVariant() function will provide the displayName's value:
const stringifyVariant = (variant: VariantNotation): string => {
const {
multiFeature,
noFeatures,
reference1,
reference2,
break1Repr,
break2Repr,
untemplatedSeq,
untemplatedSeqSize,
truncation,
refSeq,
type,
} = variant;
let { notationType } = variant;
if (notationType === undefined) {
const variantType = ontologyTermRepr(type);
notationType = TYPES_TO_NOTATION[variantType] || variantType.replace(/\s+/, '-');
}
const isMultiRef = multiFeature || (reference2 && (reference1 !== reference2));
if (isMultiRef) {
if (!break2Repr) {
throw new InputValidationError('Multi-feature notation requires break2Repr');
}
// multi-feature notation
let result = noFeatures
? ''
: `(${reference1},${reference2}):`;
result = `${result}${notationType}(${stripParentheses(break1Repr)},${stripParentheses(break2Repr)})`;
if (untemplatedSeq !== undefined) {
result = `${result}${untemplatedSeq}`;
} else if (untemplatedSeqSize !== undefined) {
result = `${result}${untemplatedSeqSize}`;
}
return result;
}
// continuous notation
const result: string[] = [];
if (!noFeatures && !noFeatures) {
result.push(`${reference1}:`);
}
result.push(break1Repr);
if (break2Repr) {
result.push(`_${break2Repr.slice(2)}`);
}
if (
['ext', 'fs'].includes(notationType)
|| (notationType === '>' && break1Repr.startsWith('p.'))
) {
if (untemplatedSeq) {
result.push(untemplatedSeq);
}
}
if (notationType === 'mis' && untemplatedSeq && break1Repr.startsWith('p.')) {
result.push(untemplatedSeq);
} else if (notationType !== '>') {
if (notationType === 'delins') {
result.push(`del${refSeq || ''}ins`);
} else {
result.push(notationType);
}
if (truncation && truncation !== 1) {
if (truncation < 0) {
result.push(`${truncation}`);
} else {
result.push(`*${truncation}`);
}
}
if (refSeq && ['dup', 'del', 'inv'].includes(notationType)) {
result.push(refSeq);
}
if ((untemplatedSeq || untemplatedSeqSize) && ['ins', 'delins'].includes(notationType)) {
result.push(`${untemplatedSeq || untemplatedSeqSize}`);
}
} else if (!break1Repr.startsWith('p.')) {
result.push(`${refSeq || '?'}${notationType}${untemplatedSeq || '?'}`);
}
return result.join('');
};

Question:
Should we modify the break1Repr/break2Repr so the leading '1' is hidden, or would it be wiser to let these properties as is, and only change the displayName?

@mathieulemieux
Copy link
Member Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant