diff --git a/configs/dmmm.yaml b/configs/dmmm.yaml index 86a1e2f..a2caddd 100644 --- a/configs/dmmm.yaml +++ b/configs/dmmm.yaml @@ -42,12 +42,12 @@ algorithms: datasets: # TODO: use old paramaters for datasets # HIV: https://github.com/Reed-CompBio/spras-benchmarking/blob/0293ae4dc0be59502fac06b42cfd9796a4b4413e/hiv-benchmarking/spras-config/config.yaml - - label: dmmmhiv060 + - label: dmmmhiv_060 node_files: ["processed_prize_060.txt"] edge_files: ["../../../databases/irefindex/phosphosite-irefindex13.0-uniprot.txt"] other_files: [] data_dir: "datasets/hiv/processed" - - label: dmmmhiv05 + - label: dmmmhiv_05 node_files: ["processed_prize_05.txt"] edge_files: ["../../../databases/irefindex/phosphosite-irefindex13.0-uniprot.txt"] other_files: [] @@ -58,21 +58,21 @@ datasets: edge_files: ["network1.txt"] other_files: [] data_dir: "datasets/yeast-osmotic-stress/processed" - - label: dmmmalopecia_areata + - label: dmmmdiseases_alopecia_areata data_dir: datasets/diseases edge_files: - raw/string_interactome.txt node_files: - prize_files/alopecia_areata_prizes.txt other_files: [] - - label: dmmmdiabetes_mellitus + - label: dmmmdiseases_diabetes_mellitus data_dir: datasets/diseases edge_files: - raw/string_interactome.txt node_files: - prize_files/diabetes_mellitus_prizes.txt other_files: [] - - label: dmmmcellline_fadu + - label: dmmmdepmap_cellline_fadu data_dir: datasets/depmap edge_files: ["../../databases/irefindex/phosphosite-irefindex13.0-uniprot.txt"] node_files: ["processed/FADU_cell_line_prizes_input_nonzero.txt"] @@ -81,12 +81,12 @@ gold_standards: - label: gs0 node_files: ['GS_files/Alopecia_areata_GS.txt'] data_dir: "datasets/diseases" - dataset_labels: ["dmmmalopecia_areata"] + dataset_labels: ["dmmmdiseases_alopecia_areata"] - label: gs1 node_files: ['GS_files/Diabetes_mellitus_GS.txt'] data_dir: "datasets/diseases" - dataset_labels: ["dmmmdiabetes_mellitus"] + dataset_labels: ["dmmmdiseases_diabetes_mellitus"] - label: gs_fadu node_files: ["processed/FADU_gold_standard.txt"] data_dir: datasets/depmap - dataset_labels: ["dmmmcellline_fadu"] + dataset_labels: ["dmmmdepmap_cellline_fadu"] diff --git a/configs/pra.yaml b/configs/pra.yaml index 7051c10..76f14a3 100644 --- a/configs/pra.yaml +++ b/configs/pra.yaml @@ -49,7 +49,7 @@ algorithms: include: true datasets: - - label: pramuscleskeletal2018 + - label: prarn_muscleskeletal2018 node_files: ["sources.txt", "targets.txt"] # DataLoader.py can currently only load a single edge file, which is the primary network edge_files: ["interactome.tsv"] diff --git a/web/.prettierrc b/web/.prettierrc new file mode 100644 index 0000000..d4187da --- /dev/null +++ b/web/.prettierrc @@ -0,0 +1,12 @@ +{ + "printWidth": 120, + "plugins": ["prettier-plugin-astro"], + "overrides": [ + { + "files": "*.astro", + "options": { + "parser": "astro" + } + } + ] +} diff --git a/web/astro.config.mts b/web/astro.config.mts index f34facc..5c4792e 100644 --- a/web/astro.config.mts +++ b/web/astro.config.mts @@ -1,8 +1,8 @@ // @ts-check -import { defineConfig } from 'astro/config'; +import { defineConfig } from "astro/config"; // https://astro.build/config export default defineConfig({ - base: '/spras-benchmarking', - trailingSlash: 'always' + base: "/spras-benchmarking", + trailingSlash: "always", }); diff --git a/web/package.json b/web/package.json index dbf8468..74b19ed 100644 --- a/web/package.json +++ b/web/package.json @@ -3,21 +3,25 @@ "type": "module", "version": "0.0.1", "scripts": { - "prepare-output": "mkdir -p public/data && cp -r ../output/ public/data", + "prepare-output": "mkdir -p public/data && cp -r ../output/ public/data && cp -r ../configs/ public/data", "dev": "pnpm prepare-output && astro dev", "build": "pnpm prepare-output && astro build", "preview": "astro preview", - "astro": "astro" + "astro": "astro", + "format": "pnpm exec prettier . --write" }, "dependencies": { "@fontsource-variable/noto-sans": "^5.2.10", "astro": "^5.16.6", "dayjs": "^1.11.19", "medium-zoom": "^1.1.0", - "sass": "^1.97.1" + "sass": "^1.97.1", + "yaml": "^2.8.2" }, "devDependencies": { + "prettier": "3.7.4", + "prettier-plugin-astro": "0.14.1", "vis-data": "^8.0.3", "vis-network": "^10.0.2" } -} \ No newline at end of file +} diff --git a/web/pnpm-lock.yaml b/web/pnpm-lock.yaml index c2791a5..c6e3136 100644 --- a/web/pnpm-lock.yaml +++ b/web/pnpm-lock.yaml @@ -13,7 +13,7 @@ importers: version: 5.2.10 astro: specifier: ^5.16.6 - version: 5.16.6(@types/node@25.0.3)(rollup@4.54.0)(sass@1.97.1)(typescript@5.8.3) + version: 5.16.6(@types/node@25.0.3)(rollup@4.54.0)(sass@1.97.1)(typescript@5.8.3)(yaml@2.8.2) dayjs: specifier: ^1.11.19 version: 1.11.19 @@ -23,7 +23,16 @@ importers: sass: specifier: ^1.97.1 version: 1.97.1 + yaml: + specifier: ^2.8.2 + version: 2.8.2 devDependencies: + prettier: + specifier: 3.7.4 + version: 3.7.4 + prettier-plugin-astro: + specifier: 0.14.1 + version: 0.14.1 vis-data: specifier: ^8.0.3 version: 8.0.3(uuid@13.0.0)(vis-util@6.0.0(@egjs/hammerjs@2.0.17)(component-emitter@2.0.0)) @@ -1275,6 +1284,15 @@ packages: resolution: {integrity: sha512-3Ybi1tAuwAP9s0r1UQ2J4n5Y0G05bJkpUIO0/bI9MhwmD70S5aTWbXGBwxHrelT+XM1k6dM0pk+SwNkpTRN7Pg==} engines: {node: ^10 || ^12 || >=14} + prettier-plugin-astro@0.14.1: + resolution: {integrity: sha512-RiBETaaP9veVstE4vUwSIcdATj6dKmXljouXc/DDNwBSPTp8FRkLGDSGFClKsAFeeg+13SB0Z1JZvbD76bigJw==} + engines: {node: ^14.15.0 || >=16.0.0} + + prettier@3.7.4: + resolution: {integrity: sha512-v6UNi1+3hSlVvv8fSaoUbggEM5VErKmmpGA7Pl3HF8V6uKY7rvClBOJlH6yNwQtfTueNkGVpOv/mtWL9L4bgRA==} + engines: {node: '>=14'} + hasBin: true + prismjs@1.30.0: resolution: {integrity: sha512-DEvV2ZF2r2/63V+tK8hQvrR2ZGn10srHbXviTlcv7Kpzw8jWiNTqbVgjO3IY8RxrrOUF8VPMQQFysYYYv0YZxw==} engines: {node: '>=6'} @@ -1350,6 +1368,12 @@ packages: engines: {node: '>=18.0.0', npm: '>=8.0.0'} hasBin: true + s.color@0.0.15: + resolution: {integrity: sha512-AUNrbEUHeKY8XsYr/DYpl+qk5+aM+DChopnWOPEzn8YKzOhv4l2zH6LzZms3tOZP3wwdOyc0RmTciyi46HLIuA==} + + sass-formatter@0.7.9: + resolution: {integrity: sha512-CWZ8XiSim+fJVG0cFLStwDvft1VI7uvXdCNJYXhDvowiv+DsbD1nXLiQ4zrE5UBvj5DWZJ93cwN0NX5PMsr1Pw==} + sass@1.97.1: resolution: {integrity: sha512-uf6HoO8fy6ClsrShvMgaKUn14f2EHQLQRtpsZZLeU/Mv0Q1K5P0+x2uvH6Cub39TVVbWNSrraUhDAoFph6vh0A==} engines: {node: '>=14.0.0'} @@ -1403,6 +1427,9 @@ packages: resolution: {integrity: sha512-gmBGslpoQJtgnMAvOVqGZpEz9dyoKTCzy2nfz/n8aIFhN/jCE/rCmcxabB6jOOHV+0WNnylOxaxBQPSvcWklhA==} engines: {node: '>=12'} + suf-log@2.5.3: + resolution: {integrity: sha512-KvC8OPjzdNOe+xQ4XWJV2whQA0aM1kGVczMQ8+dStAO6KfEB140JEVQ9dE76ONZ0/Ylf67ni4tILPJB41U0eow==} + svgo@4.0.0: resolution: {integrity: sha512-VvrHQ+9uniE+Mvx3+C9IEe/lWasXCU0nXMY2kZeLrHNICuRiC8uMPyM14UEaMOFA5mhyQqEkB02VoQ16n3DLaw==} engines: {node: '>=16'} @@ -1666,6 +1693,11 @@ packages: xxhash-wasm@1.1.0: resolution: {integrity: sha512-147y/6YNh+tlp6nd/2pWq38i9h6mz/EuQ6njIrmW8D1BS5nCqs0P6DG+m6zTGnNz5I+uhZ0SHxBs9BsPrwcKDA==} + yaml@2.8.2: + resolution: {integrity: sha512-mplynKqc1C2hTVYxd0PU2xQAc22TI1vShAYGksCCfxbn/dFwnHTNi1bvYsBTkhdUNtGIf5xNOg938rrSSYvS9A==} + engines: {node: '>= 14.6'} + hasBin: true + yargs-parser@21.1.1: resolution: {integrity: sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==} engines: {node: '>=12'} @@ -2183,7 +2215,7 @@ snapshots: array-iterate@2.0.1: {} - astro@5.16.6(@types/node@25.0.3)(rollup@4.54.0)(sass@1.97.1)(typescript@5.8.3): + astro@5.16.6(@types/node@25.0.3)(rollup@4.54.0)(sass@1.97.1)(typescript@5.8.3)(yaml@2.8.2): dependencies: '@astrojs/compiler': 2.13.0 '@astrojs/internal-helpers': 0.7.5 @@ -2240,8 +2272,8 @@ snapshots: unist-util-visit: 5.0.0 unstorage: 1.17.3 vfile: 6.0.3 - vite: 6.4.1(@types/node@25.0.3)(sass@1.97.1) - vitefu: 1.1.1(vite@6.4.1(@types/node@25.0.3)(sass@1.97.1)) + vite: 6.4.1(@types/node@25.0.3)(sass@1.97.1)(yaml@2.8.2) + vitefu: 1.1.1(vite@6.4.1(@types/node@25.0.3)(sass@1.97.1)(yaml@2.8.2)) xxhash-wasm: 1.1.0 yargs-parser: 21.1.1 yocto-spinner: 0.2.3 @@ -3093,6 +3125,14 @@ snapshots: picocolors: 1.1.1 source-map-js: 1.2.1 + prettier-plugin-astro@0.14.1: + dependencies: + '@astrojs/compiler': 2.13.0 + prettier: 3.7.4 + sass-formatter: 0.7.9 + + prettier@3.7.4: {} + prismjs@1.30.0: {} prompts@2.4.2: @@ -3237,6 +3277,12 @@ snapshots: '@rollup/rollup-win32-x64-msvc': 4.54.0 fsevents: 2.3.3 + s.color@0.0.15: {} + + sass-formatter@0.7.9: + dependencies: + suf-log: 2.5.3 + sass@1.97.1: dependencies: chokidar: 4.0.3 @@ -3325,6 +3371,10 @@ snapshots: dependencies: ansi-regex: 6.2.2 + suf-log@2.5.3: + dependencies: + s.color: 0.0.15 + svgo@4.0.0: dependencies: commander: 11.1.0 @@ -3486,7 +3536,7 @@ snapshots: '@egjs/hammerjs': 2.0.17 component-emitter: 2.0.0 - vite@6.4.1(@types/node@25.0.3)(sass@1.97.1): + vite@6.4.1(@types/node@25.0.3)(sass@1.97.1)(yaml@2.8.2): dependencies: esbuild: 0.25.12 fdir: 6.5.0(picomatch@4.0.3) @@ -3498,10 +3548,11 @@ snapshots: '@types/node': 25.0.3 fsevents: 2.3.3 sass: 1.97.1 + yaml: 2.8.2 - vitefu@1.1.1(vite@6.4.1(@types/node@25.0.3)(sass@1.97.1)): + vitefu@1.1.1(vite@6.4.1(@types/node@25.0.3)(sass@1.97.1)(yaml@2.8.2)): optionalDependencies: - vite: 6.4.1(@types/node@25.0.3)(sass@1.97.1) + vite: 6.4.1(@types/node@25.0.3)(sass@1.97.1)(yaml@2.8.2) web-namespaces@2.0.1: {} @@ -3519,6 +3570,8 @@ snapshots: xxhash-wasm@1.1.0: {} + yaml@2.8.2: {} + yargs-parser@21.1.1: {} yocto-queue@1.2.2: {} diff --git a/web/src/components/Colors.astro b/web/src/components/Colors.astro index 07d9091..62660ca 100644 --- a/web/src/components/Colors.astro +++ b/web/src/components/Colors.astro @@ -1,18 +1,41 @@ diff --git a/web/src/components/MediumZoom.astro b/web/src/components/MediumZoom.astro index 8944f2b..ece5361 100644 --- a/web/src/components/MediumZoom.astro +++ b/web/src/components/MediumZoom.astro @@ -1,5 +1,5 @@ diff --git a/web/src/components/Visualization.astro b/web/src/components/Visualization.astro index 78a9504..a9b2dae 100644 --- a/web/src/components/Visualization.astro +++ b/web/src/components/Visualization.astro @@ -1,5 +1,5 @@ --- -import VisualizationScript from './VisualizationScript.astro'; +import VisualizationScript from "./VisualizationScript.astro"; interface Props { interactome: string; @@ -7,37 +7,41 @@ interface Props { const { interactome } = Astro.props; -const noHeaderInteractomeArray = interactome.trim().split("\n").slice(1) -const noHeaderInteractome = (noHeaderInteractomeArray.length > 200 ? "BIG" : noHeaderInteractomeArray.join("\n")) +const edgeLimit = 300; + +const noHeaderInteractomeArray = interactome.trim().split("\n").slice(1); +const noHeaderInteractome = noHeaderInteractomeArray.length > edgeLimit ? "BIG" : noHeaderInteractomeArray.join("\n"); --- -
- { - noHeaderInteractome === '' ?

There is nothing to visualize.

: - - } -
- -{noHeaderInteractome !== '' && } \ No newline at end of file +{ + noHeaderInteractome === "" ? ( +

There is nothing to visualize.

+ ) : ( +
+ +
+ ) +} + +{noHeaderInteractome !== "" && } diff --git a/web/src/components/VisualizationScript.astro b/web/src/components/VisualizationScript.astro index cf709e8..e8328b2 100644 --- a/web/src/components/VisualizationScript.astro +++ b/web/src/components/VisualizationScript.astro @@ -1,33 +1,37 @@ diff --git a/web/src/layouts/BaseLayout.astro b/web/src/layouts/BaseLayout.astro index 2d029ba..c44f966 100644 --- a/web/src/layouts/BaseLayout.astro +++ b/web/src/layouts/BaseLayout.astro @@ -1,51 +1,53 @@ --- -import dayjs from 'dayjs' +import dayjs from "dayjs"; import { revision, shortRevision } from "../lib/commit"; -import '@fontsource-variable/noto-sans'; -const buildDate = dayjs() +import "@fontsource-variable/noto-sans"; +const buildDate = dayjs(); --- - - - - - - SPRAS Benchmark Results - + footer { + border-top: 1px dashed lightgray; + color: #555; + } + - - - -
-
- -
- -
- + a:hover { + background-color: #ddd; + } + + + +
+
+ +
+ +
+ diff --git a/web/src/lib/commit.ts b/web/src/lib/commit.ts index ae5cd9f..0d85c64 100644 --- a/web/src/lib/commit.ts +++ b/web/src/lib/commit.ts @@ -1,6 +1,6 @@ -import { execSync } from 'child_process'; +import { execSync } from "child_process"; -const decoder = new TextDecoder() +const decoder = new TextDecoder(); -export const revision = decoder.decode(execSync('git rev-parse HEAD')).trim(); +export const revision = decoder.decode(execSync("git rev-parse HEAD")).trim(); export const shortRevision = revision.substring(0, 6); diff --git a/web/src/lib/dataset.ts b/web/src/lib/dataset.ts new file mode 100644 index 0000000..d14e869 --- /dev/null +++ b/web/src/lib/dataset.ts @@ -0,0 +1,13 @@ +import { parse } from "yaml"; + +import dmmmYaml from "../../public/data/configs/dmmm.yaml?raw"; +import praYaml from "../../public/data/configs/dmmm.yaml?raw"; + +const configs: Record> = { + dmmm: parse(dmmmYaml), + pra: parse(praYaml), +}; + +export const datasets = Object.entries(configs) + .map(([type, entry]) => (entry["datasets"] as Record[]).map((dataset) => ({ ...dataset, type }))) + .flat(); diff --git a/web/src/lib/outputStyle.ts b/web/src/lib/outputStyle.ts index 05809ff..3eb6f08 100644 --- a/web/src/lib/outputStyle.ts +++ b/web/src/lib/outputStyle.ts @@ -1,80 +1,119 @@ -const dataTypes = [ - 'pra', - 'dmmm' -] - interface Output { - dataType: string; - datasetName: string; - algorithm: string; - paramsHash: string; + dataType: string; + datasetCategory: string; + datasetName?: string; + algorithm: string; + paramsHash: string; +} + +function extractPrefix(name: string, prefixName: string, prefixes: string[]): { prefix: string; name: string } { + const foundPrefix = prefixes.find((prefix) => name.startsWith(prefix)); + + if (!foundPrefix) { + throw new Error(`${name} should begin with a ${prefixName} (one of ${prefixes})`); + } + + return { + prefix: foundPrefix, + name: name.substring(foundPrefix.length), + }; } -export function extractDatasetType(name: string): { type: string, name: string } { - let newType; - let newName; - - for (let type of dataTypes) { - if (name.startsWith(type)) { - newType = type; - newName = name.substring(type.length); - break; - } - } - - // We add the !newName there for type-checking purposes. - if (!newType || !newName) { - throw new Error(`Dataset name should begin with a type (one of ${dataTypes})`) - } - - return { - type: newType, - name: newName - } +const dataTypes = ["pra", "dmmm"]; + +export function extractDatasetType(name: string): { type: string; name: string } { + const { prefix, name: newName } = extractPrefix(name, "dataset type", dataTypes); + return { type: prefix, name: newName }; +} + +const dataCategories = { + diseases: { + name: "DISEASES", + directory: "diseases", + }, + depmap: { + name: "DepMap", + directory: "depmap", + }, + hiv: { + name: "HIV", + directory: "hiv", + }, + rn: { + name: "ResponseNet", + directory: "rn-muscle-skeletal", + }, + yeast: { + name: "Yeast", + directory: "yeast-osmotic-stress", + }, +}; + +// TODO: replace this once we have proper dataset categories +export function extractDatasetCategory(name: string): { category: string; name: string } { + const { prefix, name: newName } = extractPrefix(name, "dataset category", Object.keys(dataCategories)); + return { category: prefix, name: newName.slice(1) }; } export function parseOutputString(str: string): Output { - const components = str.split("-"); - let dataType; - let datasetName; - let algorithm; - let paramsHash; - - if (components.length === 4) { - if (dataTypes.includes(components[0])) { - // This is a slug URL (type-...) - [dataType, datasetName, algorithm, paramsHash] = components - } else { - // This is fetched straight from the folder - we ignore -params- - [datasetName, algorithm, , paramsHash] = components - } - } else if (components.length === 3) { - [datasetName, algorithm, paramsHash] = components - } else { - throw new Error(`Unexpected length of components in ${components}.`) - } - - - // We didn't get a data type in the first passthrough - lets extract the data - // type from the name - if (!dataType) { - const { type, name } = extractDatasetType(datasetName); - dataType = type; - datasetName = name; - } - - return { - dataType, - datasetName, - algorithm, - paramsHash - } + const components = str.split("-"); + let dataType; + let datasetCategory; + let datasetName; + let algorithm; + let paramsHash; + + if (components.length === 5) { + // This is a slug URL (type-...) + [dataType, datasetCategory, datasetName, algorithm, paramsHash] = components; + } else if (components.length === 4) { + // This is also a slug URL w/o a name + [dataType, datasetCategory, algorithm, paramsHash] = components; + } else if (components.length === 3) { + // This is fetched straight from the folder - we ignored -params previously + [datasetName, algorithm, paramsHash] = components; + } else { + throw new Error(`Unexpected length of components in ${components}.`); + } + + // We didn't get a data type in the first passthrough - lets extract the data + // type from the name + if (!dataType || !datasetCategory) { + if (!datasetName) throw new Error(`datasetName ${datasetName} isn't set - this is an internal error.`); + const { type, name: name1 } = extractDatasetType(datasetName); + const { category, name } = extractDatasetCategory(name1); + dataType = type; + datasetCategory = category; + datasetName = name; + } + + return { + dataType, + datasetCategory, + datasetName, + algorithm, + paramsHash, + }; +} + +export function addOptional(name: string | undefined, settings: { prefix?: string; suffix?: string }): string { + return name ? `${settings.prefix ?? ""}${name}${settings.suffix ?? ""}` : ""; } export function styleOutput(output: Output): string { - return `${output.dataType}-${output.datasetName}-${output.algorithm}-${output.paramsHash}` + return `${output.dataType}-${output.datasetCategory}-${addOptional(output.datasetName, { suffix: "-" })}${output.algorithm}-${output.paramsHash}`; } export function asFolderName(output: Output): string { - return `${output.dataType}${output.datasetName}-${output.algorithm}-params-${output.paramsHash}` + return `${output.dataType}${output.datasetCategory}${addOptional(output.datasetName, { prefix: "_" })}-${output.algorithm}-params-${output.paramsHash}`; +} + +export function algorithmDocumentationUrl(algorithm: string): string { + const map: Record = { + omicsintegrator1: "oi1", + omicsintegrator2: "oi2", + }; + + const foundAlgorithm = algorithm in map ? map[algorithm] : algorithm; + return `https://spras.readthedocs.io/en/latest/prms/${foundAlgorithm}.html`; } diff --git a/web/src/lib/paths.ts b/web/src/lib/paths.ts index db41bff..dd59307 100644 --- a/web/src/lib/paths.ts +++ b/web/src/lib/paths.ts @@ -1,15 +1,16 @@ -import { extractDatasetType } from "./outputStyle"; +import { extractDatasetCategory, extractDatasetType } from "./outputStyle"; export function getDataFiles() { - const dataFiles = import.meta.glob('../../public/data/output/**', { query: '?raw' }); - return Object.keys(dataFiles) - .map(path => path.substring("../../public/data/output/".length)) + const dataFiles = import.meta.glob("../../public/data/output/**", { query: "?raw" }); + return Object.keys(dataFiles).map((path) => path.substring("../../public/data/output/".length)); } export function getDatasets() { - const files = getDataFiles(); - return files.filter(file => file.startsWith("logs/datasets-")) - .map(file => file.substring("logs/datasets-".length)) - .map(file => file.slice(0, -".yaml".length)) - .map(file => extractDatasetType(file)) + const files = getDataFiles(); + return files + .filter((file) => file.startsWith("logs/datasets-")) + .map((file) => file.substring("logs/datasets-".length)) + .map((file) => file.slice(0, -".yaml".length)) + .map((file) => extractDatasetType(file)) + .map(({ type, name }) => ({ type, ...extractDatasetCategory(name) })); } diff --git a/web/src/pages/[uid]/index.astro b/web/src/pages/[uid]/index.astro index 6cceff0..e8e3871 100644 --- a/web/src/pages/[uid]/index.astro +++ b/web/src/pages/[uid]/index.astro @@ -1,39 +1,48 @@ --- -import BaseLayout from '../../layouts/BaseLayout.astro'; -import Visualization from '../../components/Visualization.astro' -import { asFolderName, parseOutputString, styleOutput } from '../../lib/outputStyle'; -import { getDataFiles } from '../../lib/paths'; -import { Code } from 'astro:components'; +import BaseLayout from "../../layouts/BaseLayout.astro"; +import Visualization from "../../components/Visualization.astro"; +import { + addOptional, + algorithmDocumentationUrl, + asFolderName, + parseOutputString, + styleOutput, +} from "../../lib/outputStyle"; +import { getDataFiles } from "../../lib/paths"; +import { Code } from "astro:components"; export function getStaticPaths() { - const filteredPaths = new Set(getDataFiles() - // We can safely filter for these prefixes, as datasets start with their type. - // Specifically, we do not want to make pages for our prepared inputs and logs. - .filter(path => !path.startsWith('prepared')) - .filter(path => !path.startsWith('logs')) - // Then, we don't want to make pages for our root-level files - .filter(path => path.includes("/")) - // We specifically want the folder names - .map(path => path.split("/")[0]) - // And we want to only have the dataset a-b-c-d params, not analysis ones - .filter(path => path.split("-").length === 4) - // Then, we exclude -params- - .map(path => path.replace("-params", ""))); + const filteredPaths = new Set( + getDataFiles() + // We can safely filter for these prefixes, as datasets start with their type. + // Specifically, we do not want to make pages for our prepared inputs and logs. + .filter((path) => !path.startsWith("prepared")) + .filter((path) => !path.startsWith("logs")) + // Then, we don't want to make pages for our root-level files + .filter((path) => path.includes("/")) + // We specifically want the folder names + .map((path) => path.split("/")[0]) + // And we want to only have the dataset a-b-c-d params, not analysis ones + .filter((path) => path.split("-").length === 4) + // Then, we exclude -params- + .map((path) => path.replace("-params", "")), + ); - return [...filteredPaths] - .map(path => ({ params: { uid: styleOutput(parseOutputString(path)) }})); + return [...filteredPaths].map((path) => ({ params: { uid: styleOutput(parseOutputString(path)) } })); } const { uid } = Astro.params; const output = parseOutputString(uid); // We get the raw files associated to this specific run -const subPaths = getDataFiles().filter(path => path.startsWith(asFolderName(output))) +const subPaths = getDataFiles().filter((path) => path.startsWith(asFolderName(output))); // The paramater config content -const parametersCode = (await import(`../../../../output/logs/parameters-${output.algorithm}-params-${output.paramsHash}.yaml?raw`)).default +const parametersCode = ( + await import(`../../../../output/logs/parameters-${output.algorithm}-params-${output.paramsHash}.yaml?raw`) +).default; // The interactome content -const interactome = (await import(`../../../../output/${asFolderName(output)}/pathway.txt?raw`)).default +const interactome = (await import(`../../../../output/${asFolderName(output)}/pathway.txt?raw`)).default; --- - - - -

Runs ({getStaticPaths().length})

- + + + +

Runs ({getStaticPaths().length})

+
diff --git a/web/src/pages/type-category-dataset/[...slug]/index.astro b/web/src/pages/type-category-dataset/[...slug]/index.astro new file mode 100644 index 0000000..01ec65f --- /dev/null +++ b/web/src/pages/type-category-dataset/[...slug]/index.astro @@ -0,0 +1,45 @@ +--- +import MediumZoom from "../../../components/MediumZoom.astro"; +import BaseLayout from "../../../layouts/BaseLayout.astro"; +import { getDatasets } from "../../../lib/paths"; + +export function getStaticPaths() { + return getDatasets().map(({ name, category, type }) => ({ + params: { slug: `${type}-${category}${name ? `-${name}` : ""}`, name, category, type }, + })); +} + +const { slug } = Astro.params; +const { type, category, name } = getStaticPaths().find((path) => path.params.slug == slug)!.params; +--- + + + + +

{type}-{category}{name ? `-${name}` : ""}

+ + (go to home) +
+ (go to type-category-datasets) + +

Principal Component Analysis

+ + +

Jaccard Similarity Heatmap

+ +
+ + diff --git a/web/src/pages/type-category-dataset/index.astro b/web/src/pages/type-category-dataset/index.astro new file mode 100644 index 0000000..0338316 --- /dev/null +++ b/web/src/pages/type-category-dataset/index.astro @@ -0,0 +1,29 @@ +--- +import BaseLayout from "../../layouts/BaseLayout.astro"; +import { getStaticPaths } from "./[...slug]/index.astro"; +import Colors from "../../components/Colors.astro"; +--- + + + +

Type-Category-Datasets

+ +

This contains analysis associated with datasets running on a particular algorithm type under some category.

+ + +
diff --git a/web/src/pages/type-category/[type]-[category]/index.astro b/web/src/pages/type-category/[type]-[category]/index.astro new file mode 100644 index 0000000..a4bb9f6 --- /dev/null +++ b/web/src/pages/type-category/[type]-[category]/index.astro @@ -0,0 +1,27 @@ +--- +import BaseLayout from "../../../layouts/BaseLayout.astro"; +import { getDatasets } from "../../../lib/paths"; + +export function getStaticPaths() { + return getDatasets() + .map((obj) => ({ ...obj, id: `${obj.type}-${obj.category}` })) + .filter( + (value, index, self) => + // Removing duplicate entries + index === self.findIndex((t) => t.id === value.id), + ) + .map(({ category, type }) => ({ + params: { category, type }, + })); +} + +const { category, type } = Astro.params; +--- + + +

{type}-{category}

+ + (go to home) +
+ (go to type-category) +
diff --git a/web/src/pages/type-category/index.astro b/web/src/pages/type-category/index.astro new file mode 100644 index 0000000..797f96c --- /dev/null +++ b/web/src/pages/type-category/index.astro @@ -0,0 +1,24 @@ +--- +import BaseLayout from "../../layouts/BaseLayout.astro"; +import { getStaticPaths } from "./[type]-[category]/index.astro"; +import Colors from "../../components/Colors.astro"; +--- + + + +

Type-Datasets

+ +

This contains analysis associated with datasets running on a particular algorithm type.

+ + +
diff --git a/web/src/pages/type-dataset/[type]-[name]/index.astro b/web/src/pages/type-dataset/[type]-[name]/index.astro deleted file mode 100644 index 967ebf1..0000000 --- a/web/src/pages/type-dataset/[type]-[name]/index.astro +++ /dev/null @@ -1,38 +0,0 @@ ---- -import MediumZoom from "../../../components/MediumZoom.astro"; -import BaseLayout from "../../../layouts/BaseLayout.astro"; -import { getDatasets } from "../../../lib/paths"; - -export function getStaticPaths() { - return getDatasets().map(({ name, type }) => ({ params: { type, name }})); -} - -const { type, name } = Astro.params; ---- - - - - -

{type}-{name}

- - (go to home)
- (go to type-datasets) - -

Principal Component Analysis

- - -

Jaccard Similarity Heatmap

- -
- - \ No newline at end of file diff --git a/web/src/pages/type-dataset/index.astro b/web/src/pages/type-dataset/index.astro deleted file mode 100644 index d21fbb8..0000000 --- a/web/src/pages/type-dataset/index.astro +++ /dev/null @@ -1,17 +0,0 @@ ---- -import BaseLayout from "../../layouts/BaseLayout.astro" -import { getStaticPaths } from "./[type]-[name]/index.astro" - ---- - - -

Type-Datasets

- -

This contains analysis associated with datasets running on a particular algorithm type.

- -
    - {getStaticPaths().map(({ params: { type, name }}) => (
  • - {type}-{name} -
  • ))} -
-