Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
rahelp committed Oct 25, 2023
2 parents a2406e7 + 93f2ec5 commit 5d573b7
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 104 deletions.
8 changes: 3 additions & 5 deletions src/components/SVGloaders.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export default function SVGloader({ apiReply }) {
)
}

export function SubsetHistogram({ id, filter, datasetIds, plotRegionLabels, plotGeneSymbols, plotCytoregionLabels, title, description, size: givenSize }) {
export function SubsetHistogram({ id, datasetIds, plotRegionLabels, plotGeneSymbols, plotCytoregionLabels, title, description, size: givenSize }) {
const componentRef = useRef()
const { width } = useContainerDimensions(componentRef)
const size = givenSize || width
Expand All @@ -35,7 +35,6 @@ export function SubsetHistogram({ id, filter, datasetIds, plotRegionLabels, plot
apiReply={useSubsethistogram({
datasetIds,
id,
filter,
plotRegionLabels,
plotGeneSymbols,
plotCytoregionLabels,
Expand Down Expand Up @@ -74,7 +73,7 @@ export function SubsetHistogram({ id, filter, datasetIds, plotRegionLabels, plot
export function BiosamplePlot({ biosid, datasetIds, plotRegionLabels, plotChros}) {
const componentRef = useRef()
const { width } = useContainerDimensions(componentRef)
const url = `${SITE_DEFAULTS.API_PATH}beacon/biosamples/${biosid}/?datasetIds=${datasetIds}&output=samplesplot&plot_width=${width}&plotRegionLabels=${plotRegionLabels}&plotChros=${plotChros}&forceEmptyPlot=true`
const url = `${SITE_DEFAULTS.API_PATH}services/sampleplots/${biosid}?plotType=samplesplot&datasetIds=${datasetIds}&plot_width=${width}&plotRegionLabels=${plotRegionLabels}&plotChros=${plotChros}&forceEmptyPlot=true`
// width > 0 to make sure the component is mounted and avoid double fetch
const dataEffect = useExtendedSWR(width > 0 && url, svgFetcher)
return (
Expand All @@ -87,7 +86,7 @@ export function BiosamplePlot({ biosid, datasetIds, plotRegionLabels, plotChros}
export function CallsetHistogram({ csid, datasetIds }) {
const componentRef = useRef()
const { width } = useContainerDimensions(componentRef)
const url = `${SITE_DEFAULTS.API_PATH}beacon/biosamples/?analysisIds=${csid}&datasetIds=${datasetIds}&output=samplesplot&plot_width=${width}`
const url = `${SITE_DEFAULTS.API_PATH}services/sampleplots/?analysisIds=${csid}&datasetIds=${datasetIds}&plot_width=${width}`
// width > 0 to make sure the component is mounted and avoid double fetch
const dataEffect = useExtendedSWR(width > 0 && url, svgFetcher)
return (
Expand All @@ -99,6 +98,5 @@ export function CallsetHistogram({ csid, datasetIds }) {

SubsetHistogram.propTypes = {
id: PropTypes.string.isRequired,
filter: PropTypes.string,
background: PropTypes.bool
}
31 changes: 5 additions & 26 deletions src/hooks/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -273,20 +273,6 @@ export function useProgenetixRefPublicationList({ geoCity, geodistanceKm }) {
return useProgenetixApi(url)
}

export const ontologymapsBaseUrl = `${SITE_DEFAULTS.API_PATH}services/ontologymaps?`

export function ontologymapsUrl({ filters, filterPrecision }) {
let params = new URLSearchParams({ filters: filters })
if (filterPrecision) {
params.append("filterPrecision", filterPrecision)
}
return `${ontologymapsBaseUrl}${params.toString()}`
}

export function ontologymapsPrefUrl({ prefixes, filters }) {
return `${ontologymapsBaseUrl}filters=${prefixes},${filters}&filterPrecision=start`
}

export function useDataItemDelivery(id, entity, datasetIds) {
return useProgenetixApi(getDataItemUrl(id, entity, datasetIds))
}
Expand All @@ -303,17 +289,11 @@ export function getServiceItemUrl(id, collection, datasetIds) {
return `${SITE_DEFAULTS.API_PATH}services/${collection}?id=${id}&datasetIds=${datasetIds}`
}

export function getDataItemPageUrl(id, entity, datasetIds) {
return `${SITE_DEFAULTS.API_PATH}${entity}/?datasetIds=${datasetIds}&id=${id}`
}

export function NoResultsHelp(id, entity) {
const url = getDataItemPageUrl(id, entity, SITE_DEFAULTS.DATASETID)
return (
<div className="notification is-size-5">
This page will only show content if called with a specific biosample ID
which already exists in Progenetix {" "}
<strong>{entity}</strong> database, e.g. <a href={url}>{url}</a>.
This page will only show content if called with an existing {entity} ID;{" "}
is not valid.
</div>
)
}
Expand All @@ -326,15 +306,14 @@ export function useCytomapper(querytext) {
return useProgenetixApi(url)
}

export function useSubsethistogram({ datasetIds, id, filter, plotRegionLabels, plotGeneSymbols, plotCytoregionLabels, size, chr2plot }) {
export function useSubsethistogram({ datasetIds, id, plotRegionLabels, plotGeneSymbols, plotCytoregionLabels, size, plotChros }) {
const svgbaseurl = subsetHistoBaseLink(id, datasetIds)
const params = []
filter && params.push(["filter", filter])
plotRegionLabels && params.push(["plotRegionLabels", plotRegionLabels])
plotGeneSymbols && params.push(["plotGeneSymbols", plotGeneSymbols])
plotCytoregionLabels && params.push(["plotCytoregionLabels", plotCytoregionLabels])
size && params.push(["plotWidth", size])
chr2plot && params.push(["chr2plot", chr2plot])
plotChros && params.push(["plotChros", plotChros])
const searchQuery = new URLSearchParams(params).toString()
return useExtendedSWR(size > 0 && `${svgbaseurl}&${searchQuery}`, svgFetcher)
}
Expand Down Expand Up @@ -390,7 +369,7 @@ export function useGeneSymbol({ geneId }) {
}

export function subsetHistoBaseLink(id, datasetIds) {
return `${SITE_DEFAULTS.API_PATH}services/intervalFrequencies/?datasetIds=${datasetIds}&id=${id}&output=histoplot`
return `${SITE_DEFAULTS.API_PATH}services/collationplots/?datasetIds=${datasetIds}&id=${id}`
}

// the targets are resolved by `bycon` (bycon/services/ids.py)
Expand Down
72 changes: 0 additions & 72 deletions src/modules/details-pages/variantPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,78 +14,6 @@ import React from "react"
const entity = "variants"
const exampleId = "5bab576a727983b2e00b8d32"

// import '@fontsource/roboto'
// import {
// createViewState,
// JBrowseLinearGenomeView,
// } from '@jbrowse/react-linear-genome-view'
//
// const defaultSession = {
// name: 'My session',
// view: {
// id: 'linearGenomeView',
// type: 'LinearGenomeView',
// tracks: [
// {
// type: 'ReferenceSequenceTrack',
// configuration: 'GRCh38-ReferenceSequenceTrack',
// displays: [
// {
// type: 'LinearReferenceSequenceDisplay',
// configuration:
// 'GRCh38-ReferenceSequenceTrack-LinearReferenceSequenceDisplay',
// },
// ],
// },
// ],
// },
// }
//
// const assembly = {
// name: 'GRCh38',
// sequence: {
// type: 'ReferenceSequenceTrack',
// trackId: 'GRCh38-ReferenceSequenceTrack',
// adapter: {
// type: 'BgzipFastaAdapter',
// fastaLocation: {
// uri: 'https://s3.amazonaws.com/jbrowse.org/genomes/GRCh38/fasta/GRCh38.fa.gz',
// locationType: 'UriLocation',
// },
// faiLocation: {
// uri: 'https://s3.amazonaws.com/jbrowse.org/genomes/GRCh38/fasta/GRCh38.fa.gz.fai',
// locationType: 'UriLocation',
// },
// gziLocation: {
// uri: 'https://s3.amazonaws.com/jbrowse.org/genomes/GRCh38/fasta/GRCh38.fa.gz.gzi',
// locationType: 'UriLocation',
// },
// },
// },
// aliases: ['hg38'],
// refNameAliases: {
// adapter: {
// type: 'RefNameAliasAdapter',
// location: {
// uri: 'https://s3.amazonaws.com/jbrowse.org/genomes/GRCh38/hg38_aliases.txt',
// locationType: 'UriLocation',
// },
// },
// },
// }
// function View() {
// const state = createViewState({
// assembly,
// // tracks,
// location: '10:29,838,737..29,838,819',
// // location: '1:11,127,738-11,127,739',
// defaultSession,
// })
//
// return <JBrowseLinearGenomeView viewState={state} />;
// }


const VariantDetailsPage = withUrlQuery(({ urlQuery }) => {
var { id } = urlQuery
var datasetIds = SITE_DEFAULTS.DATASETID
Expand Down
2 changes: 1 addition & 1 deletion src/modules/service-pages/dataVisualizationPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ function DataVisualizationForm({ isQuerying, sampleCount, onSubmit }) {
<div className="columns">
<div className="column">
<InputField
name="chr2plot"
name="plotChros"
label="Chromosomes"
infoText="The chromosomes to be included in the plot, in the order they should appear. The values should just be the comma-separated chromosome numbers (e.g. '1,3,19,X' - unquoted, no spaces). The default is chr 1-22."
errors={errors}
Expand Down

0 comments on commit 5d573b7

Please sign in to comment.