Skip to content

Commit

Permalink
Small change in types
Browse files Browse the repository at this point in the history
  • Loading branch information
robinpaul85 committed Jan 6, 2025
1 parent 2ff37da commit 034291c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
16 changes: 8 additions & 8 deletions server/routes/termdb.DE.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//import fs from 'fs'
import fs from 'fs'
import path from 'path'
import type { DERequest, DEResponse, ExpressionInput, RouteApi } from '#types'
import { diffExpPayload } from '#types/checkers'
Expand Down Expand Up @@ -29,7 +29,7 @@ function init({ genomes }) {
const genome = genomes[q.genome]
if (!genome) throw 'invalid genome'
const [ds] = get_ds_tdb(genome, q)
let term_results = []
let term_results: any = []
if (q.tw) {
const terms = [q.tw]
term_results = await getData(
Expand Down Expand Up @@ -72,7 +72,7 @@ param{}
const group1names = [] as string[]
//let group1names_not_found = 0
//const group1names_not_found_list = []
const conf1_group1 = []
const conf1_group1: (string | number)[] = []
for (const s of param.samplelst.groups[0].values) {
if (!Number.isInteger(s.sampleId)) continue
const n = ds.cohort.termdb.q.id2sampleName(s.sampleId)
Expand All @@ -90,7 +90,7 @@ param{}
const group2names = [] as string[]
//let group2names_not_found = 0
//const group2names_not_found_list = []
const conf1_group2 = []
const conf1_group2: (string | number)[] = []
for (const s of param.samplelst.groups[1].values) {
if (!Number.isInteger(s.sampleId)) continue
const n = ds.cohort.termdb.q.id2sampleName(s.sampleId)
Expand Down Expand Up @@ -138,10 +138,10 @@ param{}

//console.log('expression_input:', expression_input)
//console.log("param.method:",param.method)
//fs.writeFile('test.txt', JSON.stringify(expression_input), function(err) {
// // For catching input to rust pipeline, in case of an error
// if (err) return console.log(err)
//})
fs.writeFile('test.txt', JSON.stringify(expression_input), function (err) {
// For catching input to rust pipeline, in case of an error
if (err) return console.log(err)
})

const sample_size_limit = 8 // Cutoff to determine if parametric estimation using edgeR should be used or non-parametric estimation using wilcoxon test
let result
Expand Down
6 changes: 4 additions & 2 deletions shared/types/src/routes/termdb.DE.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ export type DERequest = {
storage_type: 'text' | 'HDF5'
/** Method of DE used wilcoxon/edgeR */
method?: string
/** Term for confounding variable (if present) */
tw?: any
}

export type ExpressionInput = {
Expand All @@ -32,8 +34,8 @@ export type ExpressionInput = {
min_total_count: number
/** Type of storage file: HDF5 or text. Text will be deprecated in the future */
storage_type: 'HDF5' | 'text'
/** Confounding variable for DE analysis. Maybe string (Gender: Male/female) or number (Age). For now supporting 1 confounding variable. Later will add support for multiple confounding variables */
conf1?: number | string
/** Confounding variable for DE analysis. Maybe array of string (Gender: Male/female) or number (Age). For now supporting 1 confounding variable. Later will add support for multiple confounding variables */
conf1?: any[]
/** Type of the confounding variable (categorical/float) */
conf1_type?: 'categorical' | 'float'
}
Expand Down

0 comments on commit 034291c

Please sign in to comment.