-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathutility.js
49 lines (39 loc) · 1.2 KB
/
utility.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
MedBook.utility = {};
MedBook.utility.sampleObjToStr = function (sampleObj) {
return sampleObj.study_label + "/" + sampleObj.uq_sample_label;
};
MedBook.utility.sampleStrToObj = function (sampleStr) {
var slashIndex = sampleStr.indexOf("/");
return {
study_label: sampleStr.slice(0, slashIndex),
uq_sample_label: sampleStr.slice(slashIndex + 1)
};
};
MedBook.utility.sampleArrObjToStr = function (array) {
return _.map(array, MedBook.utility.sampleObjToStr);
};
MedBook.utility.sampleArrStrToObj = function (array) {
return _.map(array, MedBook.utility.sampleStrToObj);
};
MedBook.utility.unqualifySampleLabels = function (sampleLabels) {
var sampleObjects = MedBook.utility.sampleArrStrToObj(sampleLabels);
return _.pluck(sampleObjects, "uq_sample_label");
};
var slugStringMap = {
gene_expression: "gene expression",
rsem: "RSEM",
quan_norm_counts: "quantile normalized counts",
fpkm: "FPKM",
tpm: "TPM",
raw_counts: "raw counts",
rsem: "RSEM",
cufflinks: "Cufflinks",
// gistic: "GISTIC",
// adtex: "Adtex",
// varscan: "Varscan",
};
MedBook.utility.slugToString = function (slug) {
var mapped = slugStringMap[slug];
if (!mapped) return slug;
return mapped;
};