Skip to content

Commit

Permalink
Merge pull request #105 from molgenis/fix/103-abbrHgvs
Browse files Browse the repository at this point in the history
Fix #104 Abbreviate HGVS C and HGVS P values in record table
  • Loading branch information
marikaris authored Jan 18, 2021
2 parents c332bce + 3e7a7d0 commit ca791f9
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 24 deletions.
52 changes: 30 additions & 22 deletions src/components/RecordInfoDetailsItemValue.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<Anchor
v-else-if="isEnsemblFeatureId() && (genomeAssembly === 'GRCh37' || genomeAssembly === 'GRCh38')"
:href="
'http://' +
'https://' +
(genomeAssembly === 'GRCh37' ? 'grch37' : 'www') +
'.ensembl.org/Homo_sapiens/Transcript/Summary?db=core;t=' +
encodeURIComponent(value)
Expand All @@ -34,29 +34,25 @@
<span v-else>{{ value }}</span>
</span>
<span v-else-if="metadataId === 'hgvsC' || metadataId === 'HGVSc'">
<span v-if="details">{{ value }}</span>
<span v-else>
<Anchor
v-if="isRefSeqFeatureId()"
:href="'https://www.ncbi.nlm.nih.gov/nuccore/' + encodeURIComponent(value.substring(0, value.indexOf(':')))"
:text="value.substring(value.indexOf(':') + 1)"
/>
<Anchor
v-else-if="isEnsemblFeatureId() && (genomeAssembly === 'GRCh37' || genomeAssembly === 'GRCh38')"
:href="
'http://' +
(genomeAssembly === 'GRCh37' ? 'grch37' : 'www') +
'.ensembl.org/Homo_sapiens/Transcript/Summary?db=core;t=' +
encodeURIComponent(value.substring(0, value.indexOf(':')))
"
:text="value.substring(value.indexOf(':') + 1)"
/>
<span v-else>{{ value.indexOf(':') !== -1 ? value.substring(value.indexOf(':') + 1) : value }}</span>
</span>
<Anchor
v-if="isRefSeqFeatureId()"
:href="'https://www.ncbi.nlm.nih.gov/nuccore/' + encodeURIComponent(value.substring(0, value.indexOf(':')))"
:text="getHgvsText(value)"
/>
<Anchor
v-else-if="isEnsemblFeatureId() && (genomeAssembly === 'GRCh37' || genomeAssembly === 'GRCh38')"
:href="
'https://' +
(genomeAssembly === 'GRCh37' ? 'grch37' : 'www') +
'.ensembl.org/Homo_sapiens/Transcript/Summary?db=core;t=' +
encodeURIComponent(value.substring(0, value.indexOf(':')))
"
:text="getHgvsText(value)"
/>
<span v-else>{{ getHgvsText(value) }}</span>
</span>
<span v-else-if="metadataId === 'hgvsP' || metadataId === 'HGVSp'">
<span v-if="details">{{ value }}</span>
<span v-else>{{ value.indexOf(':') !== -1 ? value.substring(value.indexOf(':') + 1) : value }}</span>
<span>{{ getHgvsText(value) }}</span>
</span>
<span v-else-if="metadataId === 'gnomAD_AF'">
<Anchor
Expand Down Expand Up @@ -147,6 +143,18 @@ export default Vue.extend({
vClasses.push(vClass);
}
return vClasses.join('/');
},
getHgvsText(value: string): string {
let textValue;
if (this.details) {
textValue = value;
} else {
textValue = value.indexOf(':') !== -1 ? value.substring(value.indexOf(':') + 1) : value;
if (textValue.length > 29) {
textValue = textValue.substring(0, 26) + '...';
}
}
return textValue;
}
}
});
Expand Down
4 changes: 2 additions & 2 deletions src/mocks/apiDataMock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -582,8 +582,8 @@ export const apiData: ApiData = {
'protein_coding',
'5/5',
null,
'ENST00000377205.1:c.619C>T',
'ENSP00000366410.1:p.Arg207Trp',
'ENST00000377205.1:c.619C>Tabcdefghijklmnopqrstuvwqyzabcdefghijklmnopqrstuvwqyzabcdefghijklmnopqrstuvwqyz',
'ENSP00000366410.1:p.Arg207Trpabcdefghijklmnopqrstuvwqyzabcdefghijklmnopqrstuvwqyzabcdefghijklmnopqrstuvwqyz',
'763',
'619',
'207',
Expand Down

0 comments on commit ca791f9

Please sign in to comment.