@datagrok/sequence-translator 1.0.16 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.json +4 -3
- package/CHANGELOG.md +3 -0
- package/detectors.js +8 -28
- package/dist/package-test.js +2 -72987
- package/dist/package-test.js.map +1 -0
- package/dist/package.js +2 -72192
- package/dist/package.js.map +1 -0
- package/files/axolabs-style.json +97 -0
- package/files/codes-to-symbols.json +66 -0
- package/files/formats-to-helm.json +59 -0
- package/files/linkers.json +22 -0
- package/files/monomer-lib.json +1094 -0
- package/link-bio +7 -0
- package/package.json +30 -26
- package/scripts/build-monomer-lib.py +391 -122
- package/src/demo/demo-st-ui.ts +71 -0
- package/src/demo/handle-error.ts +12 -0
- package/src/model/axolabs/axolabs-tab.ts +111 -0
- package/src/model/axolabs/const.ts +33 -0
- package/src/{axolabs → model/axolabs}/draw-svg.ts +1 -1
- package/src/{axolabs → model/axolabs}/helpers.ts +7 -5
- package/src/model/const.ts +19 -0
- package/src/model/data-loading-utils/const.ts +8 -0
- package/src/model/data-loading-utils/json-loader.ts +38 -0
- package/src/model/data-loading-utils/types.ts +30 -0
- package/src/model/format-translation/const.ts +8 -0
- package/src/model/format-translation/conversion-utils.ts +48 -0
- package/src/model/format-translation/format-converter.ts +107 -0
- package/src/model/helpers.ts +12 -0
- package/src/model/monomer-lib/const.ts +3 -0
- package/src/model/monomer-lib/lib-wrapper.ts +106 -0
- package/src/model/parsing-validation/format-detector.ts +57 -0
- package/src/model/parsing-validation/sequence-validator.ts +52 -0
- package/src/model/sequence-to-structure-utils/const.ts +1 -0
- package/src/{structures-works → model/sequence-to-structure-utils}/mol-transformations.ts +61 -87
- package/src/model/sequence-to-structure-utils/monomer-code-parser.ts +92 -0
- package/src/model/sequence-to-structure-utils/sdf-tab.ts +94 -0
- package/src/model/sequence-to-structure-utils/sequence-to-molfile.ts +409 -0
- package/src/package.ts +106 -77
- package/src/tests/const.ts +17 -0
- package/src/tests/smiles-tests.ts +32 -457
- package/src/view/const/main-tab.ts +3 -0
- package/src/view/const/view.ts +10 -0
- package/src/view/css/axolabs-tab.css +1 -0
- package/src/view/css/colored-text-input.css +27 -0
- package/src/view/css/main-tab.css +46 -0
- package/src/view/css/sdf-tab.css +39 -0
- package/src/view/monomer-lib-viewer/viewer.ts +22 -0
- package/src/view/tabs/axolabs.ts +720 -0
- package/src/view/tabs/main.ts +174 -0
- package/src/view/tabs/sdf.ts +173 -0
- package/src/view/utils/app-info-dialog.ts +18 -0
- package/src/view/utils/colored-input/colored-text-input.ts +56 -0
- package/src/view/utils/colored-input/input-painters.ts +44 -0
- package/src/view/utils/draw-molecule.ts +86 -0
- package/src/view/utils/molecule-img.ts +106 -0
- package/src/view/view.ts +129 -0
- package/tsconfig.json +12 -18
- package/webpack.config.js +17 -4
- package/README.md +0 -84
- package/css/style.css +0 -18
- package/img/Sequence Translator Axolabs.png +0 -0
- package/jest.config.js +0 -33
- package/setup-unlink-clean.cmd +0 -14
- package/setup.cmd +0 -14
- package/setup.sh +0 -37
- package/src/__jest__/remote.test.ts +0 -77
- package/src/__jest__/test-node.ts +0 -97
- package/src/apps/oligo-sd-file-app.ts +0 -58
- package/src/autostart/ICDs.ts +0 -3
- package/src/autostart/IDPs.ts +0 -3
- package/src/autostart/calculations.ts +0 -40
- package/src/autostart/constants.ts +0 -37
- package/src/autostart/registration.ts +0 -241
- package/src/autostart/salts.ts +0 -2
- package/src/autostart/sources.ts +0 -3
- package/src/autostart/users.ts +0 -3
- package/src/axolabs/constants.ts +0 -101
- package/src/axolabs/define-pattern.ts +0 -873
- package/src/helpers.ts +0 -28
- package/src/main/main-view.ts +0 -262
- package/src/structures-works/const.ts +0 -5
- package/src/structures-works/converters.ts +0 -323
- package/src/structures-works/from-monomers.ts +0 -267
- package/src/structures-works/map.ts +0 -720
- package/src/structures-works/save-sense-antisense.ts +0 -91
- package/src/structures-works/sequence-codes-tools.ts +0 -344
- package/src/utils/parse.ts +0 -27
- package/src/utils/sdf-add-columns.ts +0 -118
- package/src/utils/sdf-save-table.ts +0 -56
- package/test-SequenceTranslator-6288c2fbe346-cce4ac1d.html +0 -259
- package/vendors/openchemlib-full.js +0 -293
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import * as grok from 'datagrok-api/grok';
|
|
2
|
-
import * as ui from 'datagrok-api/ui';
|
|
3
|
-
import * as DG from 'datagrok-api/dg';
|
|
4
|
-
import {_package} from '../package';
|
|
5
|
-
import {FileSource} from 'datagrok-api/dg';
|
|
6
|
-
|
|
7
|
-
export class OligoSdFileApp {
|
|
8
|
-
df!: DG.DataFrame;
|
|
9
|
-
|
|
10
|
-
constructor() {}
|
|
11
|
-
|
|
12
|
-
async init(srcDf?: DG.DataFrame): Promise<void> {
|
|
13
|
-
let dataDf: DG.DataFrame;
|
|
14
|
-
if (srcDf) {
|
|
15
|
-
dataDf = srcDf;
|
|
16
|
-
} else {
|
|
17
|
-
const dfFn: string = 'System:AppData/SequenceTranslator/test input_Nov28_Duplex_dimer.xlsx';
|
|
18
|
-
dataDf = await this.loadData(dfFn);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
this.setData(dataDf);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
async loadData(dfFn: string): Promise<DG.DataFrame> {
|
|
25
|
-
//
|
|
26
|
-
const dataDf: DG.DataFrame = await grok.data.files.openTable(dfFn);
|
|
27
|
-
return dataDf;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
async setData(df: DG.DataFrame): Promise<void> {
|
|
31
|
-
if (this.viewed) {
|
|
32
|
-
await this.destroyView();
|
|
33
|
-
this.viewed = false;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
this.df = df;
|
|
37
|
-
|
|
38
|
-
if (!this.viewed) {
|
|
39
|
-
await this.buildView();
|
|
40
|
-
this.viewed = true;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
private viewed: boolean = false;
|
|
45
|
-
private tView?: DG.TableView;
|
|
46
|
-
|
|
47
|
-
async destroyView(): Promise<void> {
|
|
48
|
-
this.tView!.close();
|
|
49
|
-
delete this.tView;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
async buildView(): Promise<void> {
|
|
53
|
-
console.debug('SequenceTranslator: OligoSdFileApp.buildView() ');
|
|
54
|
-
|
|
55
|
-
this.tView = grok.shell.addTableView(this.df);
|
|
56
|
-
this.tView.path = this.tView.basePath = 'func/SequenceTranslator.oligoSdFileApp';
|
|
57
|
-
}
|
|
58
|
-
}
|
package/src/autostart/ICDs.ts
DELETED
package/src/autostart/IDPs.ts
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import * as DG from 'datagrok-api/dg';
|
|
2
|
-
|
|
3
|
-
import {sortByStringLengthInDescendingOrder} from '../helpers';
|
|
4
|
-
import {MODIFICATIONS} from '../structures-works/map';
|
|
5
|
-
|
|
6
|
-
export function saltMass(
|
|
7
|
-
saltNames: string[], saltsMolWeightList: number[], equivalentsCol: DG.Column, i: number, saltCol: DG.Column
|
|
8
|
-
): number {
|
|
9
|
-
const saltRowIndex = saltNames.indexOf(saltCol.get(i));
|
|
10
|
-
return (
|
|
11
|
-
saltRowIndex == -1 || saltsMolWeightList[saltRowIndex] == DG.FLOAT_NULL || equivalentsCol.get(i) == DG.INT_NULL
|
|
12
|
-
) ?
|
|
13
|
-
DG.FLOAT_NULL :
|
|
14
|
-
saltsMolWeightList[saltRowIndex] * equivalentsCol.get(i);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export function saltMolWeigth(
|
|
18
|
-
saltNamesList: string[], saltCol: DG.Column, saltsMolWeightList: number[], i: number
|
|
19
|
-
): number {
|
|
20
|
-
const saltRowIndex = saltNamesList.indexOf(saltCol.get(i));
|
|
21
|
-
return (saltRowIndex == -1) ? DG.FLOAT_NULL : saltsMolWeightList[saltRowIndex];
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export function batchMolWeight(compoundMolWeightCol: DG.Column, saltMassCol: DG.Column, i: number): number {
|
|
25
|
-
return (compoundMolWeightCol.getString(i) == '' || saltMassCol.getString(i) == '') ?
|
|
26
|
-
DG.FLOAT_NULL :
|
|
27
|
-
compoundMolWeightCol.get(i) + saltMassCol.get(i);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export function molecularWeight(sequence: string, weightsObj: { [index: string]: number }): number {
|
|
31
|
-
const codes = sortByStringLengthInDescendingOrder(Object.keys(weightsObj)).concat(Object.keys(MODIFICATIONS));
|
|
32
|
-
let weight = 0;
|
|
33
|
-
let i = 0;
|
|
34
|
-
while (i < sequence.length) {
|
|
35
|
-
const matchedCode = codes.find((s) => s == sequence.slice(i, i + s.length))!;
|
|
36
|
-
weight += weightsObj[sequence.slice(i, i + matchedCode.length)];
|
|
37
|
-
i += matchedCode.length;
|
|
38
|
-
}
|
|
39
|
-
return weight - 61.97;
|
|
40
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
export const SEQUENCE_TYPES = {
|
|
2
|
-
SENSE_STRAND: 'SS',
|
|
3
|
-
ANTISENSE_STRAND: 'AS',
|
|
4
|
-
DUPLEX: 'Duplex',
|
|
5
|
-
TRIPLEX: 'Triplex',
|
|
6
|
-
DIMER: 'Dimer',
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
export const COL_NAMES = {
|
|
10
|
-
CHEMISTRY: 'Chemistry',
|
|
11
|
-
NUMBER: 'Number',
|
|
12
|
-
TYPE: 'Type',
|
|
13
|
-
CHEMISTRY_NAME: 'Chemistry Name',
|
|
14
|
-
INTERNAL_COMPOUND_ID: 'Internal compound ID',
|
|
15
|
-
IDP: 'IDP',
|
|
16
|
-
SEQUENCE: 'Sequence',
|
|
17
|
-
COMPOUND_NAME: 'Compound Name',
|
|
18
|
-
COMPOUND_COMMENTS: 'Compound Comments',
|
|
19
|
-
SALT: 'Salt',
|
|
20
|
-
EQUIVALENTS: 'Equivalents',
|
|
21
|
-
PURITY: 'Purity',
|
|
22
|
-
COMPOUND_MOL_WEIGHT: 'Cpd MW',
|
|
23
|
-
SALT_MOL_WEIGHT: 'Salt MW',
|
|
24
|
-
SALT_MASS: 'Salt mass',
|
|
25
|
-
BATCH_MOL_WEIGHT: 'Batch MW',
|
|
26
|
-
SOURCE: 'Source',
|
|
27
|
-
ICD: 'ICD',
|
|
28
|
-
OWNER: 'Owner',
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
export const GENERATED_COL_NAMES = [
|
|
32
|
-
COL_NAMES.COMPOUND_NAME,
|
|
33
|
-
COL_NAMES.COMPOUND_COMMENTS,
|
|
34
|
-
COL_NAMES.COMPOUND_MOL_WEIGHT,
|
|
35
|
-
COL_NAMES.SALT_MASS,
|
|
36
|
-
COL_NAMES.BATCH_MOL_WEIGHT,
|
|
37
|
-
];
|
|
@@ -1,241 +0,0 @@
|
|
|
1
|
-
import * as grok from 'datagrok-api/grok';
|
|
2
|
-
import * as ui from 'datagrok-api/ui';
|
|
3
|
-
import * as DG from 'datagrok-api/dg';
|
|
4
|
-
import {
|
|
5
|
-
siRnaBioSpringToGcrs, siRnaAxolabsToGcrs, gcrsToNucleotides, asoGapmersBioSpringToGcrs, gcrsToMermade12,
|
|
6
|
-
siRnaNucleotidesToGcrs
|
|
7
|
-
} from '../structures-works/converters';
|
|
8
|
-
import {weightsObj, SYNTHESIZERS} from '../structures-works/map';
|
|
9
|
-
import {SEQUENCE_TYPES, COL_NAMES, GENERATED_COL_NAMES} from './constants';
|
|
10
|
-
import {saltMass, saltMolWeigth, molecularWeight, batchMolWeight} from './calculations';
|
|
11
|
-
import {isValidSequence} from '../structures-works/sequence-codes-tools';
|
|
12
|
-
import {sequenceToMolV3000} from '../structures-works/from-monomers';
|
|
13
|
-
import {linkStrandsV3000} from '../structures-works/mol-transformations';
|
|
14
|
-
import {stringify, download, removeEmptyRows, differenceOfTwoArrays} from '../helpers';
|
|
15
|
-
|
|
16
|
-
import {SALTS_CSV} from './salts';
|
|
17
|
-
import {USERS_CSV} from './users';
|
|
18
|
-
import {ICDS} from './ICDs';
|
|
19
|
-
import {SOURCES} from './sources';
|
|
20
|
-
import {IDPS} from './IDPs';
|
|
21
|
-
|
|
22
|
-
import {sdfAddColumns} from '../utils/sdf-add-columns';
|
|
23
|
-
import {sdfSaveTable} from '../utils/sdf-save-table';
|
|
24
|
-
|
|
25
|
-
const enum SEQ_TYPE {
|
|
26
|
-
AS = 'AS',
|
|
27
|
-
SS = 'SS',
|
|
28
|
-
DUPLEX = 'Duplex',
|
|
29
|
-
DIMER = 'Dimer',
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
/** Computable classes of sequence types */
|
|
33
|
-
const enum SEQ_TYPE_CLASS {
|
|
34
|
-
AS_OR_SS,
|
|
35
|
-
DUPLEX,
|
|
36
|
-
DIMER,
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
/** Style used for a cell with invalid value */
|
|
40
|
-
const errorStyle = {
|
|
41
|
-
'background-color': '#ff8080',
|
|
42
|
-
'width': '100%',
|
|
43
|
-
'height': '100%',
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
export function sdfHandleErrorUI(msgPrefix: string, df: DG.DataFrame, rowI: number, err: any) {
|
|
47
|
-
const errStr: string = err.toString();
|
|
48
|
-
const errMsg: string = msgPrefix + `row #${rowI + 1}, name: '${df.get('Chemistry Name', rowI)}', ` +
|
|
49
|
-
`type: ${df.get('Type', rowI)} error: ${errStr}.`;
|
|
50
|
-
grok.shell.warning(errMsg);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
// todo: use a dictionary instead?
|
|
54
|
-
function getActualTypeClass(actualType: string): SEQ_TYPE_CLASS {
|
|
55
|
-
if (actualType === SEQ_TYPE.AS || actualType === SEQ_TYPE.SS)
|
|
56
|
-
return SEQ_TYPE_CLASS.AS_OR_SS;
|
|
57
|
-
else if (actualType === SEQ_TYPE.DIMER)
|
|
58
|
-
return SEQ_TYPE_CLASS.DIMER;
|
|
59
|
-
else if (actualType === SEQ_TYPE.DUPLEX)
|
|
60
|
-
return SEQ_TYPE_CLASS.DUPLEX;
|
|
61
|
-
else
|
|
62
|
-
throw new Error('Some types in \'Types\' column are invalid ');
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
function inferTypeClassFromSequence(seq: string): SEQ_TYPE_CLASS {
|
|
66
|
-
const lines = seq.split('\n');
|
|
67
|
-
if (lines.length === 1)
|
|
68
|
-
return SEQ_TYPE_CLASS.AS_OR_SS;
|
|
69
|
-
else if (lines.length === 2)
|
|
70
|
-
return SEQ_TYPE_CLASS.DUPLEX;
|
|
71
|
-
else if (lines.length === 3)
|
|
72
|
-
return SEQ_TYPE_CLASS.DIMER;
|
|
73
|
-
else
|
|
74
|
-
throw new Error('Wrong formatting of sequences in \'Sequence\' column');
|
|
75
|
-
//todo: throw in the case of wrong formatting
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
/** Compare type specified in 'Type' column to that computed from 'Sequence' column */
|
|
79
|
-
function validateType(actualType: string, seq: string): boolean {
|
|
80
|
-
return getActualTypeClass(actualType) === inferTypeClassFromSequence(seq);
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
function oligoSdFileGrid(view: DG.TableView): void {
|
|
84
|
-
const typeColName = 'Type';
|
|
85
|
-
const seqColName = 'Sequence';
|
|
86
|
-
const grid = view.grid;
|
|
87
|
-
const df = view.dataFrame;
|
|
88
|
-
const typeCol = df.getCol(typeColName);
|
|
89
|
-
grid.columns.byName(typeColName)!.cellType = 'html';
|
|
90
|
-
const seqCol = df.getCol(seqColName);
|
|
91
|
-
grid.onCellPrepare((gridCell: DG.GridCell) => {
|
|
92
|
-
if (gridCell.isTableCell && gridCell.gridColumn.column!.name === typeColName) {
|
|
93
|
-
const isValidType = validateType(gridCell.cell.value, seqCol.get(gridCell.tableRow!.idx));
|
|
94
|
-
gridCell.style.element = ui.div(gridCell.cell.value, isValidType ? {} : {style: errorStyle});
|
|
95
|
-
}
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
export function autostartOligoSdFileSubscription() {
|
|
100
|
-
grok.events.onViewAdded.subscribe((v: any) => {
|
|
101
|
-
if (v.type === DG.VIEW_TYPE.TABLE_VIEW) {
|
|
102
|
-
if (v.dataFrame.columns.contains(COL_NAMES.TYPE)) {
|
|
103
|
-
oligoSdFileGrid(v);
|
|
104
|
-
oligoSdFile(v.dataFrame);
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
// Should be removed after fixing bug https://github.com/datagrok-ai/public/issues/808
|
|
108
|
-
grok.events.onContextMenu.subscribe((args) => {
|
|
109
|
-
if (!(args.args.context instanceof DG.Grid)) return;
|
|
110
|
-
const grid: DG.Grid = args.args.context as DG.Grid;
|
|
111
|
-
const menu: DG.Menu = args.args.menu;
|
|
112
|
-
|
|
113
|
-
const seqCol = grid.table.currentCol; // /^[fsACGUacgu]{6,}$/
|
|
114
|
-
if (DG.Detector.sampleCategories(seqCol,
|
|
115
|
-
(s) => /(\(invabasic\)|\(GalNAc-2-JNJ\)|A|U|G|C){6,}$/.test(s))) {
|
|
116
|
-
menu.item('Convert raw nucleotides to GCRS', () => {
|
|
117
|
-
grid.table.columns.addNewString(seqCol.name + ' to GCRS').init((i: number) => {
|
|
118
|
-
return siRnaNucleotidesToGcrs(seqCol.get(i));
|
|
119
|
-
});
|
|
120
|
-
});
|
|
121
|
-
} else if (DG.Detector.sampleCategories(seqCol,
|
|
122
|
-
(s) => /(\(invabasic\)|\(GalNAc-2-JNJ\)|f|s|A|C|G|U|a|c|g|u){6,}$/.test(s))) {
|
|
123
|
-
menu.item('Convert Axolabs to GCRS', () => {
|
|
124
|
-
grid.table.columns.addNewString(seqCol.name + ' to GCRS').init((i: number) => {
|
|
125
|
-
return siRnaAxolabsToGcrs(seqCol.get(i));
|
|
126
|
-
});
|
|
127
|
-
}); // /^[fmpsACGU]{6,}$/
|
|
128
|
-
} else if (DG.Detector.sampleCategories(seqCol,
|
|
129
|
-
(s) => /(\(invabasic\)|\(GalNAc-2-JNJ\)|f|m|ps|A|C|G|U){6,}$/.test(s)) ||
|
|
130
|
-
DG.Detector.sampleCategories(seqCol, (s) => /^(?=.*moe)(?=.*5mC)(?=.*ps){6,}/.test(s))) {
|
|
131
|
-
menu.item('Convert GCRS to raw', () => {
|
|
132
|
-
grid.table.columns.addNewString(seqCol.name + ' to raw').init((i: number) => {
|
|
133
|
-
return gcrsToNucleotides(seqCol.get(i));
|
|
134
|
-
});
|
|
135
|
-
});
|
|
136
|
-
menu.item('Convert GCRS to MM12', () => {
|
|
137
|
-
grid.table.columns.addNewString(seqCol.name + ' to MM12').init((i: number) => {
|
|
138
|
-
return gcrsToMermade12(seqCol.get(i));
|
|
139
|
-
});
|
|
140
|
-
}); // /^[*56789ATGC]{6,}$/
|
|
141
|
-
} else if (DG.Detector.sampleCategories(seqCol,
|
|
142
|
-
(s) => /(\(invabasic\)|\(GalNAc-2-JNJ\)|\*|5|6|7|8|9|A|T|G|C){6,}$/.test(s))) {
|
|
143
|
-
menu.item('Convert Biospring to GCRS', () => {
|
|
144
|
-
const seqCol = grid.table.currentCol;
|
|
145
|
-
grid.table.columns.addNewString(seqCol.name + ' to GCRS').init((i: number) => {
|
|
146
|
-
return asoGapmersBioSpringToGcrs(seqCol.get(i));
|
|
147
|
-
});
|
|
148
|
-
}); // /^[*1-8]{6,}$/
|
|
149
|
-
} else if (DG.Detector.sampleCategories(seqCol,
|
|
150
|
-
(s) => /(\(invabasic\)|\(GalNAc-2-JNJ\)|\*|1|2|3|4|5|6|7|8){6,}$/.test(s))) {
|
|
151
|
-
menu.item('Convert Biospring to GCRS', () => {
|
|
152
|
-
grid.table.columns.addNewString(seqCol.name + ' to GCRS').init((i: number) => {
|
|
153
|
-
return siRnaBioSpringToGcrs(seqCol.get(i));
|
|
154
|
-
});
|
|
155
|
-
});
|
|
156
|
-
}
|
|
157
|
-
});
|
|
158
|
-
}
|
|
159
|
-
});
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
export function oligoSdFile(table: DG.DataFrame) {
|
|
163
|
-
const saltsDf = DG.DataFrame.fromCsv(SALTS_CSV);
|
|
164
|
-
const usersDf = DG.DataFrame.fromCsv(USERS_CSV);
|
|
165
|
-
const sourcesDf = DG.DataFrame.fromCsv(SOURCES);
|
|
166
|
-
const icdsDf = DG.DataFrame.fromCsv(ICDS);
|
|
167
|
-
const idpsDf = DG.DataFrame.fromCsv(IDPS);
|
|
168
|
-
|
|
169
|
-
const saltCol = table.getCol(COL_NAMES.SALT);
|
|
170
|
-
const equivalentsCol = table.getCol(COL_NAMES.EQUIVALENTS);
|
|
171
|
-
|
|
172
|
-
const saltsMolWeightList: number[] = saltsDf.getCol('MOLWEIGHT').toList();
|
|
173
|
-
const saltNamesList: string[] = saltsDf.getCol('DISPLAY').toList();
|
|
174
|
-
|
|
175
|
-
let newDf: DG.DataFrame | undefined = undefined;
|
|
176
|
-
|
|
177
|
-
const d = ui.div([
|
|
178
|
-
ui.icons.edit(() => {
|
|
179
|
-
d.innerHTML = '';
|
|
180
|
-
if (table.getCol(COL_NAMES.IDP).type != DG.COLUMN_TYPE.STRING)
|
|
181
|
-
table.changeColumnType(COL_NAMES.IDP, DG.COLUMN_TYPE.STRING);
|
|
182
|
-
d.append(
|
|
183
|
-
ui.divH([
|
|
184
|
-
ui.button('Add columns',
|
|
185
|
-
() => {
|
|
186
|
-
newDf = sdfAddColumns(table, saltNamesList, saltsMolWeightList,
|
|
187
|
-
(rowI, err) => { sdfHandleErrorUI('Error on ', table, rowI, err); });
|
|
188
|
-
grok.shell.getTableView(newDf.name).grid.columns.setOrder(Object.values(COL_NAMES));
|
|
189
|
-
},
|
|
190
|
-
`Add columns: '${GENERATED_COL_NAMES.join(`', '`)}'`),
|
|
191
|
-
ui.bigButton('Save SDF', () => {
|
|
192
|
-
const df: DG.DataFrame = newDf ?? table;
|
|
193
|
-
sdfSaveTable(df,
|
|
194
|
-
(rowI, err) => { sdfHandleErrorUI('Skip ', df, rowI, err); });
|
|
195
|
-
}, 'Save SD file'),
|
|
196
|
-
])
|
|
197
|
-
);
|
|
198
|
-
|
|
199
|
-
const view = grok.shell.getTableView(table.name);
|
|
200
|
-
view.grid.setOptions({rowHeight: 45});
|
|
201
|
-
view.dataFrame.getCol(COL_NAMES.TYPE).setTag(DG.TAGS.CHOICES, stringify(Object.values(SEQUENCE_TYPES)));
|
|
202
|
-
view.dataFrame.getCol(COL_NAMES.OWNER).setTag(DG.TAGS.CHOICES, stringify(usersDf.columns.byIndex(0).toList()));
|
|
203
|
-
view.dataFrame.getCol(COL_NAMES.SALT).setTag(DG.TAGS.CHOICES, stringify(saltsDf.columns.byIndex(0).toList()));
|
|
204
|
-
view.dataFrame.getCol(COL_NAMES.SOURCE).setTag(DG.TAGS.CHOICES, stringify(sourcesDf.columns.byIndex(0).toList()));
|
|
205
|
-
view.dataFrame.getCol(COL_NAMES.ICD).setTag(DG.TAGS.CHOICES, stringify(icdsDf.columns.byIndex(0).toList()));
|
|
206
|
-
view.dataFrame.getCol(COL_NAMES.IDP).setTag(DG.TAGS.CHOICES, stringify(idpsDf.columns.byIndex(0).toList()));
|
|
207
|
-
|
|
208
|
-
grok.events.onContextMenu.subscribe((args) => {
|
|
209
|
-
if (!(args.args.context instanceof DG.Grid)) return;
|
|
210
|
-
const grid: DG.Grid = args.args.context as DG.Grid;
|
|
211
|
-
const menu: DG.Menu = args.args.menu;
|
|
212
|
-
|
|
213
|
-
if ([COL_NAMES.TYPE, COL_NAMES.OWNER, COL_NAMES.SALT, COL_NAMES.SOURCE, COL_NAMES.ICD, COL_NAMES.IDP]
|
|
214
|
-
.includes(grid.table.currentCol.name)) {
|
|
215
|
-
menu.item('Fill Column With Value', () => {
|
|
216
|
-
const v = grid.table.currentCell.value;
|
|
217
|
-
grid.table.currentCell.column.init(v);
|
|
218
|
-
for (let i = 0; i < view.dataFrame.rowCount; i++)
|
|
219
|
-
updateCalculatedColumns(view.dataFrame, i);
|
|
220
|
-
});
|
|
221
|
-
}
|
|
222
|
-
});
|
|
223
|
-
|
|
224
|
-
view.dataFrame.onDataChanged.subscribe(() => {
|
|
225
|
-
const colName = view.dataFrame.currentCol.name;
|
|
226
|
-
if ([COL_NAMES.SALT, COL_NAMES.EQUIVALENTS, COL_NAMES.SALT_MOL_WEIGHT].includes(colName))
|
|
227
|
-
updateCalculatedColumns(view.dataFrame, view.dataFrame.currentRowIdx);
|
|
228
|
-
});
|
|
229
|
-
|
|
230
|
-
function updateCalculatedColumns(t: DG.DataFrame, i: number): void {
|
|
231
|
-
const smValue = saltMass(saltNamesList, saltsMolWeightList, equivalentsCol, i, saltCol);
|
|
232
|
-
t.getCol(COL_NAMES.SALT_MASS).set(i, smValue, false);
|
|
233
|
-
const smwValue = saltMolWeigth(saltNamesList, saltCol, saltsMolWeightList, i);
|
|
234
|
-
t.getCol(COL_NAMES.SALT_MOL_WEIGHT).set(i, smwValue, false);
|
|
235
|
-
const bmw = batchMolWeight(t.getCol(COL_NAMES.COMPOUND_MOL_WEIGHT), t.getCol(COL_NAMES.SALT_MASS), i);
|
|
236
|
-
t.getCol(COL_NAMES.BATCH_MOL_WEIGHT).set(i, bmw, false);
|
|
237
|
-
}
|
|
238
|
-
}),
|
|
239
|
-
]);
|
|
240
|
-
grok.shell.v.setRibbonPanels([[d]]);
|
|
241
|
-
}
|
package/src/autostart/salts.ts
DELETED
package/src/autostart/sources.ts
DELETED
package/src/autostart/users.ts
DELETED
package/src/axolabs/constants.ts
DELETED
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
const RNA_COLOR = 'rgb(255,230,153)';
|
|
2
|
-
const INVABASIC_COLOR = 'rgb(203,119,211)';
|
|
3
|
-
export const AXOLABS_MAP:
|
|
4
|
-
{[index: string]: {fullName: string, symbols: [string, string, string, string], color: string}} =
|
|
5
|
-
{
|
|
6
|
-
'RNA': {
|
|
7
|
-
fullName: 'RNA nucleotides',
|
|
8
|
-
symbols: ['A', 'C', 'G', 'U'],
|
|
9
|
-
color: RNA_COLOR,
|
|
10
|
-
},
|
|
11
|
-
'DNA': {
|
|
12
|
-
fullName: 'DNA nucleotides',
|
|
13
|
-
symbols: ['dA', 'dC', 'dG', 'dT'],
|
|
14
|
-
color: 'rgb(197,224,180)',
|
|
15
|
-
},
|
|
16
|
-
"2\"-Fluoro": {
|
|
17
|
-
fullName: '2\'-Fluoro nucleotides',
|
|
18
|
-
symbols: ['Af', 'Cf', 'Gf', 'Uf'],
|
|
19
|
-
color: 'rgb(68,114,196)',
|
|
20
|
-
},
|
|
21
|
-
"2\"-O-Methyl": {
|
|
22
|
-
fullName: '2\'-O-Methyl nucleotides',
|
|
23
|
-
symbols: ['a', 'c', 'g', 'u'],
|
|
24
|
-
color: 'rgb(166,166,166)',
|
|
25
|
-
},
|
|
26
|
-
"2\"-O-MOE": {
|
|
27
|
-
fullName: '2\'-O-MOE nucleotides (including 5-Methyl C)',
|
|
28
|
-
symbols: ['Am', 'Cm', 'Gm', 'Tm'],
|
|
29
|
-
color: 'rgb(112,48,160)',
|
|
30
|
-
},
|
|
31
|
-
'GNA': {
|
|
32
|
-
fullName: 'Glycol nucleic acid',
|
|
33
|
-
symbols: ['(GNA-A)', '(GNA-C)', '(GNA-G)', '(GNA-T)'],
|
|
34
|
-
color: 'rgb(255,192,0)',
|
|
35
|
-
},
|
|
36
|
-
'LNA': {
|
|
37
|
-
fullName: 'Locked nucleic acid (including 5-Methyl C)',
|
|
38
|
-
symbols: ['Ab', 'Cb', 'Gb', 'Tb'],
|
|
39
|
-
color: 'rgb(54,229,238)',
|
|
40
|
-
},
|
|
41
|
-
'UNA': {
|
|
42
|
-
fullName: 'Unlocked nucleotides',
|
|
43
|
-
symbols: ['Ao', 'Co', 'Go', 'Uo'],
|
|
44
|
-
color: 'rgb(255,192,0)',
|
|
45
|
-
},
|
|
46
|
-
'A': {
|
|
47
|
-
fullName: 'Adenosine',
|
|
48
|
-
symbols: ['a', 'a', 'a', 'a'],
|
|
49
|
-
color: RNA_COLOR,
|
|
50
|
-
},
|
|
51
|
-
'C': {
|
|
52
|
-
fullName: 'Cytidine',
|
|
53
|
-
symbols: ['c', 'c', 'c', 'c'],
|
|
54
|
-
color: RNA_COLOR,
|
|
55
|
-
},
|
|
56
|
-
'G': {
|
|
57
|
-
fullName: 'Guanosine',
|
|
58
|
-
symbols: ['g', 'g', 'g', 'g'],
|
|
59
|
-
color: RNA_COLOR,
|
|
60
|
-
},
|
|
61
|
-
'U': {
|
|
62
|
-
fullName: 'Uridine',
|
|
63
|
-
symbols: ['u', 'u', 'u', 'u'],
|
|
64
|
-
color: RNA_COLOR,
|
|
65
|
-
},
|
|
66
|
-
'X-New': {
|
|
67
|
-
fullName: '',
|
|
68
|
-
symbols: ['X', 'X', 'X', 'X'],
|
|
69
|
-
color: 'rgb(108,0,0)',
|
|
70
|
-
},
|
|
71
|
-
'Y-New': {
|
|
72
|
-
fullName: '',
|
|
73
|
-
symbols: ['Y', 'Y', 'Y', 'Y'],
|
|
74
|
-
color: 'rgb(210,146,146)',
|
|
75
|
-
},
|
|
76
|
-
'Z-New': {
|
|
77
|
-
fullName: '',
|
|
78
|
-
symbols: ['Z', 'Z', 'Z', 'Z'],
|
|
79
|
-
color: 'rgb(155,108,132)',
|
|
80
|
-
},
|
|
81
|
-
'InvAbasic': {
|
|
82
|
-
fullName: 'Inverted abasic capped',
|
|
83
|
-
symbols: ['(invabasic)', '(invabasic)', '(invabasic)', '(invabasic)'],
|
|
84
|
-
color: INVABASIC_COLOR,
|
|
85
|
-
},
|
|
86
|
-
"5\"-vinylps": {
|
|
87
|
-
fullName: '5\'-vinylphosphonate-2\'-OMe-uridine',
|
|
88
|
-
symbols: ['(vinu)', '(vinu)', '(vinu)', '(vinu)'],
|
|
89
|
-
color: 'rgb(0,0,139)',
|
|
90
|
-
},
|
|
91
|
-
'InvAbasic(o)': {
|
|
92
|
-
fullName: 'Inverted abasic capped (overhang)',
|
|
93
|
-
symbols: ['(invabasic)', '(invabasic)', '(invabasic)', '(invabasic)'],
|
|
94
|
-
color: INVABASIC_COLOR,
|
|
95
|
-
},
|
|
96
|
-
"2\"-OMe-U(o)": {
|
|
97
|
-
fullName: 'Nucleotide Uridine with 2\'O-Methyl protection (overhang)',
|
|
98
|
-
symbols: ['mU', 'mU', 'mU', 'mU'],
|
|
99
|
-
color: 'rgb(65,233,80)',
|
|
100
|
-
},
|
|
101
|
-
};
|