Skip to content

Commit

Permalink
Isophorm and clan fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
apolignano committed Nov 4, 2024
1 parent 6dc1125 commit 1bdb833
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 9 deletions.
70 changes: 63 additions & 7 deletions src/components/Protein/Isoforms/Viewer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,18 +70,45 @@ const features2protvista = (features: FeatureMap) => {
];

const sortedCategories = categories.sort(byEntryType);

const representativeDomains = selectRepresentativeData(
featArray,
'locations',
'domain'
'domain',
);

if (representativeDomains?.length) {
sortedCategories.splice(0, 0, [
'representative domains',
representativeDomains,
]);
}
const representativeFamilies = selectRepresentativeData(
featArray,
'locations',
'family',
);

const homologous_superfamily = sortedCategories.filter(
(entry) => entry[0] == 'homologous superfamily',
)[0];

sortedCategories.map((entry) => {
if (entry[0] === 'domain') {
entry[0] = 'domains';
if (homologous_superfamily) {
if (Array.isArray(entry[1]))
entry[1] = entry[1].concat(homologous_superfamily[1]);
}

if (representativeDomains) {
if (Array.isArray(entry[1]))
entry[1] = entry[1].concat(representativeDomains);
}
}

if (entry[0] === 'family') {
entry[0] = 'families';
if (representativeFamilies) {
if (Array.isArray(entry[1]))
entry[1] = entry[1].concat(representativeFamilies);
}
}
});

return sortedCategories;
};
Expand Down Expand Up @@ -114,10 +141,39 @@ const Viewer = ({ isoform, data }: LoadedProps) => {

const { accession, length, sequence, features } = data.payload;
const dataProtvista = features2protvista(features);

const mainTracks = [
'alphafold confidence',
'families',
'domains',
'pathogenic and likely pathogenic variants',
'intrinsically disordered regions',
'spurious proteins',
'conserved residues',
];

const hideCategories = {
'secondary structure': false,
families: true,
domains: true,
repeat: false,
'conserved site': false,
'active site': false,
'binding site': false,
ptm: false,
'match conservation': false,
'coiled-coils, signal peptides, transmembrane regions': false,
'short linear motifs': false,
'pfam-n': false,
funfam: false,
};

return (
<div className={css('isoform-panel')}>
<IsoformHeader accession={accession} length={length} />
<ProteinViewer
mainTracks={mainTracks}
hideCategories={hideCategories}
protein={{ sequence, length: sequence.length }}
data={dataProtvista}
title="Entry matches to this isoform"
Expand Down
3 changes: 2 additions & 1 deletion src/components/ProteinViewer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,8 @@ export const ProteinViewer = ({
>
{children}
</Options>
{!protein.accession.startsWith('iprscan') &&
{protein.accession &&
!protein.accession.startsWith('iprscan') &&
mainTracks.length !== Object.entries(hideCategories).length && (
<ShowMoreTracks
showMore={showMore}
Expand Down
2 changes: 1 addition & 1 deletion src/utils/text/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ export const getTextForLabel = (

let text = textList.join(' - ');

if (!entry.accession.startsWith('IPR')) {
if (!entry.accession.startsWith('IPR') && entry.source_database) {
text = entry.source_database.toUpperCase() + ': ' + text;
}

Expand Down

0 comments on commit 1bdb833

Please sign in to comment.