-
Notifications
You must be signed in to change notification settings - Fork 1
/
run.js
49 lines (40 loc) · 1.51 KB
/
run.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// Load required modules
const fs = require("fs");
const yaml = require("js-yaml");
const { exec } = require("child_process");
// Parse the YAML config file
const fileContents = fs.readFileSync("./config.yml", "utf8");
const {
outputDirectory,
datasets,
} = yaml.safeLoad(fileContents);
// Go through each dataset and execute the pipeline
datasets.forEach(({
name,
sampleID,
alterationsFileURL,
samplesFileURL,
dependenciesFileURL,
twoComponentProfilesFileURL,
superDendrixResultsURL,
}) => {
// Alterations
const alterationsCommand = `node src/processAlterations.js "${alterationsFileURL}" ${outputDirectory} ${name}`;
exec(alterationsCommand);
// Samples
const samplesCommand = `node src/processSamples.js "${samplesFileURL}" ${sampleID} ${outputDirectory} ${name}`;
exec(samplesCommand);
// Dependencies
const dependenciesCommand = `node src/processDependencyScores.js "${dependenciesFileURL}" "${twoComponentProfilesFileURL}" ${outputDirectory} ${name}`;
exec(dependenciesCommand);
// SuperDendrix results
const superDendrixResultsCommand = `node src/processSuperDendrixResults.js "${superDendrixResultsURL}" ${outputDirectory} ${name}`;
exec(superDendrixResultsCommand);
});
// Write out a manifest for all the datasets
if (!fs.existsSync(outputDirectory)) fs.mkdirSync(outputDirectory, { recursive: true });
const manifestFile = `${outputDirectory}/manifest.json`;
const manifest = {
datasets: datasets.map((d) => d.name),
};
fs.writeFileSync(manifestFile, JSON.stringify(manifest));