From 4deb10e35fa92c93076acd0a020e1a50f44efa95 Mon Sep 17 00:00:00 2001 From: hpratt Date: Mon, 15 Nov 2021 13:07:00 -0500 Subject: [PATCH] add allele-specific ENTEx data, ENTEx browser fix --- .../apps/search/components/DefaultTracks.js | 2 +- website/ui/src/apps/search/config/details.js | 99 +++++++++++++++---- website/ui/src/apps/search/config/entex.js | 2 +- 3 files changed, 84 insertions(+), 19 deletions(-) diff --git a/website/ui/src/apps/search/components/DefaultTracks.js b/website/ui/src/apps/search/components/DefaultTracks.js index 2d1bad9a0..93aaf1060 100644 --- a/website/ui/src/apps/search/components/DefaultTracks.js +++ b/website/ui/src/apps/search/components/DefaultTracks.js @@ -204,7 +204,7 @@ export const ENTEXTracks = props => { onMouseOver={x => props.oncCREMousedOver && x.name && props.oncCREMousedOver(cCRECoordinateMap.get(x.name))} onMouseOut={props.oncCREMousedOut} /> - { data.bigRequests.map( (t, i) => ( + { data.bigRequests.slice(1).map( (t, i) => ( x.donor +}, { + header: "tissue", + value: x => x.tissue +}, { + header: "assay", + value: x => x.assay +}, { + header: "count, haplotype 1", + value: x => x.hap1_count +}, { + header: "count, haplotype 2", + value: x => x.hap2_count +}, { + header: "p-value", + value: x => x.p < 0.001 ? x.p.toExponential(3) : x.p.toFixed(3) +}]; + const ENTEX_COLUMNS = [{ header: "tissue", value: x => x.tissue, @@ -548,6 +570,10 @@ const EBrowser = props => { onDomainChanged={x => setECoordinates({ chromosome: props.coordinates.chromosome, ...x })} onHeightChanged={x => setTranscriptHeight(x - 30)} > + + {props.active_cre.accession} + + { highlight && ( )} @@ -588,8 +614,6 @@ const EBrowser = props => { oncCREMousedOut={() => setHighlight(null)} actions={props.actions} /> - {props.active_cre.accession} - ); @@ -608,28 +632,69 @@ function ggfirst(data) { const ENTEXView = props => { const client = useMemo( () => new ApolloClient({ uri: "https://ga.staging.wenglab.org/graphql", cache: new InMemoryCache() }), [] ); const [ page, setPage ] = useState(1); - const { data, loading } = useQuery(ENTEX_QUERY, { variables: { accession: props.active_cre.accession }, client }); - const tissues = useMemo( () => data && [ ...new Set(data.cCREQuery[0].gtex_decorations.map(x => x.tissue)) ].slice(0, 10), [ data ] ); + const { data, loading } = useQuery(ENTEX_QUERY, { variables: { accession: props.active_cre.accession, chr: props.active_cre.chrom, start: props.active_cre.start, end: props.active_cre.start + props.active_cre.len }, client }); + const tissues = useMemo( () => data && [ ...new Set(data.cCREQuery[0].gtex_decorations.map(x => x.tissue)) ], [ data ] ); const rtissues = useMemo( () => tissues && tissues.length !== 0 ? tissues : [ "spleen", "thyroid", "sigmoid colon" ]); const gfirst = useMemo( () => tissues && [ "H3K4me3", "H3K4me1", "H3K27ac", "H3K27me3" ].flatMap( m => rtissues.map( t => { const k = Object.keys(ENTEX).filter(x => ENTEX[x] && ENTEX[x].biosample && ENTEX[x].target === m && ENTEX[x].biosample.startsWith(t.replace(/_/g, " "))); return k.length === 0 ? undefined : ENTEX[k]; })).filter(x => !!x), [ rtissues ]); const eCoordinates = useMemo( () => props.active_cre && ({ chromosome: props.active_cre.chrom, start: props.active_cre.start, end: props.active_cre.start + props.active_cre.len }), [ props ]); + const formattedAS = useMemo( () => data && data.bigRequests[0].data.map(x => ({ + hap1_count: +x.name.split('$')[1], + hap2_count: +x.name.split('$')[2], + hap1_allele_ratio: +x.name.split('$')[3], + experiment: x.name.split('$')[4], + donor: x.name.split('$')[5], + tissue: x.name.split('$')[6].replace(/_/g, " "), + assay: x.name.split('$')[7].replace(/_/g, " "), + p: +x.name.split('$')[8].replace(/_/g, " "), + significant: x.name.split('$')[9] === '1' + })), [ data ]); return loading ? Loading... : ( <> - setPage(1)} style={{ fontSize: "1.2em" }}>Table View + setPage(1)} style={{ fontSize: "1.2em" }}>States by Tissue + setPage(2)} style={{ fontSize: "1.2em" }}>Allele-Specific Activity setPage(0)} style={{ fontSize: "1.2em" }}>Browser View { page === 1 ? ( - + <> +
EN-TEx State Decorations
+ + + ) : page === 2 ? ( + <> +
Significant Allele-Specific Events
+ x.significant)} + searchable + sortColumn={5} + itemsPerPage={8} + sortDescending + emptyText="no significant allele-specific events detected at this cCRE" + /> +
Non-Significant Allele-Specific Events
+ !x.significant)} + searchable + itemsPerPage={8} + sortColumn={5} + sortDescending + emptyText="no non-significant allele-specific events detected at this cCRE" + /> + ) : (