Skip to content

Commit

Permalink
removed hasPlots logic not needed
Browse files Browse the repository at this point in the history
  • Loading branch information
airenzp authored and xzhou82 committed Jun 13, 2024
1 parent 3811221 commit 56718d5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 16 deletions.
12 changes: 4 additions & 8 deletions client/plots/sampleView.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,9 @@ class SampleView {
this.app.dispatch({ type: 'plot_edit', id: this.id, config: { samples } })
} else {
this.dom.tableDiv.style('display', 'none')
if (this.state.hasPlots) {
for (const div of this.discoPlots) div.style('display', 'none')
for (const div of this.singleSamplePlots) div.style('display', 'none')
for (const div of this.brainPlots) div.style('display', 'none')
}
for (const div of this.discoPlots) div.style('display', 'none')
for (const div of this.singleSamplePlots) div.style('display', 'none')
for (const div of this.brainPlots) div.style('display', 'none')
}
}
const sampleName = searchSampleInput(this.dom.sampleDiv, this.samplesData, callback)
Expand Down Expand Up @@ -147,7 +145,6 @@ class SampleView {

if (config.samples?.length > 15) samples = config.samples.filter((s, i) => i < 15)
const q = appState.termdbConfig.queries
const hasPlots = Object.keys(q).length > 0

const state = {
config,
Expand All @@ -163,7 +160,6 @@ class SampleView {
NIdata: q?.NIdata,
hasVerifiedToken: this.app.vocabApi.hasVerifiedToken(),
tokenVerificationPayload: this.app.vocabApi.tokenVerificationPayload,
hasPlots,
termdbConfig: appState.termdbConfig,
vocab: appState.vocab
}
Expand All @@ -184,7 +180,7 @@ class SampleView {
this.config = structuredClone(this.state.config)
this.settings = this.state.config.settings.sampleView
await this.renderPlots(this.state, this.state.samples)
if (this.state.hasPlots) this.showVisiblePlots()
this.showVisiblePlots()

this.termsById = this.getTermsById(this.state)
this.sampleDataByTermId = {}
Expand Down
13 changes: 5 additions & 8 deletions server/routes/termdb.getSampleImages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,11 @@ function init({ genomes }) {
}

export function validate_query_getSampleImages(ds: any, genome: any) {
if (ds.queries.images) {
const q = ds.queries.images
if (!q) return
//if (q.src == 'gdcapi') gdcValidateQuery(ds, genome, q.sampleId)
//reading images locally is the only option supported
nativeValidateQuery(ds)
}
const q = ds.queries.images
if (!q) return
//if (q.src == 'gdcapi') gdcValidateQuery(ds, genome, q.sampleId)
//reading images locally is the only option supported so far
nativeValidateQuery(ds)
}

function nativeValidateQuery(ds: any) {
Expand All @@ -58,7 +56,6 @@ function nativeValidateQuery(ds: any) {
}

async function getSampleImages(ds: any, folder: string, sampleId: number) {
console.log('getSampleImages', folder, sampleId)
const sql = `SELECT * FROM images WHERE sample = ${sampleId}`
const rows = ds.cohort.db.connection.prepare(sql).all()
const images: Image[] = []
Expand Down

0 comments on commit 56718d5

Please sign in to comment.