From 7a244e47198f1fa721db16457c09968df947dd7f Mon Sep 17 00:00:00 2001 From: David Lougheed Date: Wed, 17 Jan 2024 15:52:06 -0500 Subject: [PATCH] feat: configurable set of available assays for nodes --- config.example.js | 17 +++++++++++++++++ docs/setting_up_a_node.md | 15 ++++++++------- epivar-prod/node1/config.js | 17 +++++++++++++++++ epivar-prod/node2/config.js | 5 +++++ helpers/assays.mjs | 15 +++++++++++++++ models/assays.mjs | 6 +++++- 6 files changed, 67 insertions(+), 8 deletions(-) create mode 100644 helpers/assays.mjs diff --git a/config.example.js b/config.example.js index de1497ea..108a606f 100644 --- a/config.example.js +++ b/config.example.js @@ -4,11 +4,28 @@ * This file configures the dataset that this EpiVar node is responsible for hosting. */ +const ASSAY_RNA_SEQ = "RNA-seq"; +const ASSAY_ATAC_SEQ = "ATAC-seq"; +const ASSAY_H3K4ME1 = "H3K4me1"; +const ASSAY_H3K4ME3 = "H3K4me3"; +const ASSAY_H3K27AC = "H3K27ac"; +const ASSAY_H3K27ME3 = "H3K27me3"; + // noinspection JSUnusedGlobalSymbols module.exports = { title: "Aracena 𝘦𝘵 𝘢𝘭.", assembly: "hg19", + // availableAssays must be a subset or the set of assays supported by EpiVar: + availableAssays: [ + ASSAY_RNA_SEQ, + ASSAY_ATAC_SEQ, + ASSAY_H3K4ME1, + ASSAY_H3K4ME3, + ASSAY_H3K27AC, + ASSAY_H3K27ME3, + ], + conditions: [ {id: "NI", name: "Non-infected"}, {id: "Flu", name: "Flu"}, diff --git a/docs/setting_up_a_node.md b/docs/setting_up_a_node.md index c501fdd5..adb7a859 100644 --- a/docs/setting_up_a_node.md +++ b/docs/setting_up_a_node.md @@ -17,12 +17,12 @@ The following assay types can be ingested into an EpiVar node: -- RNA-seq -- ATAC-seq -- H3K4me1 -- H3K4me3 -- H3K27ac -- H3K27me3 +- `RNA-seq` +- `ATAC-seq` +- `H3K4me1` +- `H3K4me3` +- `H3K27ac` +- `H3K27me3` ### Dataset metadata @@ -53,7 +53,8 @@ The following assay types can be ingested into an EpiVar node: - `assay` - [ ] A dataset configuration file, which takes the form described in the - [example configuration file](/config.example.js). + [example configuration file](/config.example.js). Here, assays available in this node can be specified, as well as + experimental conditions, population groups, and functions for interacting with the genotype VCF file. This file specifies information about the dataset being hosted by the EpiVar node, including dataset title, sample groups and experimental treatments (in both of these, each entry has an ID and a name), assembly ID (`hg19` or diff --git a/epivar-prod/node1/config.js b/epivar-prod/node1/config.js index 3d1ea207..f8e861af 100644 --- a/epivar-prod/node1/config.js +++ b/epivar-prod/node1/config.js @@ -4,11 +4,28 @@ * This file configures the dataset that this EpiVar node is responsible for hosting. */ +const ASSAY_RNA_SEQ = "RNA-seq"; +const ASSAY_ATAC_SEQ = "ATAC-seq"; +const ASSAY_H3K4ME1 = "H3K4me1"; +const ASSAY_H3K4ME3 = "H3K4me3"; +const ASSAY_H3K27AC = "H3K27ac"; +const ASSAY_H3K27ME3 = "H3K27me3"; + // noinspection JSUnusedGlobalSymbols module.exports = { title: "Aracena 𝘦𝘵 𝘢𝘭.", assembly: "hg19", + // availableAssays must be a subset or the set of assays supported by EpiVar: + availableAssays: [ + ASSAY_RNA_SEQ, + ASSAY_ATAC_SEQ, + ASSAY_H3K4ME1, + ASSAY_H3K4ME3, + ASSAY_H3K27AC, + ASSAY_H3K27ME3, + ], + conditions: [ {id: "NI", name: "Non-infected"}, {id: "Flu", name: "Flu"}, diff --git a/epivar-prod/node2/config.js b/epivar-prod/node2/config.js index 75b14f8d..9488d5ff 100644 --- a/epivar-prod/node2/config.js +++ b/epivar-prod/node2/config.js @@ -4,11 +4,16 @@ * This file configures the dataset that this EpiVar node is responsible for hosting. */ +const ASSAY_RNA_SEQ = "RNA-seq"; + // noinspection JSUnusedGlobalSymbols module.exports = { title: "Aracena 𝘦𝘵 𝘢𝘭. RNA-seq liftover", assembly: "hg38", + // availableAssays must be a subset or the set of assays supported by EpiVar: + availableAssays: [ASSAY_RNA_SEQ], + conditions: [ {id: "NI", name: "Non-infected"}, {id: "Flu", name: "Flu"}, diff --git a/helpers/assays.mjs b/helpers/assays.mjs new file mode 100644 index 00000000..e5ffb36f --- /dev/null +++ b/helpers/assays.mjs @@ -0,0 +1,15 @@ +export const ASSAY_RNA_SEQ = "RNA-seq"; +export const ASSAY_ATAC_SEQ = "ATAC-seq"; +export const ASSAY_H3K4ME1 = "H3K4me1"; +export const ASSAY_H3K4ME3 = "H3K4me3"; +export const ASSAY_H3K27AC = "H3K27ac"; +export const ASSAY_H3K27ME3 = "H3K27me3"; + +export const ALL_ASSAYS = [ + ASSAY_RNA_SEQ, + ASSAY_ATAC_SEQ, + ASSAY_H3K4ME1, + ASSAY_H3K4ME3, + ASSAY_H3K27AC, + ASSAY_H3K27ME3, +]; diff --git a/models/assays.mjs b/models/assays.mjs index 7f9beb94..e45aea57 100644 --- a/models/assays.mjs +++ b/models/assays.mjs @@ -1,8 +1,12 @@ +import config from "../config.js"; +import {ALL_ASSAYS} from "../helpers/assays.mjs"; import db from "./db.mjs"; +const AVAILABLE_ASSAYS_SET = new Set(config.availableAssays ?? ALL_ASSAYS); + export const list = () => { return db.findAll("SELECT id, name FROM assays ORDER BY id") - .then(rows => rows.map(r => r.name)) + .then(rows => rows.map((r) => r.name).filter((a) => AVAILABLE_ASSAYS_SET.includes(a))); }; export default {