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

Use shortened VCF feature description for some types of insertions and deletions #3901

Merged
merged 1 commit into from
Sep 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -15009,7 +15009,7 @@ exports[`vcf file import 1`] = `
"QUAL": 1112.65,
"REF": "AAAAAAAAAGAAAAG",
"aliases": undefined,
"description": "deletion AAAAAAAAAGAAAAG -> A",
"description": "14bp DEL",
"end": 41256103,
"name": "rs373413425",
"refName": "17",
Expand Down
34 changes: 22 additions & 12 deletions plugins/variants/src/VcfFeature/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,16 @@ export function getSOTermAndDescription(
)

descriptions = new Set(
[...prefixes].map(prefix => {
const suffixes = descs
.map(desc => {
const pref = desc.split('-> ')
return pref[1] && pref[0] === prefix ? pref[1] : ''
})
.filter(f => !!f)
[...prefixes]
.map(r => r.trim())
.map(prefix => {
const suffixes = descs
.map(desc => desc.split('->').map(r => r.trim()))
.map(pref => (pref[1] && pref[0] === prefix ? pref[1] : ''))
.filter(f => !!f)

return suffixes.length ? prefix + '-> ' + suffixes.join(',') : prefix
}),
return suffixes.length ? `${prefix} -> ${suffixes.join(',')}` : prefix
}),
)
}
if (soTerms.size) {
Expand Down Expand Up @@ -115,7 +115,7 @@ export function getSOAndDescByExamination(ref: string, alt: string) {
} else if (alt === '<DEL>') {
return ['deletion', alt]
} else if (alt === '<INV>') {
return ['deletion', alt]
return ['inversion', alt]
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this was also incorrectly saying type features were deletions, which would show up on feature.get('type'). subtle but needing a fix :)

} else if (alt === '<TRA>') {
return ['translocation', alt]
} else if (alt.includes('<')) {
Expand All @@ -125,9 +125,19 @@ export function getSOAndDescByExamination(ref: string, alt: string) {
? ['inversion', makeDescriptionString('inversion', ref, alt)]
: ['substitution', makeDescriptionString('substitution', ref, alt)]
} else if (ref.length <= alt.length) {
return ['insertion', makeDescriptionString('insertion', ref, alt)]
const len = alt.length - ref.length
const lena = len.toLocaleString('en-US')
return [
'insertion',
len > 5 ? lena + 'bp INS' : makeDescriptionString('insertion', ref, alt),
]
} else if (ref.length > alt.length) {
return ['deletion', makeDescriptionString('deletion', ref, alt)]
const len = ref.length - alt.length
const lena = len.toLocaleString('en-US')
return [
'deletion',
len > 5 ? lena + 'bp DEL' : makeDescriptionString('deletion', ref, alt),
]
}

return ['indel', makeDescriptionString('indel', ref, alt)]
Expand Down