Skip to content

Commit

Permalink
wip: modify frontend to use new gtex/pext schema
Browse files Browse the repository at this point in the history
  • Loading branch information
rileyhgrant committed Sep 23, 2024
1 parent 0ea1c25 commit 05c7455
Show file tree
Hide file tree
Showing 8 changed files with 593 additions and 423 deletions.
1 change: 1 addition & 0 deletions browser/src/GenePage/GenePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -528,6 +528,7 @@ const GenePage = ({ datasetId, gene, geneId }: Props) => {

{hasCodingExons && gene.chrom !== 'M' && gene.pext && (
<TissueExpressionTrack
datasetId={datasetId}
exons={cdsCompositeExons}
expressionRegions={gene.pext.regions}
flags={gene.pext.flags}
Expand Down
164 changes: 58 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_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
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_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
tissue
value
}
}
flags
Expand Down Expand Up @@ -264,6 +162,60 @@ 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

Expand Down
31 changes: 16 additions & 15 deletions browser/src/GenePage/GeneTranscriptsTrack.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,18 @@ import { Track } from '@gnomad/region-viewer'
import TranscriptsTrack from '@gnomad/track-transcripts'
import { Button, Modal, TooltipAnchor } from '@gnomad/ui'

import { GTEX_TISSUE_NAMES } from '../gtex'
import { GTEX_TISSUES } from '../gtex'
import InfoButton from '../help/InfoButton'
import Link from '../Link'
import sortedTranscripts from './sortedTranscripts'
import TranscriptsTissueExpression from './TranscriptsTissueExpression'
import { Gene } from './GenePage'
import { hasStructuralVariants } from '../../../dataset-metadata/metadata'
import {
DatasetId,
getTopLevelDataset,
hasStructuralVariants,
} from '../../../dataset-metadata/metadata'
import { Transcript } from '../TranscriptPage/TranscriptPage'

const TranscriptsInfoWrapper = styled.div`
display: flex;
Expand All @@ -34,36 +39,35 @@ const RightPanel = styled.div`
padding: 0.375em;
`

type OwnProps = {
datasetId: string
type GeneTranscriptsTrack = {
datasetId: DatasetId
gene: Gene
includeNonCodingTranscripts: boolean
includeUTRs: boolean
preferredTranscriptId?: string
preferredTranscriptDescription?: string | React.ReactNode
}

// @ts-expect-error TS(2456) FIXME: Type alias 'Props' circularly references itself.
type Props = OwnProps & typeof GeneTranscriptsTrack.defaultProps

// @ts-expect-error TS(7022) FIXME: 'GeneTranscriptsTrack' implicitly has type 'any' b... Remove this comment to see the full error message
const GeneTranscriptsTrack = ({
datasetId,
gene,
includeNonCodingTranscripts,
includeUTRs,
preferredTranscriptId,
preferredTranscriptDescription,
}: Props) => {
}: GeneTranscriptsTrack) => {
const transcriptsTrack = useRef(null)

const gtexTissues = GTEX_TISSUES[getTopLevelDataset(datasetId)]

const isTissueExpressionAvailable = gene.reference_genome === 'GRCh37'
const [showTissueExpressionModal, setShowTissueExpressionModal] = useState(false)

const maxMeanExpression = isTissueExpressionAvailable
? max(
gene.transcripts.map((transcript: any) =>
mean(Object.values(transcript.gtex_tissue_expression))
// @ts-ignore
gene.transcripts.map((transcript: Transcript) =>
mean(transcript.gtex_tissue_expression!.map((tissue) => tissue.value))
)
)
: undefined
Expand Down Expand Up @@ -146,10 +150,7 @@ const GeneTranscriptsTrack = ({
// @ts-expect-error TS(2322) FIXME: Type '{ children: Element; tooltip: string; }' is ... Remove this comment to see the full error message
tooltip={`Mean expression across all tissues = ${meanExpression.toFixed(
2
)} TPM\nMost expressed in ${
// @ts-expect-error TS(2538) FIXME: Type 'undefined' cannot be used as an index type.
GTEX_TISSUE_NAMES[tissueMostExpressedIn]
} (${
)} TPM\nMost expressed in ${gtexTissues[tissueMostExpressedIn].fullName} (${
// @ts-expect-error TS(2532) FIXME: Object is possibly 'undefined'.
maxExpression.toFixed(2)
} TPM)`}
Expand Down
Loading

0 comments on commit 05c7455

Please sign in to comment.