Unverified Commit e341f858 authored by Jyothish's avatar Jyothish Committed by GitHub
Browse files

Update Product type and fix External references tab (#581)

parent 8f02955f
Pipeline #193125 passed with stages
in 4 minutes and 32 seconds
...@@ -148,7 +148,7 @@ describe('<TranscriptsListItemInfo /', () => { ...@@ -148,7 +148,7 @@ describe('<TranscriptsListItemInfo /', () => {
it('calls correct callback when protein link is clicked', () => { it('calls correct callback when protein link is clicked', () => {
const { container } = renderComponent(); const { container } = renderComponent();
const proteinId = const proteinId =
defaultProps.transcript.product_generating_contexts[0].product.stable_id; defaultProps.transcript.product_generating_contexts[0].product?.stable_id;
const proteinLink = [...container.querySelectorAll('a')].find( const proteinLink = [...container.querySelectorAll('a')].find(
(link) => link.textContent === proteinId (link) => link.textContent === proteinId
) as HTMLElement; ) as HTMLElement;
......
...@@ -67,11 +67,7 @@ type Transcript = Pick< ...@@ -67,11 +67,7 @@ type Transcript = Pick<
} & { } & {
product_generating_contexts: Array< product_generating_contexts: Array<
Pick<FullProductGeneratingContext, 'product_type'> & Pick<FullProductGeneratingContext, 'product_type'> &
Pick2< Pick<FullProductGeneratingContext, 'product'> & {
FullProductGeneratingContext,
'product',
'length' | 'stable_id'
> & {
phased_exons: Array< phased_exons: Array<
Pick<PhasedExon, 'start_phase' | 'end_phase'> & Pick<PhasedExon, 'start_phase' | 'end_phase'> &
Pick2<PhasedExon, 'exon', 'stable_id'> Pick2<PhasedExon, 'exon', 'stable_id'>
...@@ -192,6 +188,7 @@ export const TranscriptsListItemInfo = ( ...@@ -192,6 +188,7 @@ export const TranscriptsListItemInfo = (
); );
}; };
const product = transcript.product_generating_contexts[0].product;
return ( return (
<div className={mainStyles}> <div className={mainStyles}>
<div className={transcriptsListStyles.left}></div> <div className={transcriptsListStyles.left}></div>
...@@ -208,9 +205,7 @@ export const TranscriptsListItemInfo = ( ...@@ -208,9 +205,7 @@ export const TranscriptsListItemInfo = (
<div> <div>
<strong>{aminoAcidLength} aa</strong> <strong>{aminoAcidLength} aa</strong>
</div> </div>
{getLinkToProteinView( {product && getLinkToProteinView(product?.stable_id)}
transcript.product_generating_contexts[0]?.product.stable_id
)}
</> </>
)} )}
</div> </div>
......
...@@ -108,7 +108,7 @@ type Transcript = { ...@@ -108,7 +108,7 @@ type Transcript = {
slice: Pick2<Slice, 'location', 'length'>; slice: Pick2<Slice, 'location', 'length'>;
product_generating_contexts: Array< product_generating_contexts: Array<
Pick<FullProductGeneratingContext, 'product_type'> & { Pick<FullProductGeneratingContext, 'product_type'> & {
product: { external_references: ExternalReferenceType[] }; product: { external_references: ExternalReferenceType[] } | null;
} }
>; >;
external_references: ExternalReferenceType[]; external_references: ExternalReferenceType[];
...@@ -223,9 +223,10 @@ const TranscriptXrefs = (props: { transcript: Transcript }) => { ...@@ -223,9 +223,10 @@ const TranscriptXrefs = (props: { transcript: Transcript }) => {
// Add protein level xrefs // Add protein level xrefs
transcript.product_generating_contexts.forEach( transcript.product_generating_contexts.forEach(
(product_generating_context) => { (product_generating_context) => {
unsortedXrefs.push( product_generating_context.product &&
...product_generating_context.product.external_references unsortedXrefs.push(
); ...product_generating_context.product.external_references
);
} }
); );
......
...@@ -119,7 +119,7 @@ export type GetProductAminoAcidLengthParam = { ...@@ -119,7 +119,7 @@ export type GetProductAminoAcidLengthParam = {
product_type: ProductType.PROTEIN; product_type: ProductType.PROTEIN;
product: { product: {
length: number; length: number;
}; } | null;
}>; }>;
}; };
......
...@@ -28,7 +28,7 @@ export type FullProductGeneratingContext = { ...@@ -28,7 +28,7 @@ export type FullProductGeneratingContext = {
cds: FullCDS | null; cds: FullCDS | null;
five_prime_utr: UTR | null; five_prime_utr: UTR | null;
three_prime_utr: UTR | null; three_prime_utr: UTR | null;
product: Product; product: Product | null;
phased_exons: PhasedExon[]; phased_exons: PhasedExon[];
cdna: CDNA; cdna: CDNA;
}; };
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment