Skip to content

Commit

Permalink
feat(browser): adjust frontend for new gtex/pext schema
Browse files Browse the repository at this point in the history
  • Loading branch information
rileyhgrant committed Oct 16, 2024
1 parent a809ff9 commit 2ef8988
Show file tree
Hide file tree
Showing 10 changed files with 739 additions and 618 deletions.
58 changes: 35 additions & 23 deletions browser/src/GenePage/GenePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {
isExac,
hasCopyNumberVariants,
isV2,
getTopLevelDataset,
} from '@gnomad/dataset-metadata/metadata'
import ConstraintTable from '../ConstraintTable/ConstraintTable'
import VariantCooccurrenceCountsTable, {
Expand Down Expand Up @@ -50,7 +51,7 @@ import MitochondrialGeneCoverageTrack from './MitochondrialGeneCoverageTrack'
import MitochondrialVariantsInGene from './MitochondrialVariantsInGene'
import { getPreferredTranscript } from './preferredTranscript'
import StructuralVariantsInGene from './StructuralVariantsInGene'
import TissueExpressionTrack from './TissueExpressionTrack'
import TissueExpressionTrack, { TranscriptWithTissueExpression } from './TissueExpressionTrack'
import VariantsInGene from './VariantsInGene'

import { GnomadConstraint } from '../ConstraintTable/GnomadConstraintTable'
Expand All @@ -71,6 +72,8 @@ import {
LegendSwatch,
} from '../ChartStyles'
import { logButtonClick } from '../analytics'
import { GtexTissueExpression } from './TranscriptsTissueExpression'
import { GTEX_TISSUES } from '../gtex'

export type Strand = '+' | '-'

Expand All @@ -88,6 +91,30 @@ export type GeneMetadata = {
flags: string[]
}

export type GeneTranscript = {
transcript_id: string
transcript_version: string
exons: {
feature_type: string
start: number
stop: number
}[]
gtex_tissue_expression: GtexTissueExpression | null
}

export type Pext = {
regions: {
start: number
stop: number
mean: number
tissues: {
tissue: string
value: number
}[]
}[]
flags: string[]
}

export type Gene = GeneMetadata & {
reference_genome: ReferenceGenome
name?: string
Expand All @@ -100,29 +127,11 @@ export type Gene = GeneMetadata & {
start: number
stop: number
}[]
transcripts: {
transcript_id: string
transcript_version: string
exons: {
feature_type: string
start: number
stop: number
}[]
}[]
transcripts: GeneTranscript[]
flags: string[]
gnomad_constraint?: GnomadConstraint
exac_constraint?: ExacConstraint
pext?: {
regions: {
start: number
stop: number
mean: number
tissues: {
[key: string]: number
}
}[]
flags: string[]
}
pext?: Pext
short_tandem_repeats?: {
id: string
}[]
Expand Down Expand Up @@ -517,6 +526,8 @@ const GenePage = ({ datasetId, gene, geneId }: Props) => {
<TrackWrapper>
<GeneTranscriptsTrack
datasetId={datasetId}
isTissueExpressionAvailable={!!gene.pext}
gtexTissues={GTEX_TISSUES[getTopLevelDataset(datasetId)]}
gene={gene}
includeNonCodingTranscripts={includeNonCodingTranscripts}
includeUTRs={includeUTRs}
Expand All @@ -528,10 +539,12 @@ const GenePage = ({ datasetId, gene, geneId }: Props) => {

{hasCodingExons && gene.chrom !== 'M' && gene.pext && (
<TissueExpressionTrack
gtexTissues={GTEX_TISSUES[getTopLevelDataset(datasetId)]}
exons={cdsCompositeExons}
expressionRegions={gene.pext.regions}
flags={gene.pext.flags}
transcripts={gene.transcripts}
// if a gene has pext, it also has GTEx
transcripts={gene.transcripts as TranscriptWithTissueExpression[]} // if a gene has pext,
preferredTranscriptId={preferredTranscriptId}
preferredTranscriptDescription={preferredTranscriptDescription}
/>
Expand Down Expand Up @@ -563,7 +576,6 @@ const GenePage = ({ datasetId, gene, geneId }: Props) => {
<VariantsInGene
datasetId={datasetId}
gene={gene}
// @ts-expect-error TS(2322) FIXME: Type '{ datasetId: string; gene: { gene_id: string... Remove this comment to see the full error message
includeNonCodingTranscripts={includeNonCodingTranscripts}
includeUTRs={includeUTRs}
zoomRegion={zoomRegion}
Expand Down
167 changes: 61 additions & 106 deletions browser/src/GenePage/GenePageContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,59 +98,8 @@ query ${operationName}($geneId: String, $geneSymbol: String, $referenceGenome: R
stop
}
gtex_tissue_expression {
adipose_subcutaneous
adipose_visceral_omentum
adrenal_gland
artery_aorta
artery_coronary
artery_tibial
bladder
brain_amygdala
brain_anterior_cingulate_cortex_ba24
brain_caudate_basal_ganglia
brain_cerebellar_hemisphere
brain_cerebellum
brain_cortex
brain_frontal_cortex_ba9
brain_hippocampus
brain_hypothalamus
brain_nucleus_accumbens_basal_ganglia
brain_putamen_basal_ganglia
brain_spinal_cord_cervical_c_1
brain_substantia_nigra
breast_mammary_tissue
cells_ebv_transformed_lymphocytes
cells_transformed_fibroblasts
cervix_ectocervix
cervix_endocervix
colon_sigmoid
colon_transverse
esophagus_gastroesophageal_junction
esophagus_mucosa
esophagus_muscularis
fallopian_tube
heart_atrial_appendage
heart_left_ventricle
kidney_cortex
liver
lung
minor_salivary_gland
muscle_skeletal
nerve_tibial
ovary
pancreas
pituitary
prostate
skin_not_sun_exposed_suprapubic
skin_sun_exposed_lower_leg
small_intestine_terminal_ileum
spleen
stomach
testis
thyroid
uterus
vagina
whole_blood
tissue
value
}
}
pext {
Expand All @@ -159,59 +108,8 @@ query ${operationName}($geneId: String, $geneSymbol: String, $referenceGenome: R
stop
mean
tissues {
adipose_subcutaneous
adipose_visceral_omentum
adrenal_gland
artery_aorta
artery_coronary
artery_tibial
bladder
brain_amygdala
brain_anterior_cingulate_cortex_ba24
brain_caudate_basal_ganglia
brain_cerebellar_hemisphere
brain_cerebellum
brain_cortex
brain_frontal_cortex_ba9
brain_hippocampus
brain_hypothalamus
brain_nucleus_accumbens_basal_ganglia
brain_putamen_basal_ganglia
brain_spinal_cord_cervical_c_1
brain_substantia_nigra
breast_mammary_tissue
cells_ebv_transformed_lymphocytes
cells_transformed_fibroblasts
cervix_ectocervix
cervix_endocervix
colon_sigmoid
colon_transverse
esophagus_gastroesophageal_junction
esophagus_mucosa
esophagus_muscularis
fallopian_tube
heart_atrial_appendage
heart_left_ventricle
kidney_cortex
liver
lung
minor_salivary_gland
muscle_skeletal
nerve_tibial
ovary
pancreas
pituitary
prostate
skin_not_sun_exposed_suprapubic
skin_sun_exposed_lower_leg
small_intestine_terminal_ileum
spleen
stomach
testis
thyroid
uterus
vagina
whole_blood
tissue
value
}
}
flags
Expand Down Expand Up @@ -264,6 +162,63 @@ query ${operationName}($geneId: String, $geneSymbol: String, $referenceGenome: R
}
`

// adipose_subcutaneous
// adipose_visceral_omentum
// adrenal_gland
// artery_aorta
// artery_coronary
// artery_tibial
// bladder
// brain_amygdala
// brain_anterior_cingulate_cortex_ba24
// brain_caudate_basal_ganglia
// brain_cerebellar_hemisphere
// brain_cerebellum
// brain_cortex
// brain_frontal_cortex_ba9
// brain_hippocampus
// brain_hypothalamus
// brain_nucleus_accumbens_basal_ganglia
// brain_putamen_basal_ganglia
// brain_spinal_cord_cervical_c_1
// brain_substantia_nigra
// breast_mammary_tissue
// cells_ebv_transformed_lymphocytes
// cells_cultured_fibroblasts
// cervix_ectocervix
// cervix_endocervix
// colon_sigmoid
// colon_transverse
// esophagus_gastroesophageal_junction
// esophagus_mucosa
// esophagus_muscularis
// fallopian_tube
// heart_atrial_appendage
// heart_left_ventricle
// kidney_cortex
// liver
// lung
// minor_salivary_gland
// muscle_skeletal
// nerve_tibial
// ovary
// pancreas
// pituitary
// prostate
// skin_not_sun_exposed_suprapubic
// skin_sun_exposed_lower_leg
// small_intestine_terminal_ileum
// spleen
// stomach
// testis
// thyroid
// uterus
// vagina
// whole_blood
//
// cells_transformed_fibroblasts
// cells_transformed_fibroblasts

type Props = {
datasetId: DatasetId
geneIdOrSymbol: string
Expand Down
Loading

0 comments on commit 2ef8988

Please sign in to comment.