@datagrok/bio 1.7.9 → 1.7.13
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/detectors.js +15 -1
- package/dist/package-test.js +634 -156
- package/dist/package.js +562 -147
- package/dist/vendors-node_modules_datagrok-libraries_ml_src_workers_dimensionality-reducer_js.js +3 -3
- package/files/tests/testSpgi100.csv +8437 -0
- package/files/tests/testUnichemSources.csv +36 -0
- package/package.json +10 -10
- package/scripts/embed.py +13 -0
- package/src/const.ts +5 -0
- package/src/package.ts +94 -4
- package/src/tests/activity-cliffs-tests.ts +3 -0
- package/src/tests/convert-test.ts +42 -9
- package/src/tests/detectors-test.ts +37 -4
- package/src/tests/renderers-test.ts +1 -1
- package/src/utils/cell-renderer.ts +114 -1
- package/src/utils/constants.ts +2 -1
- package/src/utils/convert.ts +13 -10
- package/src/utils/utils.ts +53 -3
- package/src/widgets/representations.ts +54 -0
- package/{test-Bio-34f75e5127b8-0a8a5821.html → test-Bio-34f75e5127b8-781e9df9.html} +20 -12
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
src_id,name,description,current_release_u,created,last_updated,userstamp,number_or_date,name_long,src_details,src_url,base_id_url,base_id_url_available,aux_required,aux_for_url,aux_description,private,name_label,src_class,keys_only,update_min,update_opt,update_max,update_j,update_comments,synonyms
|
|
2
|
+
1,chembl,A database of bioactive drug-like small molecules and bioactivities abstracted from the scientific literature.,17,31-DEC-2010 09:00:01,01-JUN-2018 00:00:00,autoloader,number,ChEMBL,Standard InChIs and Keys provided on ftp site for each release.,https://www.ebi.ac.uk/chembl/,https://www.ebi.ac.uk/chembldb/compound/inspect/,1,0,0,none,0,ChEMBL,2,0,280,290,330,0,approx 6 monthly updates,0
|
|
3
|
+
3,pdb,"The European resource for the collection, organisation and dissemination of data on biological macromolecular structures, including structures of small molecule ligands for proteins.",229,28-SEP-2011 09:00:01,31-DEC-2018 00:00:00,autoloader,date,PDBe (Protein Data Bank Europe),Standard InChIs and Keys provided by direct querying of Oracle DB.,http://www.ebi.ac.uk/pdbe/,http://www.ebi.ac.uk/pdbe-srv/pdbechem/chemicalCompound/show/,1,0,0,none,0,PDBe,2,0,6,7,14,0,weekly updates,0
|
|
4
|
+
2,drugbank,"A database that combines drug (i.e. chemical, pharmacological and pharmaceutical) data with drug target (i.e. sequence, structure, and pathway) information.",32,28-MAY-2011 09:00:01,06-JUL-2018 00:00:00,autoloader,date,DrugBank,Standard InChIs and Keys provided within sd file on ftp site for each release.,http://drugbank.ca/,http://www.drugbank.ca/drugs/,1,0,0,none,0,DrugBank,2,0,90,95,130,0,Quarterly updates,
|
|
5
|
+
5,pubchem_dotf,A subset of the PubChem DB: from the original depositor 'drugs of the future' (Prous).,2,25-OCT-2011 07:00:00,29-JUL-2013 00:00:00,autoloader,date,PubChem ('Drugs of the Future' subset),"Mol files for SIDs downloaded manually, via PubChem interface, and Standard InChIs and Keys generated by InChI software. SIDs used as identifiers.",http://pubchem.ncbi.nlm.nih.gov/sources/sources.cgi,http://pubchem.ncbi.nlm.nih.gov/substance/,1,0,0,none,0,PubChem: Drugs of the Future ,2,0,100000,100000,100000,0,Considered a static deposition into pubchem,
|
|
6
|
+
4,gtopdb,"The IUPHAR (International Union of Basic and Clinical Pharmacology)/BPS (British Pharmacological Society) Guide to PHARMACOLOGY database contains structures of small molecule ligands, peptides and antibodies, with their affinities at protein targets.",17,21-OCT-2011 09:00:01,21-NOV-2018 00:00:00,autoloader,date,Guide to Pharmacology,Standard InChIs and Keys available for download at http://www.guidetopharmacology.org/download.jsp,http://www.guidetopharmacology.org,http://www.guidetopharmacology.org/GRAC/LigandDisplayForward?ligandId=,1,0,0,none,0,Guide to Pharmacology,2,0,90,95,130,0,Quarterly updates,
|
|
7
|
+
11,ibm,"The data are provided by IBM-NIH and include all chemistry extracted by means of text and image mining from the patent corpus (USPTO, WIPO and EPO) for patent documents published through 31-12-2010. Identifiers in UniChem are IBM compound identifiers.",2,16-APR-2012 09:00:01,11-FEB-2015 00:00:00,autoloader,date,IBM strategic IP insight platform and the National Institutes of Health,InChIs and InChI keys were generated from SMILES in house.,http://www-935.ibm.com/services/us/gbs/bao/siip/nih/,http://www-935.ibm.com/services/us/gbs/bao/siip/nih/?sid=,1,0,0,none,0,IBM Patent System,2,0,100000,100000,100000,0,static set,
|
|
8
|
+
6,kegg_ligand,"KEGG LIGAND is a composite DB consisting of COMPOUND, GLYCAN, REACTION, RPAIR, RCLASS, and ENZYME DBs, whose entries are identified by C, G, R, RP, RC, and EC numbers, respectively.",1,25-JUN-2011 09:00:01,27-JUN-2011 00:00:00,autoloader,date,KEGG (Kyoto Encyclopedia of Genes and Genomes) Ligand,Mol files were downloaded manually prior to this download becoming private. Standard InChIs and Keys generated by InChI software.,http://www.genome.jp/kegg/ligand.html,http://www.genome.jp/dbget-bin/www_bget?,1,0,0,none,0,KEGG Ligand,2,0,100000,100000,100000,0,downloads now no longer available,
|
|
9
|
+
9,zinc,"A free database of commercially-available compounds for virtual screening, provided by the Shoichet Laboratory in the Department of Pharmaceutical Chemistry at the University of California, San Francisco (UCSF). [Irwin and Shoichet, J. Chem. Inf. Model. 2005;45(1):177-82]",6,11-MAR-2012 09:00:01,21-AUG-2017 00:00:00,autoloader,date,ZINC,"novirtual subset of ZINC15, as a file containing inchis and keys from http://files.docking.org/export/unichem/",http://zinc15.docking.org,http://zinc15.docking.org/substances/,1,0,0,none,0,ZINC,3,0,1290,1295,1305,1,monthly updates,
|
|
10
|
+
8,nih_ncc,Collections of plated arrays of small molecules that have a history of use in human clinical trials. Assembled by the National Institutes of Health (NIH) through the Molecular Libraries Roadmap Initiative,1,26-NOV-2011 09:00:01,02-DEC-2011 00:00:00,autoloader,date,NIH Clinical Collection,Mol files downloaded manually and Standard InChIs and Keys generated by InChI software,http://nihsmr.evotec.com/evotec/,,0,0,0,none,0,NIH Clinical Collection,2,0,100000,100000,100000,0,"static set, not updated",
|
|
11
|
+
10,emolecules,"A free chemical structure search engine containing millions of public domain structures. Pricing, availabilities, and vendor information requires an eMolecules Plus subscription.",1,13-MAR-2012 09:00:01,15-MAR-2012 00:00:00,autoloader,date,eMolecules,"Downloaded as an SD file from source, Converted to InChI and INChIKeys by UniChem",https://www.emolecules.com/,https://www.emolecules.com/cgi-bin/more?vid=,1,0,0,none,0,eMolecules,3,0,100000,100000,100000,0,downloads now no longer available,
|
|
12
|
+
12,atlas,"The Gene Expression Atlas is a semantically enriched database of meta-analysis based summary statistics over a curated subset of ArrayExpress Archive, servicing queries for condition-specific gene expression patterns as well as broader exploratory searches for biologically interesting genes/samples.",1,18-JUN-2012 09:00:01,28-SEP-2012 00:00:00,autoloader,date,Gene Expression Atlas,Currently extracted from compound names.,http://www.ebi.ac.uk/gxa/home,http://www.ebi.ac.uk/gxa/query?conditionQuery=,1,0,0,none,0,Atlas,2,0,100000,100000,100000,0,manual updates,0
|
|
13
|
+
7,chebi,ChEBI is a freely available dictionary of molecular entities focused on 'small' chemical compounds,62,24-NOV-2011 09:00:01,04-JAN-2019 00:00:00,autoloader,date,ChEBI (Chemical Entities of Biological Interest).,Std InChis (but no keys) provided on ftp site. Keys generated by UniChem. 'all star' compounds downloaded,http://www.ebi.ac.uk/chebi/downloadsForward.do,http://www.ebi.ac.uk/chebi/searchId.do?chebiId=CHEBI%3A,1,0,0,none,0,ChEBI,2,0,25,30,50,0,monthly updates,
|
|
14
|
+
14,fdasrs,"The primary goal of the FDA/USP Substance Registration System (SRS) is to unambiguously define all substances present in regulated products. Once a substance has been defined, the SRS assigns a strong identifier that is permanently associated with the substance: a UNII (Unique Ingredient Identifier). This is a a non-proprietary, free, unique, unambiguous, nonsemantic, alphanumeric identifier based on a substances molecular structure and/or descriptive information.",20,05-APR-2013 00:00:00,07-NOV-2018 00:00:00,autoloader,date,FDA/USP Substance Registration System (SRS),Download of InChIKeys in file UNII Data from http://fdasis.nlm.nih.gov/srs/jsp/srs/uniiListDownload.jsp,http://fdasis.nlm.nih.gov/srs/srs.jsp,http://fdasis.nlm.nih.gov/srs/ProxyServlet?mergeData=true&objectHandle=DBMaint&APPLICATION_NAME=fdasrs&actionHandle=default&nextPage=jsp/srs/ResultScreen.jsp&TXTSUPERLISTID=,1,0,0,none,0,FDA SRS,2,1,90,95,130,0,presumed to be quartely updates,
|
|
15
|
+
15,surechembl,"SureChEMBL automatically extracts chemistry from the full text of all major patent authorities. Compounds are derived from either chemical names found in text or in chemical depictions. All SureChEMBL compounds are included, except those failing UniChem loading rules.",207,05-APR-2013 00:00:00,01-JAN-2019 00:00:00,autoloader,date,SureChEMBL,Standard InChIs and InChIKeys provided by a direct feed from the SureChEMBL database,https://www.surechembl.org/search/,https://www.surechembl.org/chemical/,1,0,0,none,0,SureChEMBL,2,0,5,7,9,1,weekly,
|
|
16
|
+
21,pubchem_tpharma,A subset of the PubChem DB: from the original depositor 'Thomson Pharma'.,1,29-JUL-2013 00:00:00,30-JUL-2013 00:00:00,autoloader,date,PubChem ('Thomson Pharma' subset),"Mol files for SIDs downloaded manually, via PubChem interface, and Standard InChIs and Keys generated by InChI software. SIDs used as identifiers.",http://www.thomson-pharma.com/,http://pubchem.ncbi.nlm.nih.gov/substance/,1,0,0,none,0,PubChem: Thomson Pharma ,2,0,100000,100000,100000,0,Considered a static deposition into pubchem,
|
|
17
|
+
22,pubchem,A database of normalized PubChem compounds (CIDs) from the PubChem Database.,112,21-OCT-2013 00:00:00,25-DEC-2018 00:00:00,autoloader,date,PubChem Compounds,Standard InChIs and Keys provided on ftp site.,http://pubchem.ncbi.nlm.nih.gov,http://pubchem.ncbi.nlm.nih.gov/compound/,1,0,0,none,0,PubChem,2,0,12,14,18,1,fortnightly updates,
|
|
18
|
+
27,recon,A biochemical knowledge-base on human metabolism,1,13-OCT-2014 00:00:00,13-OCT-2014 00:00:00,autoloader,date,Recon,Standard InChIs and Keys provided by email,http://vmh.uni.lu,http://vmh.uni.lu/#metabolite/,1,0,0,none,0,Recon,2,0,100000,100000,100000,0,none,
|
|
19
|
+
28,molport,MolPort. A database designed to assist users find commercial sources of compounds. Access requires (free) registration. Only stock compounds included from Nov 2017.,15,17-OCT-2014 00:00:00,13-DEC-2018 00:00:00,autoloader,date,MolPort,"Standard InChIs and Keys provided on from MolPort ftp site, access on request.",https://www.molport.com/shop/index,https://www.molport.com/shop/molecule-link/,1,0,0,none,0,MolPort,2,0,25,30,40,1,monthly updates,
|
|
20
|
+
31,bindingdb,"A public, web-accessible database of measured binding affinities, focusing chiefly on the interactions of proteins considered to be drug-targets with small, drug-like molecules",48,27-FEB-2015 00:00:00,02-JAN-2019 00:00:00,autoloader,date,BindingDB,Standard InChIs and Keys available within a tsv file from download page.,https://www.bindingdb.org/bind/index.jsp,http://www.bindingdb.org/bind/chemsearch/marvin/MolStructure.jsp?monomerid=,1,0,0,none,0,BindingDB,2,0,27,30,34,0,Monthly updates,
|
|
21
|
+
29,nikkaji,Nakkaji (The Japan Chemical Substance Dictionary) is an organic compound dictionary database prepared by the Japan Science and Technology Agency (JST).,4,15-JAN-2015 00:00:00,09-APR-2018 00:00:00,autoloader,date,Nikkaji,Standard InChIs and Keys available from ftp site,http://jglobal.jst.go.jp/en/,http://jglobal.jst.go.jp/en/redirect?Nikkaji_No=,1,0,0,none,0,Nikkaji,2,0,350,365,380,1,annual updates,
|
|
22
|
+
32,comptox,"The foundation of chemical safety testing relies on chemistry information such as high-quality chemical structures and physicochemical properties. This information is used by scientists to predict the potential health risks of chemicals.The CompTox Dashboard is part of a suite of dashboards developed by EPA to help evaluate the safety of chemicals. It provides access to a variety of data and information on over 700,000 chemicals currently in use and of interest to environmental researchers. Within the CompTox Dashboard, users can access chemical structures, experimental and predicted physicochemical and toxicity data, and additional links to relevant websites and applications. It maps curated physicochemical property data associated with chemical substances to their corresponding chemical structures",2,12-JUL-2016 00:00:00,26-NOV-2018 00:00:00,autoloader,date,EPA (Environmental Protection Agency) CompTox Dashboard,Standard InChIs and Keys obtained from download page,https://comptox.epa.gov/dashboard/,https://comptox.epa.gov/dashboard/,1,0,0,none,0,EPA CompTox Dashboard,2,0,100000,100000,100000,0,none,
|
|
23
|
+
33,lipidmaps,"LIPID Metabolites And Pathways Strategy (LIPID MAPS) is a multi-institutional effort created to identify and quantitate, using a systems biology approach and sophisticated mass spectrometers, all of the major, and many minor, lipid species in mammalian cells, as well as to quantitate the changes in these species in response to perturbation",9,07-DEC-2016 00:00:00,07-DEC-2018 00:00:00,autoloader,date,LipidMaps,Standard InChIs and Keys obtained from download page,http://www.lipidmaps.org,http://www.lipidmaps.org/data/LMSDRecord.php?LMID=,1,0,0,none,0,LipidMaps,2,0,90,95,130,0,Quarterly,
|
|
24
|
+
35,carotenoiddb,"A Database of information on naturally occurring carotenoids from many organisms, extracted from the literature.",10,19-MAY-2017 00:00:00,11-JUL-2018 00:00:00,autoloader,date,Carotenoid Database,Standard InChIs and Keys available as a download,http://carotenoiddb.jp/index.html,http://carotenoiddb.jp/Entries/,1,0,0,none,0,CarotenoidDB,2,0,27,30,34,0,monthly,
|
|
25
|
+
36,metabolights,"A database for Metabolomics experiments and derived information. The database is cross-species, cross-technique and covers metabolite structures and their reference spectra as well as their biological roles, locations and concentrations, and experimental data from metabolic experiments.",8,12-JUN-2017 00:00:00,06-DEC-2018 00:00:00,autoloader,date,Metabolights,Standard InChIs and Keys available from FTP site,http://www.ebi.ac.uk/metabolights/,http://www.ebi.ac.uk/metabolights/,1,0,0,none,0,Metabolights,2,0,25,30,50,0,monthly,
|
|
26
|
+
37,brenda,A comprehensive Enzyme Information system containing enzyme functional data extracted directly from the primary literature.,3,03-JUL-2017 00:00:00,30-AUG-2018 00:00:00,autoloader,date,Brenda,Standard InChIKeys available as a download,http://www.brenda-enzymes.org/index.php,http://www.brenda-enzymes.org/ligand.php?brenda_ligand_id=,1,0,0,none,0,Brenda,2,1,180,190,230,0,"6 monthly, Jan and July",
|
|
27
|
+
17,pharmgkb,PharmGKB (Pharmacogenomics Knowledgebase) is a comprehensive resource that curates knowledge about the impact of genetic variation on drug response for clinicians and researchers.,20,24-APR-2013 00:00:00,06-DEC-2018 00:00:00,autoloader,date,PharmGKB,drugs.zip file from from download site https://www.pharmgkb.org/downloads/. Smiles contained in this file Converted to Std InChIs internally,http://www.pharmgkb.org,http://www.pharmgkb.org/drug/,1,0,0,none,0,PharmGKB,2,0,25,30,40,0,monthly updates,
|
|
28
|
+
18,hmdb,"The Human Metabolome Database (HMDB) is a freely available electronic database containing detailed information about small molecule metabolites found in the human body. It is intended to be used for applications in metabolomics, clinical chemistry, biomarker discovery and general education. The database is designed to contain or link three kinds of data: 1) chemical data, 2) clinical data, and 3) molecular biology/biochemistry data",10,06-JUN-2013 00:00:00,18-JUL-2018 00:00:00,autoloader,date,Human Metabolome Database (HMDB),"SD file download from source, converted to InChIs within UniChem",http://www.hmdb.ca,http://www.hmdb.ca/metabolites/,1,0,0,none,0,Human Metabolome Database,2,0,60,65,70,0,presumed to be annual,
|
|
29
|
+
24,nmrshiftdb2,"An NMR database (web database) for organic structures and their nuclear magnetic resonance (nmr) spectra. It allows for spectrum prediction (13C, 1H and other nuclei) as well as for searching spectra, structures and other properties. Last not least, it features peer-reviewed submission of datasets by its users.",58,01-MAY-2014 07:07:07,18-DEC-2018 00:00:00,autoloader,date,NMRShiftDB,Standard InChI and Keys available for download at http://nmrshiftdb.nmr.uni-koeln.de/nmrshiftdb2unichem.txt,http://nmrshiftdb.nmr.uni-koeln.de/portal/media-type/html/user/anon/page/default.psml/js_pane/P-Home,http://nmrshiftdb.org/molecule/,1,0,0,none,0,NMRShiftDB,2,0,25,30,40,0,monthly updates,
|
|
30
|
+
25,lincs,The LINCS DCIC facilitates and standardized the information relevant to LINCS assays as described in http://www.lincsproject.org/data/data-standards/,13,11-JUL-2014 00:00:00,12-SEP-2018 00:00:00,autoloader,date,Library of Integrated Network-based Cellular Signatures,Standard InChIs and Keys downloadable fromhttp://lincs-dcic.org/metadata/SmallMolecules,http://www.lincsproject.org/,http://identifiers.org/lincs.smallmolecule/,1,0,0,none,0,LINCS,2,0,90,95,130,0,quarterly updates,
|
|
31
|
+
39,chemicalbook,An online knowledge-base of chemicals and a platform of the Chinese domestic vendors in chemical industry,8,06-JUN-2018 14:00:00,03-JAN-2019 00:00:00,autoloader,date,ChemicalBook,Standard InChIs and Keys provided by email.,https://www.chemicalbook.com,https://www.chemicalbook.com/ChemicalProductProperty_EN_,1,0,0,none,0,ChemicalBook,2,0,25,30,40,0,approx 3 monthly updates,0
|
|
32
|
+
20,selleck,"Selleck Chemicals is a supplier of biochemical products, including over 1,000 inhibitor products",1,25-JUL-2013 00:00:00,26-JUL-2013 00:00:00,autoloader,date,Selleck,SD file provided by email. InChIs generated by UniChem,http://www.selleckchem.com,http://www.selleckchem.com/products/,1,1,1,Auxiliary data required to create URL. Append to bse URL instead of src_compound_id,0,Selleck,1,0,100000,100000,100000,0,Need to evaluate - currently default static set,
|
|
33
|
+
23,mcule,An online drug discovery platform with virtual screening and molecular modelling services.,2,17-JAN-2014 00:00:00,29-FEB-2016 00:00:00,autoloader,date,Mcule,Standard InChIs and Keys provided by email.,https://mcule.com,https://mcule.com/,1,0,0,none,0,Mcule,3,0,100000,100000,100000,1,quarterly updates,
|
|
34
|
+
26,actor,ACToR (Aggregated Computational Toxicology Resource),1,02-OCT-2014 00:00:00,06-OCT-2014 00:00:00,autoloader,date,ACToR,Standard InChIs and Keys generated from SMILES from DB download,https://actor.epa.gov,http://actor.epa.gov/actor/chemical.xhtml?casrn=,1,0,0,none,0,ACToR,2,0,100000,100000,100000,0,none,
|
|
35
|
+
34,drugcentral,"DrugCentral is an online drug information resource created and maintained by Division of Translational Informatics at University of New Mexico, providing information on active ingredients chemical entities, pharmaceutical products, drug mode of action, indications, pharmacologic action",5,24-FEB-2017 00:00:00,09-NOV-2018 00:00:00,autoloader,date,DrugCentral,Standard InChIs and Keys available as a download.,http://drugcentral.org,http://drugcentral.org/drugcard/,1,0,0,none,0,DrugCentral,2,0,90,95,130,0,Quarterly,
|
|
36
|
+
38,rhea,An expert curated resource of biochemical reactions designed for the annotation of enzymes and genome-scale metabolic networks and models,14,15-NOV-2017 00:00:00,14-DEC-2018 00:00:00,autoloader,date,Rhea,src_compound_ids extracted from ChEBI download file.,http://www.rhea-db.org,http://www.rhea-db.org/searchresults?q=CHEBI:,1,0,0,none,0,Rhea,2,0,29,30,32,0,monthly,
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@datagrok/bio",
|
|
3
3
|
"beta": false,
|
|
4
4
|
"friendlyName": "Bio",
|
|
5
|
-
"version": "1.7.
|
|
5
|
+
"version": "1.7.13",
|
|
6
6
|
"description": "Bio is a [package](https://datagrok.ai/help/develop/develop#packages) for the [Datagrok](https://datagrok.ai) platform",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
@@ -11,25 +11,25 @@
|
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
13
|
"@biowasm/aioli": ">=2.4.0",
|
|
14
|
-
"@datagrok-libraries/bio": "^2.8.
|
|
15
|
-
"@datagrok-libraries/
|
|
16
|
-
"@datagrok-libraries/
|
|
14
|
+
"@datagrok-libraries/bio": "^2.8.6",
|
|
15
|
+
"@datagrok-libraries/ml": "^3.0.0",
|
|
16
|
+
"@datagrok-libraries/utils": "^1.4.0",
|
|
17
17
|
"cash-dom": "latest",
|
|
18
|
-
"datagrok-api": "^1.
|
|
19
|
-
"dayjs": "
|
|
18
|
+
"datagrok-api": "^1.5.1",
|
|
19
|
+
"dayjs": "^1.11.4",
|
|
20
|
+
"openchemlib": "6.0.1",
|
|
20
21
|
"rxjs": "^6.5.5",
|
|
21
22
|
"ts-loader": "^9.2.5",
|
|
22
|
-
"typescript": "^4.4.2"
|
|
23
|
-
"openchemlib": "6.0.1"
|
|
23
|
+
"typescript": "^4.4.2"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"@types/jest": "^27.0.0",
|
|
27
27
|
"@typescript-eslint/eslint-plugin": "latest",
|
|
28
28
|
"@typescript-eslint/parser": "latest",
|
|
29
|
-
"eslint": "
|
|
29
|
+
"eslint": "^8.20.0",
|
|
30
30
|
"eslint-config-google": "latest",
|
|
31
31
|
"jest": "^27.0.0",
|
|
32
|
-
"jest-html-reporter": "^3.
|
|
32
|
+
"jest-html-reporter": "^3.6.0",
|
|
33
33
|
"puppeteer": "^13.7.0",
|
|
34
34
|
"ts-jest": "^27.0.0",
|
|
35
35
|
"webpack": "latest",
|
package/scripts/embed.py
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
#name: Embed
|
|
2
|
+
#language: python
|
|
3
|
+
#input: string molecule
|
|
4
|
+
#output: string sdf
|
|
5
|
+
|
|
6
|
+
from rdkit.Chem import AllChem
|
|
7
|
+
from rdkit import Chem
|
|
8
|
+
mol = AllChem.MolFromMolBlock(molecule) if ("M END" in molecule) else AllChem.MolFromSmiles(molecule)
|
|
9
|
+
|
|
10
|
+
AllChem.EmbedMolecule(mol, AllChem.ETKDG())
|
|
11
|
+
#AllChem.UFFOptimizeMolecule(mol)
|
|
12
|
+
#mol = Chem.RemoveHs(mol)
|
|
13
|
+
sdf = Chem.MolToMolBlock(mol)
|
package/src/const.ts
CHANGED
|
@@ -23,3 +23,8 @@ export const CAP_GROUP_NAME = 'capGroupName';
|
|
|
23
23
|
export const RGROUP_LABEL = 'label';
|
|
24
24
|
export const MONOMER_SYMBOL = 'symbol';
|
|
25
25
|
export const SDF_MONOMER_NAME = 'MonomerName';
|
|
26
|
+
|
|
27
|
+
// range of hex nubers used in PepSea library to endode monomers
|
|
28
|
+
export const MONOMER_ENCODE_MIN = 0x100;
|
|
29
|
+
export const MONOMER_ENCODE_MAX = 0x40A;
|
|
30
|
+
|
package/src/package.ts
CHANGED
|
@@ -5,6 +5,7 @@ import * as DG from 'datagrok-api/dg';
|
|
|
5
5
|
|
|
6
6
|
export const _package = new DG.Package();
|
|
7
7
|
|
|
8
|
+
import {AlignedSequenceDifferenceCellRenderer, AminoAcidsCellRenderer} from './utils/cell-renderer';
|
|
8
9
|
import {WebLogo, SeqColStats} from '@datagrok-libraries/bio/src/viewers/web-logo';
|
|
9
10
|
import {VdRegionsViewer} from './viewers/vd-regions-viewer';
|
|
10
11
|
import {runKalign, testMSAEnoughMemory} from './utils/multiple-sequence-alignment';
|
|
@@ -15,10 +16,12 @@ import {getEmbeddingColsNames, sequenceSpace} from './utils/sequence-space';
|
|
|
15
16
|
import {AvailableMetrics} from '@datagrok-libraries/ml/src/typed-metrics';
|
|
16
17
|
import {getActivityCliffs} from '@datagrok-libraries/ml/src/viewers/activity-cliffs';
|
|
17
18
|
import {sequenceGetSimilarities, drawTooltip} from './utils/sequence-activity-cliffs';
|
|
18
|
-
import {createJsonMonomerLibFromSdf, getMolfilesFromSeq, HELM_CORE_LIB_FILENAME} from './utils/utils';
|
|
19
|
+
import {createJsonMonomerLibFromSdf, encodeMonomers, getMolfilesFromSeq, HELM_CORE_LIB_FILENAME} from './utils/utils';
|
|
19
20
|
import {getMacroMol} from './utils/atomic-works';
|
|
20
21
|
import {MacromoleculeSequenceCellRenderer} from './utils/cell-renderer';
|
|
21
22
|
import {convert} from './utils/convert';
|
|
23
|
+
import {lru} from './utils/cell-renderer';
|
|
24
|
+
import {representationsWidget} from './widgets/representations';
|
|
22
25
|
|
|
23
26
|
//tags: init
|
|
24
27
|
export async function initBio(): Promise<void> {
|
|
@@ -29,6 +32,11 @@ export async function initBio(): Promise<void> {
|
|
|
29
32
|
});
|
|
30
33
|
}
|
|
31
34
|
|
|
35
|
+
//name: Lru
|
|
36
|
+
//output: object lruCache
|
|
37
|
+
export function Lru() {
|
|
38
|
+
return lru;
|
|
39
|
+
}
|
|
32
40
|
|
|
33
41
|
//name: macromoleculeSequenceCellRenderer
|
|
34
42
|
//tags: cellRenderer
|
|
@@ -104,7 +112,9 @@ export async function activityCliffs(df: DG.DataFrame, macroMolecule: DG.Column,
|
|
|
104
112
|
similarity: number, methodName: string): Promise<void> {
|
|
105
113
|
if (!checkInputColumn(macroMolecule, 'Activity Cliffs'))
|
|
106
114
|
return;
|
|
107
|
-
|
|
115
|
+
const encodedCol = encodeMonomers(macroMolecule);
|
|
116
|
+
if (!encodedCol)
|
|
117
|
+
return;
|
|
108
118
|
const axesNames = getEmbeddingColsNames(df);
|
|
109
119
|
const options = {
|
|
110
120
|
'SPE': {cycles: 2000, lambda: 1.0, dlambda: 0.0005},
|
|
@@ -113,6 +123,7 @@ export async function activityCliffs(df: DG.DataFrame, macroMolecule: DG.Column,
|
|
|
113
123
|
await getActivityCliffs(
|
|
114
124
|
df,
|
|
115
125
|
macroMolecule,
|
|
126
|
+
encodedCol,
|
|
116
127
|
axesNames,
|
|
117
128
|
'Activity cliffs',
|
|
118
129
|
activities,
|
|
@@ -138,10 +149,12 @@ export async function sequenceSpaceTopMenu(table: DG.DataFrame, macroMolecule: D
|
|
|
138
149
|
similarityMetric: string = 'Levenshtein', plotEmbeddings: boolean): Promise<void> {
|
|
139
150
|
if (!checkInputColumn(macroMolecule, 'Activity Cliffs'))
|
|
140
151
|
return;
|
|
141
|
-
|
|
152
|
+
const encodedCol = encodeMonomers(macroMolecule);
|
|
153
|
+
if (!encodedCol)
|
|
154
|
+
return;
|
|
142
155
|
const embedColsNames = getEmbeddingColsNames(table);
|
|
143
156
|
const chemSpaceParams = {
|
|
144
|
-
seqCol:
|
|
157
|
+
seqCol: encodedCol,
|
|
145
158
|
methodName: methodName,
|
|
146
159
|
similarityMetric: similarityMetric,
|
|
147
160
|
embedAxesNames: embedColsNames
|
|
@@ -267,6 +280,17 @@ function parseMacromolecule(
|
|
|
267
280
|
return seqArray.join('');
|
|
268
281
|
}
|
|
269
282
|
|
|
283
|
+
//name: Representations
|
|
284
|
+
//tags: panel, widgets
|
|
285
|
+
//input: cell macroMolecule {semType: Macromolecule}
|
|
286
|
+
//output: widget result
|
|
287
|
+
export async function peptideMolecule(macroMolecule: DG.Cell): Promise<DG.Widget> {
|
|
288
|
+
const monomersLibFile = await _package.files.readAsText(HELM_CORE_LIB_FILENAME);
|
|
289
|
+
const monomersLibObject: any[] = JSON.parse(monomersLibFile);
|
|
290
|
+
|
|
291
|
+
return representationsWidget(macroMolecule, monomersLibObject);
|
|
292
|
+
}
|
|
293
|
+
|
|
270
294
|
//name: importFasta
|
|
271
295
|
//description: Opens FASTA file
|
|
272
296
|
//tags: file-handler
|
|
@@ -340,3 +364,69 @@ export function importFasta(fileContent: string): DG.DataFrame [] {
|
|
|
340
364
|
export function convertPanel(col: DG.Column): void {
|
|
341
365
|
convert(col);
|
|
342
366
|
}
|
|
367
|
+
|
|
368
|
+
//name: aminoAcidsCellRenderer
|
|
369
|
+
//tags: cellRenderer
|
|
370
|
+
//meta.cellType: aminoAcids
|
|
371
|
+
//output: grid_cell_renderer result
|
|
372
|
+
export function aminoAcidsCellRenderer(): AminoAcidsCellRenderer {
|
|
373
|
+
return new AminoAcidsCellRenderer();
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
//name: alignedSequenceDifferenceCellRenderer
|
|
377
|
+
//tags: cellRenderer
|
|
378
|
+
//meta.cellType: alignedSequenceDifference
|
|
379
|
+
//output: grid_cell_renderer result
|
|
380
|
+
export function alignedSequenceDifferenceCellRenderer(): AlignedSequenceDifferenceCellRenderer {
|
|
381
|
+
return new AlignedSequenceDifferenceCellRenderer();
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
//name: testDetectMacromolecule
|
|
385
|
+
//input: string path {choices: ['Demo:Files/', 'System:AppData/']}
|
|
386
|
+
//output: dataframe result
|
|
387
|
+
export async function testDetectMacromolecule(path: string): Promise<DG.DataFrame> {
|
|
388
|
+
const pi = DG.TaskBarProgressIndicator.create('Test detectMacromolecule...');
|
|
389
|
+
|
|
390
|
+
const fileList = await grok.dapi.files.list(path, true, '');
|
|
391
|
+
const fileListToTest = fileList.filter((fi) => fi.fileName.endsWith('.csv'));
|
|
392
|
+
|
|
393
|
+
let readyCount = 0;
|
|
394
|
+
const res = [];
|
|
395
|
+
|
|
396
|
+
for (const fileInfo of fileListToTest) {
|
|
397
|
+
try {
|
|
398
|
+
const csv = await grok.dapi.files.readAsText(path + fileInfo.fullPath);
|
|
399
|
+
const df = DG.DataFrame.fromCsv(csv);
|
|
400
|
+
|
|
401
|
+
for (const col of df.columns) {
|
|
402
|
+
const semType = await grok.functions.call('Bio:detectMacromolecule', {col: col});
|
|
403
|
+
if (semType === DG.SEMTYPE.MACROMOLECULE) {
|
|
404
|
+
//console.warn(`file: ${fileInfo.path}, column: ${col.name}, ` +
|
|
405
|
+
// `semType: ${semType}, units: ${col.getTag(DG.TAGS.UNITS)}`);
|
|
406
|
+
// console.warn('file: "' + fileInfo.path + '", semType: "' + semType + '", ' +
|
|
407
|
+
// 'units: "' + col.getTag('units') + '"');
|
|
408
|
+
|
|
409
|
+
res.push({
|
|
410
|
+
file: fileInfo.path, result: 'detected', column: col.name,
|
|
411
|
+
message: `units: ${col.getTag('units')}`
|
|
412
|
+
});
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
} catch (err: unknown) {
|
|
416
|
+
// console.error('file: ' + fileInfo.path + ', error: ' + ex.toString());
|
|
417
|
+
res.push({
|
|
418
|
+
file: fileInfo.path, result: 'error', column: null,
|
|
419
|
+
message: err instanceof Error ? err.message : (err as Object).toString(),
|
|
420
|
+
});
|
|
421
|
+
} finally {
|
|
422
|
+
readyCount += 1;
|
|
423
|
+
pi.update(100 * readyCount / fileListToTest.length, `Test ${fileInfo.fileName}`);
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
grok.shell.info('Test Demo:Files for detectMacromolecule finished.');
|
|
428
|
+
pi.close();
|
|
429
|
+
const resDf = DG.DataFrame.fromObjects(res)!;
|
|
430
|
+
resDf.name = `datasets_detectMacromolecule_${path}`;
|
|
431
|
+
return resDf;
|
|
432
|
+
}
|
|
@@ -7,6 +7,7 @@ import {readDataframe} from './utils';
|
|
|
7
7
|
import {getEmbeddingColsNames, sequenceSpace} from '../utils/sequence-space';
|
|
8
8
|
import {drawTooltip, sequenceGetSimilarities} from '../utils/sequence-activity-cliffs';
|
|
9
9
|
import {getActivityCliffs} from '@datagrok-libraries/ml/src/viewers/activity-cliffs';
|
|
10
|
+
import { encodeMonomers } from '../utils/utils';
|
|
10
11
|
|
|
11
12
|
|
|
12
13
|
category('activityCliffs', async () => {
|
|
@@ -31,9 +32,11 @@ category('activityCliffs', async () => {
|
|
|
31
32
|
const options = {
|
|
32
33
|
'SPE': {cycles: 2000, lambda: 1.0, dlambda: 0.0005},
|
|
33
34
|
};
|
|
35
|
+
const encodedCol = encodeMonomers(actCliffsDf.col('MSA')!) as DG.Column;
|
|
34
36
|
const scatterPlot = await getActivityCliffs(
|
|
35
37
|
actCliffsDf,
|
|
36
38
|
actCliffsDf.col('MSA')!,
|
|
39
|
+
encodedCol,
|
|
37
40
|
axesNames,
|
|
38
41
|
'Activity cliffs',
|
|
39
42
|
actCliffsDf.col('Activity')!,
|
|
@@ -4,7 +4,8 @@ import * as grok from 'datagrok-api/grok';
|
|
|
4
4
|
import * as DG from 'datagrok-api/dg';
|
|
5
5
|
|
|
6
6
|
import {ConverterFunc} from './types';
|
|
7
|
-
import {
|
|
7
|
+
import {NotationConverter} from '@datagrok-libraries/bio/src/utils/notation-converter';
|
|
8
|
+
import {NOTATION} from '@datagrok-libraries/bio/src/utils/units-handler';
|
|
8
9
|
|
|
9
10
|
// import {mmSemType} from '../const';
|
|
10
11
|
// import {importFasta} from '../package';
|
|
@@ -25,7 +26,14 @@ category('converters', () => {
|
|
|
25
26
|
|
|
26
27
|
fastaGaps = 'fastaGaps',
|
|
27
28
|
separatorGaps = 'separatorGaps',
|
|
28
|
-
helmGaps = 'helmGaps'
|
|
29
|
+
helmGaps = 'helmGaps',
|
|
30
|
+
|
|
31
|
+
helmLoneDeoxyribose = 'helmLoneDeoxyribose',
|
|
32
|
+
helmLoneRibose = 'helmLoneRibose',
|
|
33
|
+
helmLonePhosphorus = 'helmLonePhosphorus',
|
|
34
|
+
fastaLoneDeoxyribose = 'fastaLoneDeoxyribose',
|
|
35
|
+
fastaLoneRibose = 'fastaLoneRibose',
|
|
36
|
+
fastaLonePhosphorus = 'fastaLonePhosphorus',
|
|
29
37
|
}
|
|
30
38
|
|
|
31
39
|
const _csvTxts: { [key: string]: string } = {
|
|
@@ -74,7 +82,6 @@ RNA1{R(A)P.R(C)P.R(G)P.R(U)P.R(C)P}$$$
|
|
|
74
82
|
RNA1{R(C)P.R(A)P.R(G)P.R(U)P.R(G)P.R(U)P}$$$
|
|
75
83
|
RNA1{R(U)P.R(U)P.R(C)P.R(A)P.R(A)P.R(C)P}$$$
|
|
76
84
|
`,
|
|
77
|
-
|
|
78
85
|
fastaGaps: `seq
|
|
79
86
|
FW-PH-EYY
|
|
80
87
|
FYNRQWYV-
|
|
@@ -89,6 +96,21 @@ F/K/P//Q//S/E/Y/V
|
|
|
89
96
|
PEPTIDE1{F.W.*.P.H.*.E.Y.Y}$$$
|
|
90
97
|
PEPTIDE1{F.Y.N.R.Q.W.Y.V.*}$$$
|
|
91
98
|
PEPTIDE1{F.K.P.*.Q.*.S.E.Y.V}$$$
|
|
99
|
+
`,
|
|
100
|
+
helmLoneDeoxyribose: `seq
|
|
101
|
+
DNA1{D(A).D(C).D(G).D(T).D(C)}$$$
|
|
102
|
+
DNA1{D(C).D(A).D(G).D(T).D(G).D(T)P}$$$
|
|
103
|
+
DNA1{D(T).D(T).D(C).D(A).D(A).D(C)P}$$$
|
|
104
|
+
`,
|
|
105
|
+
helmLoneRibose: `seq
|
|
106
|
+
RNA1{R(A).R(C).R(G).R(U).R(C)}$$$
|
|
107
|
+
RNA1{R(C).R(A).R(G).R(U).R(G).R(U)P}$$$
|
|
108
|
+
RNA1{R(U).R(U).R(C).R(A).R(A).R(C)P}$$$
|
|
109
|
+
`,
|
|
110
|
+
helmLonePhosphorus: `seq
|
|
111
|
+
RNA1{P.P.R(A)P.R(C)P.R(G)P.R(U)P.R(C)P}$$$
|
|
112
|
+
RNA1{P.P.R(C)P.R(A)P.P.R(G)P.R(U)P.R(G)P.R(U)P}$$$
|
|
113
|
+
RNA1{P.R(U)P.R(U)P.R(C)P.R(A)P.R(A)P.R(C)P.P.P}$$$
|
|
92
114
|
`,
|
|
93
115
|
};
|
|
94
116
|
|
|
@@ -195,24 +217,35 @@ PEPTIDE1{F.K.P.*.Q.*.S.E.Y.V}$$$
|
|
|
195
217
|
|
|
196
218
|
// HELM tests
|
|
197
219
|
// helm -> fasta
|
|
198
|
-
test('
|
|
220
|
+
test('testHelmDnaToFasta', async () => {
|
|
199
221
|
await _testConvert(Samples.helmDna, converter(NOTATION.FASTA), Samples.fastaDna);
|
|
200
222
|
});
|
|
201
|
-
test('
|
|
223
|
+
test('testHelmRnaToFasta', async () => {
|
|
202
224
|
await _testConvert(Samples.helmRna, converter(NOTATION.FASTA), Samples.fastaRna);
|
|
203
225
|
});
|
|
204
|
-
test('
|
|
226
|
+
test('testHelmPtToFasta', async () => {
|
|
205
227
|
await _testConvert(Samples.helmPt, converter(NOTATION.FASTA), Samples.fastaPt);
|
|
206
228
|
});
|
|
207
229
|
|
|
208
230
|
// helm -> separator
|
|
209
|
-
test('
|
|
231
|
+
test('testHelmDnaToSeparator', async () => {
|
|
210
232
|
await _testConvert(Samples.helmDna, converter(NOTATION.SEPARATOR, '/'), Samples.separatorDna);
|
|
211
233
|
});
|
|
212
|
-
test('
|
|
234
|
+
test('testHelmRnaToSeparator', async () => {
|
|
213
235
|
await _testConvert(Samples.helmRna, converter(NOTATION.SEPARATOR, '*'), Samples.separatorRna);
|
|
214
236
|
});
|
|
215
|
-
test('
|
|
237
|
+
test('testHelmPtToSeparator', async () => {
|
|
216
238
|
await _testConvert(Samples.helmPt, converter(NOTATION.SEPARATOR, '-'), Samples.separatorPt);
|
|
217
239
|
});
|
|
240
|
+
|
|
241
|
+
// helm miscellaneous
|
|
242
|
+
test('testHelmLoneRibose', async () => {
|
|
243
|
+
await _testConvert(Samples.helmLoneRibose, converter(NOTATION.FASTA), Samples.fastaRna);
|
|
244
|
+
});
|
|
245
|
+
test('testHelmLoneDeoxyribose', async () => {
|
|
246
|
+
await _testConvert(Samples.helmLoneDeoxyribose, converter(NOTATION.SEPARATOR, '/'), Samples.separatorDna);
|
|
247
|
+
});
|
|
248
|
+
test('testHelmLonePhosphorus', async () => {
|
|
249
|
+
await _testConvert(Samples.helmLonePhosphorus, converter(NOTATION.FASTA), Samples.fastaRna);
|
|
250
|
+
});
|
|
218
251
|
});
|
|
@@ -115,6 +115,8 @@ MWRSWY-CKHP
|
|
|
115
115
|
testSmiles2Csv = 'testSmiles2Csv',
|
|
116
116
|
testCerealCsv = 'testCerealCsv',
|
|
117
117
|
testActivityCliffsCsv = 'testActivityCliffsCsv',
|
|
118
|
+
testSpgi100 = 'testSpgi100',
|
|
119
|
+
testUnichemSources = 'testUnichemSources',
|
|
118
120
|
}
|
|
119
121
|
|
|
120
122
|
const samples: { [key: string]: string } = {
|
|
@@ -132,6 +134,8 @@ MWRSWY-CKHP
|
|
|
132
134
|
'testSmiles2Csv': 'System:AppData/Bio/tests/testSmiles2.csv',
|
|
133
135
|
'testActivityCliffsCsv': 'System:AppData/Bio/tests/testActivityCliffs.csv', // smiles
|
|
134
136
|
'testCerealCsv': 'System:AppData/Bio/tests/testCereal.csv',
|
|
137
|
+
'testSpgi100': 'System:AppData/Bio/tests/testSpgi100.csv',
|
|
138
|
+
'testUnichemSources': 'System:AppData/Bio/tests/testUnichemSources.csv',
|
|
135
139
|
};
|
|
136
140
|
|
|
137
141
|
const _samplesDfs: { [key: string]: Promise<DG.DataFrame> } = {};
|
|
@@ -141,7 +145,7 @@ MWRSWY-CKHP
|
|
|
141
145
|
if (!(key in _samplesDfs)) {
|
|
142
146
|
_samplesDfs[key] = (async (): Promise<DG.DataFrame> => {
|
|
143
147
|
const df: DG.DataFrame = await readFile(samples[key]);
|
|
144
|
-
await grok.data.detectSemanticTypes(df);
|
|
148
|
+
// await grok.data.detectSemanticTypes(df);
|
|
145
149
|
return df;
|
|
146
150
|
})();
|
|
147
151
|
}
|
|
@@ -318,19 +322,48 @@ MWRSWY-CKHP
|
|
|
318
322
|
test('samplesTestCerealNegativeCerealName', async () => {
|
|
319
323
|
await _testNeg(readSamples(Samples.testCerealCsv), 'cereal_name');
|
|
320
324
|
});
|
|
325
|
+
|
|
326
|
+
test('samplesTestSpgi100NegativeStereoCategory', async () => {
|
|
327
|
+
await _testNeg(readSamples(Samples.testSpgi100), 'Stereo Category');
|
|
328
|
+
});
|
|
329
|
+
test('samplesTestSpgi100NegativeScaffoldNames', async () => {
|
|
330
|
+
await _testNeg(readSamples(Samples.testSpgi100), 'Scaffold Names');
|
|
331
|
+
});
|
|
332
|
+
test('samplesTestSpgi100NegativePrimaryScaffoldName', async () => {
|
|
333
|
+
await _testNeg(readSamples(Samples.testSpgi100), 'Primary Scaffold Name');
|
|
334
|
+
});
|
|
335
|
+
|
|
336
|
+
test('samplesTestUnichemSourcesNegativeSrcUrl', async () => {
|
|
337
|
+
await _testNeg(readSamples(Samples.testUnichemSources), 'src_url');
|
|
338
|
+
});
|
|
339
|
+
test('samplesTestUnichemSourcesNegativeBaseIdUrl', async () => {
|
|
340
|
+
await _testNeg(readSamples(Samples.testUnichemSources), 'base_id_url');
|
|
341
|
+
});
|
|
321
342
|
});
|
|
322
343
|
|
|
323
344
|
export async function _testNeg(readDf: DfReaderFunc, colName: string) {
|
|
324
345
|
const df: DG.DataFrame = await readDf();
|
|
325
|
-
|
|
326
346
|
const col: DG.Column = df.col(colName)!;
|
|
327
|
-
|
|
347
|
+
const semType: string = await grok.functions.call('Bio:detectMacromolecule', {col: col});
|
|
348
|
+
if (semType)
|
|
349
|
+
col.semType = semType;
|
|
350
|
+
|
|
351
|
+
if (col.semType === DG.SEMTYPE.MACROMOLECULE) {
|
|
352
|
+
const msg = `Negative test detected semType='${col.semType}', units='${col.getTag(DG.TAGS.UNITS)}'.`;
|
|
353
|
+
throw new Error(msg);
|
|
354
|
+
// col.semType = '';
|
|
355
|
+
// col.setTag(DG.TAGS.UNITS, '');
|
|
356
|
+
// col.setTag('separator', '');
|
|
357
|
+
}
|
|
328
358
|
}
|
|
329
359
|
|
|
330
360
|
export async function _testPos(readDf: DfReaderFunc, colName: string, units: string, separator: string | null = null) {
|
|
331
361
|
const df: DG.DataFrame = await readDf();
|
|
332
|
-
|
|
333
362
|
const col: DG.Column = df.col(colName)!;
|
|
363
|
+
const semType: string = await grok.functions.call('Bio:detectMacromolecule', {col: col});
|
|
364
|
+
if (semType)
|
|
365
|
+
col.semType = semType;
|
|
366
|
+
|
|
334
367
|
expect(col.semType === DG.SEMTYPE.MACROMOLECULE, true);
|
|
335
368
|
expect(col.getTag(DG.TAGS.UNITS), units);
|
|
336
369
|
if (separator)
|
|
@@ -5,7 +5,7 @@ import * as DG from 'datagrok-api/dg';
|
|
|
5
5
|
import {importFasta, multipleSequenceAlignmentAny} from '../package';
|
|
6
6
|
import {readDataframe} from './utils';
|
|
7
7
|
import {convertDo} from '../utils/convert';
|
|
8
|
-
import {NOTATION} from '@datagrok-libraries/bio/src/utils/
|
|
8
|
+
import {NOTATION} from '@datagrok-libraries/bio/src/utils/units-handler';
|
|
9
9
|
|
|
10
10
|
category('renderers', () => {
|
|
11
11
|
let tvList: DG.TableView[];
|
|
@@ -7,7 +7,7 @@ import {SplitterFunc, WebLogo} from '@datagrok-libraries/bio/src/viewers/web-log
|
|
|
7
7
|
import {SeqPalette} from '@datagrok-libraries/bio/src/seq-palettes';
|
|
8
8
|
import * as ui from 'datagrok-api/ui';
|
|
9
9
|
|
|
10
|
-
const lru = new DG.LruCache<any, any>();
|
|
10
|
+
export const lru = new DG.LruCache<any, any>();
|
|
11
11
|
const undefinedColor = 'rgb(100,100,100)';
|
|
12
12
|
const grayColor = '#808080'
|
|
13
13
|
|
|
@@ -155,6 +155,11 @@ export class MacromoleculeSequenceCellRenderer extends DG.GridCellRenderer {
|
|
|
155
155
|
if (!formula) {
|
|
156
156
|
gridCell.element = ui.divText(gridCell.cell.value, {style: {color: 'red'}});
|
|
157
157
|
}
|
|
158
|
+
const molWeight = Math.round(canvas.getMolWeight() * 100) / 100;
|
|
159
|
+
const coef = Math.round(canvas.getExtinctionCoefficient(true) * 100) / 100;
|
|
160
|
+
const molfile = canvas.getMolfile();
|
|
161
|
+
const result = formula + ', ' + molWeight + ', ' + coef + ', ' + molfile;
|
|
162
|
+
lru.set(gridCell.cell.value, result);
|
|
158
163
|
return;
|
|
159
164
|
}
|
|
160
165
|
if (monomers.size > 0) {
|
|
@@ -222,3 +227,111 @@ export class MacromoleculeSequenceCellRenderer extends DG.GridCellRenderer {
|
|
|
222
227
|
}
|
|
223
228
|
}
|
|
224
229
|
}
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
export class AminoAcidsCellRenderer extends DG.GridCellRenderer {
|
|
233
|
+
get name(): string {return 'aminoAcidsCR';}
|
|
234
|
+
|
|
235
|
+
get cellType(): string {return C.SEM_TYPES.AMINO_ACIDS;}
|
|
236
|
+
|
|
237
|
+
get defaultHeight(): number {return 15;}
|
|
238
|
+
|
|
239
|
+
get defaultWidth(): number {return 30;}
|
|
240
|
+
|
|
241
|
+
/**
|
|
242
|
+
* Cell renderer function.
|
|
243
|
+
*
|
|
244
|
+
* @param {CanvasRenderingContext2D} g Canvas rendering context.
|
|
245
|
+
* @param {number} x x coordinate on the canvas.
|
|
246
|
+
* @param {number} y y coordinate on the canvas.
|
|
247
|
+
* @param {number} w width of the cell.
|
|
248
|
+
* @param {number} h height of the cell.
|
|
249
|
+
* @param {DG.GridCell} gridCell Grid cell.
|
|
250
|
+
* @param {DG.GridCellStyle} cellStyle Cell style.
|
|
251
|
+
*/
|
|
252
|
+
render(
|
|
253
|
+
g: CanvasRenderingContext2D, x: number, y: number, w: number, h: number, gridCell: DG.GridCell,
|
|
254
|
+
cellStyle: DG.GridCellStyle): void {
|
|
255
|
+
y -= 2;
|
|
256
|
+
g.save();
|
|
257
|
+
g.beginPath();
|
|
258
|
+
g.rect(x, y, w, h);
|
|
259
|
+
g.clip();
|
|
260
|
+
g.font = `12px monospace`;
|
|
261
|
+
g.textBaseline = 'top';
|
|
262
|
+
|
|
263
|
+
const palette = getPalleteByType(gridCell.tableColumn!.tags[C.TAGS.ALPHABET]);
|
|
264
|
+
const s: string = gridCell.cell.value ? gridCell.cell.value : '-';
|
|
265
|
+
const color = palette.get(s);
|
|
266
|
+
|
|
267
|
+
printLeftOrCentered(x, y, w, h, g, s, color, 0, false);
|
|
268
|
+
g.restore();
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
export class AlignedSequenceDifferenceCellRenderer extends DG.GridCellRenderer {
|
|
273
|
+
get name(): string {return 'alignedSequenceDifferenceCR';}
|
|
274
|
+
|
|
275
|
+
get cellType(): string {return C.SEM_TYPES.ALIGNED_SEQUENCE_DIFFERENCE;}
|
|
276
|
+
|
|
277
|
+
get defaultHeight(): number {return 30;}
|
|
278
|
+
|
|
279
|
+
get defaultWidth(): number {return 230;}
|
|
280
|
+
|
|
281
|
+
/**
|
|
282
|
+
* Cell renderer function.
|
|
283
|
+
*
|
|
284
|
+
* @param {CanvasRenderingContext2D} g Canvas rendering context.
|
|
285
|
+
* @param {number} x x coordinate on the canvas.
|
|
286
|
+
* @param {number} y y coordinate on the canvas.
|
|
287
|
+
* @param {number} w width of the cell.
|
|
288
|
+
* @param {number} h height of the cell.
|
|
289
|
+
* @param {DG.GridCell} gridCell Grid cell.
|
|
290
|
+
* @param {DG.GridCellStyle} cellStyle Cell style.
|
|
291
|
+
* @memberof AlignedSequenceDifferenceCellRenderer
|
|
292
|
+
*/
|
|
293
|
+
render(
|
|
294
|
+
g: CanvasRenderingContext2D, x: number, y: number, w: number, h: number, gridCell: DG.GridCell,
|
|
295
|
+
cellStyle: DG.GridCellStyle): void {
|
|
296
|
+
const grid = gridCell.grid;
|
|
297
|
+
const cell = gridCell.cell;
|
|
298
|
+
|
|
299
|
+
w = grid ? Math.min(grid.canvas.width - x, w) : g.canvas.width - x;
|
|
300
|
+
g.save();
|
|
301
|
+
g.beginPath();
|
|
302
|
+
g.rect(x, y, w, h);
|
|
303
|
+
g.clip();
|
|
304
|
+
g.font = '12px monospace';
|
|
305
|
+
g.textBaseline = 'top';
|
|
306
|
+
const s: string = cell.value ?? '';
|
|
307
|
+
|
|
308
|
+
//TODO: can this be replaced/merged with splitSequence?
|
|
309
|
+
const [s1, s2] = s.split('#');
|
|
310
|
+
const separator = gridCell.tableColumn!.tags[C.TAGS.SEPARATOR];
|
|
311
|
+
const subParts1 = s1.split(separator);
|
|
312
|
+
const subParts2 = s2.split(separator);
|
|
313
|
+
const [text] = processSequence(subParts1);
|
|
314
|
+
const textSize = g.measureText(text.join(''));
|
|
315
|
+
let updatedX = Math.max(x, x + (w - (textSize.width + subParts1.length * 4)) / 2);
|
|
316
|
+
// 28 is the height of the two substitutions on top of each other + space
|
|
317
|
+
const updatedY = Math.max(y, y + (h - 28) / 2);
|
|
318
|
+
|
|
319
|
+
const palette = getPalleteByType(gridCell.tableColumn!.tags[C.TAGS.ALPHABET]);
|
|
320
|
+
for (let i = 0; i < subParts1.length; i++) {
|
|
321
|
+
const amino1 = subParts1[i]
|
|
322
|
+
const amino2 = subParts2[i];
|
|
323
|
+
const color1 = palette.get(amino1);
|
|
324
|
+
const color2 = palette.get(amino2);
|
|
325
|
+
|
|
326
|
+
if (amino1 != amino2) {
|
|
327
|
+
const vShift = 7;
|
|
328
|
+
const subX0 = printLeftOrCentered(updatedX, updatedY - vShift, w, h, g, amino1, color1, 0, true);
|
|
329
|
+
const subX1 = printLeftOrCentered(updatedX, updatedY + vShift, w, h, g, amino2, color2, 0, true);
|
|
330
|
+
updatedX = Math.max(subX1, subX0);
|
|
331
|
+
} else
|
|
332
|
+
updatedX = printLeftOrCentered(updatedX, updatedY, w, h, g, amino1, color1, 0, true, 0.5);
|
|
333
|
+
updatedX += 4;
|
|
334
|
+
}
|
|
335
|
+
g.restore();
|
|
336
|
+
}
|
|
337
|
+
}
|
package/src/utils/constants.ts
CHANGED