Initial work of ESM transformation
This commit is contained in:
parent
2472c9cff2
commit
b8205a63aa
303 changed files with 1959 additions and 2450 deletions
238
utility/export-data/ligation-data.mjs
Normal file
238
utility/export-data/ligation-data.mjs
Normal file
|
@ -0,0 +1,238 @@
|
|||
import fs from "fs";
|
||||
import path from "path";
|
||||
import * as toml from "@iarna/toml";
|
||||
|
||||
const ligationSamples = [
|
||||
[
|
||||
"-<<",
|
||||
"-<",
|
||||
"-<-",
|
||||
"<--",
|
||||
"<---",
|
||||
"<<-",
|
||||
"<-",
|
||||
"->",
|
||||
"->>",
|
||||
"-->",
|
||||
"--->",
|
||||
"->-",
|
||||
">-",
|
||||
">>-",
|
||||
"<->",
|
||||
"<-->",
|
||||
"<--->",
|
||||
"<---->",
|
||||
"<!--"
|
||||
],
|
||||
[
|
||||
"=<<",
|
||||
"=<",
|
||||
"=<=",
|
||||
"<==",
|
||||
"<===",
|
||||
"<<=",
|
||||
"<=",
|
||||
"=>",
|
||||
"=>>",
|
||||
"==>",
|
||||
"===>",
|
||||
"=>=",
|
||||
">=",
|
||||
">>=",
|
||||
"<=>",
|
||||
"<==>",
|
||||
"<===>",
|
||||
"<====>",
|
||||
"<!---"
|
||||
],
|
||||
[
|
||||
"[|",
|
||||
"|]",
|
||||
"{|",
|
||||
"|}",
|
||||
"<=<",
|
||||
">=>",
|
||||
"<~~",
|
||||
"<~",
|
||||
"~>",
|
||||
"~~>",
|
||||
"::",
|
||||
":::",
|
||||
"\\/",
|
||||
"/\\",
|
||||
"==",
|
||||
"!=",
|
||||
"/=",
|
||||
`~=`,
|
||||
`<>`,
|
||||
"===",
|
||||
"!==",
|
||||
"=/=",
|
||||
"=!=",
|
||||
":>"
|
||||
],
|
||||
[
|
||||
":=",
|
||||
":-",
|
||||
":+",
|
||||
"<*",
|
||||
"<*>",
|
||||
"*>",
|
||||
"<|",
|
||||
"<|>",
|
||||
"|>",
|
||||
"<.",
|
||||
"<.>",
|
||||
".>",
|
||||
"+:",
|
||||
"-:",
|
||||
"=:",
|
||||
"<***>",
|
||||
"__",
|
||||
"(* comm *)",
|
||||
"++",
|
||||
"+++",
|
||||
"|-",
|
||||
"-|"
|
||||
]
|
||||
];
|
||||
const ligationSamplesNarrow = [
|
||||
[
|
||||
"-<<",
|
||||
"-<",
|
||||
"-<-",
|
||||
"<--",
|
||||
"<---",
|
||||
"<<-",
|
||||
"<-",
|
||||
"->",
|
||||
"->>",
|
||||
"-->",
|
||||
"--->",
|
||||
"->-",
|
||||
">-",
|
||||
">>-"
|
||||
],
|
||||
[
|
||||
"=<<",
|
||||
"=<",
|
||||
"=<=",
|
||||
"<==",
|
||||
"<===",
|
||||
"<<=",
|
||||
"<=",
|
||||
"=>",
|
||||
"=>>",
|
||||
"==>",
|
||||
"===>",
|
||||
"=>=",
|
||||
">=",
|
||||
">>="
|
||||
],
|
||||
["<->", "<-->", "<--->", "<---->", "<=>", "<==>", "<===>", "<====>", "-------->"],
|
||||
[
|
||||
"<~~",
|
||||
"<~",
|
||||
"~>",
|
||||
"~~>",
|
||||
"::",
|
||||
":::",
|
||||
"==",
|
||||
"!=",
|
||||
"/=",
|
||||
`~=`,
|
||||
`<>`,
|
||||
"===",
|
||||
"!==",
|
||||
"=/=",
|
||||
"=!="
|
||||
],
|
||||
[
|
||||
":=",
|
||||
":-",
|
||||
":+",
|
||||
"<*",
|
||||
"<*>",
|
||||
"*>",
|
||||
"<|",
|
||||
"<|>",
|
||||
"|>",
|
||||
"<.",
|
||||
"<.>",
|
||||
".>",
|
||||
"+:",
|
||||
"-:",
|
||||
"=:",
|
||||
":>",
|
||||
"__"
|
||||
],
|
||||
[
|
||||
"(*",
|
||||
"*)",
|
||||
"[|",
|
||||
"|]",
|
||||
"{|",
|
||||
"|}",
|
||||
"++",
|
||||
"+++",
|
||||
"\\/",
|
||||
"/\\",
|
||||
"|-",
|
||||
"-|",
|
||||
"<!--",
|
||||
"<!---",
|
||||
"<***>"
|
||||
]
|
||||
];
|
||||
function buildLigationSet(ligData, getKey) {
|
||||
const ligationSets = new Map([
|
||||
["*off", { tag: "calt", rank: 0, desc: "Ligation Off", brief: "Off", ligSets: [] }]
|
||||
]);
|
||||
for (const sel in ligData.composite) {
|
||||
const comp = ligData.composite[sel];
|
||||
if (!comp.tag) continue;
|
||||
const key = getKey(comp);
|
||||
let item = ligationSets.get(key);
|
||||
if (!item) {
|
||||
let ligSets = new Set();
|
||||
for (const s of comp.buildup) {
|
||||
ligSets.add(ligData.simple[s].ligGroup);
|
||||
}
|
||||
item = {
|
||||
selector: sel,
|
||||
tag: comp.tag,
|
||||
rank: 1,
|
||||
ligSets: [...ligSets],
|
||||
tagName: [comp.tag],
|
||||
desc: comp.desc,
|
||||
brief: comp.brief || comp.desc
|
||||
};
|
||||
ligationSets.set(key, item);
|
||||
} else {
|
||||
item.tagName = [...item.tagName, comp.tag];
|
||||
item.desc += ", " + comp.desc;
|
||||
item.brief += ", " + comp.brief;
|
||||
}
|
||||
}
|
||||
return ligationSets;
|
||||
}
|
||||
export const parseLigationData = async function () {
|
||||
const ligToml = await fs.promises.readFile(
|
||||
path.join(__dirname, "../../params/ligation-set.toml"),
|
||||
"utf8"
|
||||
);
|
||||
const ligData = toml.parse(ligToml);
|
||||
const ligationSets = buildLigationSet(ligData, comp => comp.buildup.join(","));
|
||||
const nonMergeLigationSets = buildLigationSet(
|
||||
ligData,
|
||||
comp => comp.tag + comp.buildup.join(",")
|
||||
);
|
||||
return {
|
||||
samples: ligationSamples,
|
||||
samplesNarrow: ligationSamplesNarrow,
|
||||
cherry: ligData.simple,
|
||||
rawSets: ligData.composite,
|
||||
sets: [...ligationSets.values()],
|
||||
nonMergeSets: [...nonMergeLigationSets.values()]
|
||||
};
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue