├── README.md ├── ambit-json-docs ├── README.md ├── algorithm.md ├── bundle.md ├── dataset.md ├── feature.md ├── model.md ├── query.md ├── restpolicy.md ├── substance.md ├── substance_dataset.md ├── substance_property.md ├── substance_withstudysummary.md └── toxtree.md ├── appdomain-example └── README.md ├── examples-ml ├── pom.xml └── src │ └── main │ ├── java │ └── net │ │ └── idea │ │ └── examples │ │ └── ml │ │ └── ClusteringApp.java │ └── resources │ └── META-INF │ └── MANIFEST.MF ├── excapedb ├── excapedb.ipynb └── logging_config.ini ├── molbrowser ├── README.md ├── pom.xml └── src │ └── main │ ├── java │ └── net │ │ └── idea │ │ └── ambit │ │ └── molbrowser │ │ ├── MainApp.java │ │ └── MolbrowserWizard.java │ └── resources │ ├── META-INF │ └── MANIFEST.MF │ └── webapp │ ├── 24x24_ambit.gif │ ├── favicon.ico │ ├── index.html │ ├── scripts │ ├── jquery-1.7.1.min.js │ ├── jquery-ui-1.8.18.custom.min.js │ ├── jquery.dataTables-1.9.0.min.js │ └── molbrowser.js │ └── styles │ ├── ambit.css │ ├── base.css │ ├── images │ ├── ui-bg_glass_55_bcf903_1x400.png │ ├── ui-bg_gloss-wave_100_ece8da_500x100.png │ ├── ui-bg_highlight-hard_100_fafaf4_1x100.png │ ├── ui-bg_highlight-hard_100_ffffff_1x100.png │ ├── ui-bg_highlight-hard_15_86ad2d_1x100.png │ ├── ui-bg_highlight-hard_95_cccccc_1x100.png │ ├── ui-bg_highlight-soft_25_bcf903_1x100.png │ ├── ui-bg_highlight-soft_95_ffedad_1x100.png │ ├── ui-bg_inset-soft_15_2b2922_1x100.png │ ├── ui-icons_516473_256x240.png │ ├── ui-icons_847e71_256x240.png │ ├── ui-icons_8dc262_256x240.png │ ├── ui-icons_cd0a0a_256x240.png │ └── ui-icons_eeeeee_256x240.png │ ├── jquery-ui-1.8.18.custom.css │ ├── jquery.dataTables.css │ ├── layout.css │ └── skeleton.css ├── smirks-example ├── Readme.md ├── pom.xml ├── src │ ├── main │ │ ├── java │ │ │ └── net │ │ │ │ └── idea │ │ │ │ └── examples │ │ │ │ └── ambit │ │ │ │ └── smirks │ │ │ │ ├── ChemWizard.java │ │ │ │ └── MainApp.java │ │ └── resources │ │ │ ├── META-INF │ │ │ └── MANIFEST.MF │ │ │ └── net │ │ │ └── idea │ │ │ └── examples │ │ │ ├── ambit │ │ │ └── smirks │ │ │ │ └── example1.properties │ │ │ ├── lacticacid.sdf │ │ │ └── test.sdf │ ├── site │ │ ├── apt │ │ │ └── index.apt │ │ ├── resources │ │ │ └── images │ │ │ │ └── ideaconsult_80.png │ │ └── site.xml │ └── test │ │ └── java │ │ └── net │ │ └── idea │ │ └── examples │ │ └── ambit │ │ └── smirks │ │ ├── SMARTSTest.java │ │ └── SmilesTest.java └── toxtree-metabolites.png ├── standardize ├── ambit_standardize_demo.ipynb ├── test.txt └── test_std.txt ├── tautomers-example ├── ChangeLog.md ├── README.md ├── docs.md ├── pom.xml └── src │ ├── main │ ├── java │ │ └── net │ │ │ └── idea │ │ │ └── example │ │ │ └── ambit │ │ │ ├── tautomers │ │ │ ├── GenerationParameters.java │ │ │ ├── MainApp.java │ │ │ ├── TautomerWizard.java │ │ │ └── ZwitterionCli.java │ │ │ └── writers │ │ │ └── RDFTautomersWriter.java │ └── resources │ │ ├── META-INF │ │ └── MANIFEST.MF │ │ └── logging.properties │ └── test │ ├── java │ └── net │ │ └── idea │ │ └── example │ │ └── ambit │ │ └── tautomers │ │ └── TautomersTest.java │ └── resources │ ├── MolInf2013 │ ├── AmbitTatutomersSet1.zip │ ├── AmbitTautomersSet2.zip │ ├── AmbitTautomersSet3.zip │ ├── AmbitTautomersSet4.zip │ ├── AmbitTautomersSet5.zip │ ├── AmbitTautomersSet6.zip │ └── README.md │ └── net │ └── idea │ └── example │ └── ambit │ └── tautomers │ ├── drugbank_error.sdf │ ├── inchi.txt │ └── input.sdf └── tautomers-jmh ├── README.md ├── pom.xml └── src └── main ├── java └── net │ └── idea │ └── benchmark │ └── TautomersBenchmark.java └── resources └── net └── idea └── benchmark ├── CHEMBL2373570.sdf └── warfarin.mol /README.md: -------------------------------------------------------------------------------- 1 | AMBITexamples 2 | ============== 3 | 4 | This project consists of examples how to call [AMBIT](http://ambit.sourceforge.net/ "AMBIT") modules from Java code. 5 | 6 | AMBIT source code and site is at [Sourceforge.net](http://ambit.sourceforge.net/) 7 | 8 | AMBIT publications http://ambit.sourceforge.net/pubs_citeambit.html 9 | 10 | AMBIT Web REST services 11 | --- 12 | 13 | * Publication [doi:10.1186/1758-2946-3-18](http://www.jcheminf.com/content/3/1/18) 14 | 15 | * Download http://ambit.sourceforge.net/download_ambitrest.html 16 | 17 | * ambit2-www.war at [Maven repository](https://nexus.ideaconsult.net/index.html#nexus-search;quick~ambit2-www) 18 | 19 | * OpenTox API [examples](http://ambit.sourceforge.net/api.html) 20 | 21 | * Ambit [JSON extension](https://github.com/ideaconsult/examples-ambit/tree/master/ambit-json-docs) of OpenTox API 22 | 23 | * Ambit/OpenTox REST API client library https://github.com/ideaconsult/opentox-cli 24 | 25 | * [Ambit API documentation ](http://ideaconsult.github.io/examples-ambit/apidocs/) 26 | 27 | 28 | 29 | SMARTS (and SMIRKS) 30 | --- 31 | 32 | * Publication [doi:10.1002/minf.201100028](http://onlinelibrary.wiley.com/doi/10.1002/minf.201100028/abstract) 33 | 34 | * Ambit2-SMARTS examples at http://ambit.sourceforge.net/AMBIT2-LIBS/ambit2-smarts/index.html 35 | 36 | * ambit2-smarts.jar at [Maven repository](https://nexus.ideaconsult.net/index.html#nexus-search;quick%7Eambit2-smarts) 37 | 38 | Tautomers generation 39 | --- 40 | 41 | * Publication [doi:10.1002/minf.201200133](http://onlinelibrary.wiley.com/doi/10.1002/minf.201200133/abstract) and EuroQSAR 2012 [poster](http://www.slideshare.net/jeliazkova_nina/ambittautomer-an-open-source-tool-for-tautomer-generation) 42 | 43 | * Code example and a command line application at [tautomers-example](https://github.com/ideaconsult/examples-ambit/tree/master/tautomers-example) 44 | 45 | * Ambit2-tautomer module at [Sourceforge.net](http://ambit.sourceforge.net/AMBIT2-LIBS/ambit2-tautomers/index.html). 46 | 47 | * ambit2-tautomer.jar [download](https://sourceforge.net/projects/ambit/files/Ambit2/AMBIT_modules/2.4.11/) 48 | 49 | * ambit2-tautomer.jar at [Maven repository](https://nexus.ideaconsult.net/index.html#nexus-search;quick%7Eambit2-tautomer) 50 | 51 | Chemical structure standardization 52 | --- 53 | 54 | * Code example : Jupyter notebook [standardize/ambit_standardize_demo.ipynb](standardize/ambit_standardize_demo.ipynb) 55 | 56 | Applicability domain command line appliction 57 | --- 58 | 59 | * https://github.com/ideaconsult/examples-ambit/tree/master/appdomain-example 60 | 61 | JavaScript Molecular browser 62 | --- 63 | 64 | * Publishing a chemical dataset online is easy - just convert SDF file to [JSON](http://www.json.org/) and a folder of images with [molbrowser command line application](https://github.com/ideaconsult/examples-ambit/tree/master/molbrowser). 65 | 66 | * Try it at http://ideaconsult.github.io/examples-ambit/molbrowser/ 67 | 68 | 69 | More examples 70 | ---------------- 71 | 72 | * Coming soon! 73 | 74 | 75 | -------------------------------------------------------------------------------- /ambit-json-docs/README.md: -------------------------------------------------------------------------------- 1 | ## OpenTox REST API 2 | 3 | [OpenTox](http://opentox.org) is an European Commission Framework Program 7 funded project (2008-2011), 4 | aims to develop distributed framework for predictive toxicology. 5 | The building blocks considered are : data, chemical structures, algorithms and models. 6 | The framework allows to build models, apply models, validate models, access and query data in various ways. 7 | Technologies used are [REST](http://ambit.sourceforge.net/rest.html) style web services and [W3C Resource Description Framework](http://ambit.sourceforge.net/rdf.html) for description of services. 8 | 9 | * API Documentation http://opentox.org/dev/apis/api-1.2 10 | * OpenTox API discussion, new ideas and examples at https://github.com/opentox-api 11 | * API Documentation by Swagger-ui http://ideaconsult.github.io/examples-ambit/apidocs/ 12 | 13 | ### JSON 14 | 15 | OpenTox mandatory representation of REST resources is [RDF](http://www.w3.org/RDF/) (W3C Resource Description Framework). 16 | Examples: [1](http://opentox.org/dev/apis/api-1.2/dataset),[2](http://ambit.sourceforge.net/api_dataset.html). 17 | 18 | The JSON representation is a new development, implemented in AMBIT web services [1](http://ambit.sf.net),[2](http://www.jcheminf.com/content/3/1/18), [3](http://www.beilstein-journals.org/bjnano/single/articleFullText.htm?publicId=2190-4286-6-165). 19 | 20 | * The JSON or JSONP representation could be retrieved via HTTP Accept headers **"application/json"** or **"application/x-javascript"** respectively. The callback parameter when using JSONP is 'callback'. 21 | * As a workaround for web browsers restriction, the URI parameter **?media=application/json** or **?media=application/x-javascript** could be used. 22 | 23 | * How to access [Datasets](dataset.md) 24 | * How to [search chemical compounds](query.md) 25 | * How to access [Algorithms](algorithm.md) 26 | * How to access [Models](model.md) 27 | 28 | 29 | ### Example 30 | 31 | * How to [run Toxtree predictions](toxtree.md) using REST web services and JSON. 32 | * Try [Toxtree web edition](http://toxtree.sf.net/predict) 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /ambit-json-docs/algorithm.md: -------------------------------------------------------------------------------- 1 | ## OpenTox REST API: Algorithm 2 | 3 | *Provides access to OpenTox algorithms.* 4 | 5 | * There are multiple kinds of algorithms (descriptor calculation, machine learning procedures or various data preprocessing). 6 | * Generally, a machine learning algorithm takes a [dataset](dataset.md) URI as input and generate a [model](model.md), also identified with an URI. 7 | * The Algorithm types ontology provides a hierarchical classification of [Algorithm types](http://opentox.org/data/documents/development/RDF%20files/AlgorithmTypes). 8 | * Documentation (wiki) http://opentox.org/dev/apis/api-1.2/Algorithm 9 | * Documentation (runnable) http://ideaconsult.github.io/examples-ambit/apidocs/#!/algorithm 10 | 11 | ### JSON 12 | 13 | OpenTox mandatory representation of REST resources is [RDF](http://www.w3.org/RDF/) (W3C Resource Description Framework). 14 | Examples: [1](http://opentox.org/dev/apis/api-1.2/algorithm),[2](http://ambit.sourceforge.net/api_algorithm.html). 15 | 16 | The JSON representation is a new development, implemented in AMBIT web services [1](http://ambit.sf.net),[2](http://www.jcheminf.com/content/3/1/18). 17 | 18 | * The algorithm JSON representation closely follows the RDF data model; 19 | 20 | * The JSON or JSONP representation could be retrieved via HTTP Accept headers **"application/json"** or **"application/x-javascript"** respectively. 21 | * As a workaround for web browsers restriction, the URI parameter **?media=application/json** or **?media=application/x-javascript** could be used. 22 | 23 | ````json 24 | { 25 | "algorithm": [ 26 | { 27 | "uri": "http://host:port/ambit2/algorithm/SimpleKMeans", 28 | "id": "SimpleKMeans", 29 | "name": "Clustering: k-means", 30 | "type": [ 31 | "http://www.opentox.org/algorithmTypes.owl#Clustering", 32 | "http://www.opentox.org/algorithmTypes.owl#SingleTarget", 33 | "http://www.opentox.org/algorithmTypes.owl#LazyLearning", 34 | "http://www.opentox.org/algorithmTypes.owl#UnSupervised" 35 | ] 36 | }, 37 | { 38 | "uri": "http://host:port/ambit2/algorithm/J48", 39 | "id": "J48", 40 | "name": "Classification: Decision tree J48", 41 | "type": [ 42 | "http://www.opentox.org/algorithmTypes.owl#Classification", 43 | "http://www.opentox.org/algorithmTypes.owl#SingleTarget", 44 | "http://www.opentox.org/algorithmTypes.owl#EagerLearning", 45 | "http://www.opentox.org/algorithmTypes.owl#Supervised" 46 | ] 47 | }, 48 | { 49 | "uri": "http://host:port/ambit2/algorithm/LR", 50 | "id": "LR", 51 | "name": "Regression: Linear regression", 52 | "type": [ 53 | "http://www.opentox.org/algorithmTypes.owl#Regression", 54 | "http://www.opentox.org/algorithmTypes.owl#SingleTarget", 55 | "http://www.opentox.org/algorithmTypes.owl#EagerLearning", 56 | "http://www.opentox.org/algorithmTypes.owl#Supervised" 57 | ] 58 | }, 59 | { 60 | "uri": "http://host:port/ambit2/algorithm/org.openscience.cdk.qsar.descriptors.molecular.XLogPDescriptor", 61 | "id": "org.openscience.cdk.qsar.descriptors.molecular.XLogPDescriptor", 62 | "name": "XLogP", 63 | "endpoint": "http://www.opentox.org/echaEndpoints.owl#Octanol-water_partition_coefficient_Kow", 64 | "implementationOf": "http://www.blueobelisk.org/ontologies/chemoinformatics-algorithms/#xlogP", 65 | "type": [ 66 | "http://www.opentox.org/algorithmTypes.owl#DescriptorCalculation" 67 | ] 68 | }, 69 | { 70 | "uri": "http://host:port/ambit2/algorithm/toxtreecramer", 71 | "id": "toxtreecramer", 72 | "name": "ToxTree: Cramer rules", 73 | "endpoint": "http://www.opentox.org/echaEndpoints.owl#HumanHealthEffects", 74 | "implementationOf": "http://ambit.sourceforge.net/descriptors.owl#toxtreecramer", 75 | "type": [ 76 | "http://www.opentox.org/algorithmTypes.owl#Rules" 77 | ] 78 | } 79 | ] 80 | } 81 | ```` 82 | 83 | #### [cURL](http://curl.haxx.se/) examples: 84 | 85 | Retrieve the list of [Descriptor calculation](https://apps.ideaconsult.net/ambit2/algorithm?type=DescriptorCalculation) algorithms 86 | ```` 87 | curl -H "Accept:application/x-javascript" "https://apps.ideaconsult.net/ambit2/algorithm?type=DescriptorCalculation" 88 | ```` 89 | 90 | Retrieve the list of [Classification](https://apps.ideaconsult.net/ambit2/algorithm?type=Classification) algorithms 91 | ```` 92 | curl "https://apps.ideaconsult.net/ambit2/algorithm?type=Classification&media=application/json" 93 | ```` 94 | 95 | Retrieve the list of [Regression](https://apps.ideaconsult.net/ambit2/algorithm?type=Regression) algorithms 96 | ```` 97 | curl -H "Accept:application/json" https://apps.ideaconsult.net/ambit2/algorithm?type=Regression 98 | ```` 99 | 100 | Retrieve the list of algorithms based on [Expert rules](https://apps.ideaconsult.net/ambit2/algorithm?type=Rules) 101 | ```` 102 | curl "https://apps.ideaconsult.net/ambit2/algorithm?type=Rules&media=application/x-javascript" 103 | ```` 104 | 105 | Retrieve the list of [Applicability domain](https://apps.ideaconsult.net/ambit2/algorithm?type=AppDomain) algorithms 106 | ```` 107 | curl "https://apps.ideaconsult.net/ambit2/algorithm?type=AppDomain&media=application/x-javascript" 108 | ```` 109 | 110 | ### The ontology entries 111 | 112 | * An algorithm resource may contain an "implementationOf" field, linking to the BlueObelisk ontology , e.g. http://www.blueobelisk.org/ontologies/chemoinformatics-algorithms/#xlogP. 113 | * The BlueObelisk ontology provides details of the algorithm itself, e.g. publication reference. 114 | * The BlueObelisk ontology can be queried via Ontology service [SPARQL](https://apps.ideaconsult.net/ontology/query/BODO). 115 | 116 | * An algorithm resource may contain an "endpoint" field, linking to the [endpoints ontology](http://www.opentox.org/echaEndpoints.owl) , e.g. http://www.opentox.org/echaEndpoints.owl#Carcinogenicity. 117 | -------------------------------------------------------------------------------- /ambit-json-docs/dataset.md: -------------------------------------------------------------------------------- 1 | ## OpenTox REST API: Dataset 2 | 3 | Provides access to chemical compounds and their features (e.g. structural, physical-chemical, biological, toxicological properties). 4 | 5 | The concept of a Dataset of chemical compounds is central to OpenTox web services functionality. 6 | 7 | * Algorithm services accept dataset URI in order to build a model, or to generate descriptor values. 8 | * Model services accept dataset URI in order to apply a model and obtain predictions. 9 | * Predictions are again returned as dataset URI, which could be subsequently retrieved. 10 | * Search results (exact chemical structure, similarity or substructure) are also available as datasets. 11 | * Documentation (wiki) http://opentox.org/dev/apis/api-1.2/dataset 12 | * Documentation (runnable) http://ideaconsult.github.io/examples-ambit/apidocs/#!/dataset 13 | 14 | ### JSON 15 | 16 | OpenTox mandatory representation of REST resources is [RDF](http://www.w3.org/RDF/) (W3C Resource Description Framework). 17 | Examples: [1](http://opentox.org/dev/apis/api-1.2/dataset),[2](http://ambit.sourceforge.net/api_dataset.html). 18 | 19 | The JSON representation is a new development, implemented in AMBIT web services [1](http://ambit.sf.net),[2](http://www.jcheminf.com/content/3/1/18). 20 | 21 | * The dataset JSON representation closely follows the RDF data model; 22 | * The dataset consists of data entries (or data rows); 23 | * Each row is associated with exactly one chemical compound, identified by its URL and available via OpenTox Compound service API; 24 | * One and the same compound URL can be associated with multiple dataset rows; 25 | * Every column is associated with a Feature URL, representation should be available via OpenTox [Feature](feature.md) API. A feature is identified by its URL and has name and source,along with other properties. Any OpenTox [Dataset](dataset.md), [Algorithm](algorithm.md) or [Model](model.md) can serve as feature source. 26 | 27 | * The JSON or JSONP representation could be retrieved via HTTP Accept headers **"application/json"** or **"application/x-javascript"** respectively. 28 | * As a workaround for web browsers restriction, the URI parameter **?media=application/json** or **?media=application/x-javascript** could be used. 29 | 30 | 31 | 32 | ````json 33 | { 34 | "query": { 35 | "summary": "Query description" 36 | }, 37 | "dataEntry": [ 38 | { 39 | "compound": { 40 | "URI": "http://apps.ideaconsult.net/ambit2/compound/{id}/conformer/{id}" 41 | }, 42 | "values": { 43 | "key1": "value1", 44 | "key2": 3.14 45 | } 46 | }, 47 | { 48 | "compound": { 49 | "URI": "http://host:port/ambit2/compound/{id}/conformer/{id}" 50 | }, 51 | "values": { 52 | "key1": "value3", 53 | "key3": "value4" 54 | } 55 | } 56 | ], 57 | "feature": { 58 | "key1": { 59 | "type": "Feature", 60 | "title": "Title1", 61 | "units": "", 62 | "isNominal": false, 63 | "isNumeric": false, 64 | "sameAs": "ONTOLOGY_ENTRY", 65 | "isModelPredictionFeature": false, 66 | "creator": "URI", 67 | "order": 1, 68 | "source": { 69 | "URI": "URI of a dataset, algorithm, or a model", 70 | "type": "Dataset" 71 | } 72 | }, 73 | "key2": { 74 | "type": "Feature", 75 | "title": "Title2", 76 | "units": "", 77 | "isNominal": false, 78 | "isNumeric": true, 79 | "sameAs": "ONTOLOGY_ENTRY", 80 | "isModelPredictionFeature": false, 81 | "creator": "URI", 82 | "order": 3, 83 | "source": { 84 | "URI": "URI of a dataset, algorithm, or a model", 85 | "type": "Algorithm" 86 | } 87 | }, 88 | "key3": { 89 | "type": "Feature", 90 | "title": "Title 3", 91 | "units": "", 92 | "isNominal": false, 93 | "isNumeric": false, 94 | "sameAs": "ONTOLOGY_ENTRY", 95 | "isModelPredictionFeature": true, 96 | "creator": "URI", 97 | "order": 2, 98 | "source": { 99 | "URI": "URI of a dataset, algorithm, or a model", 100 | "type": "Model" 101 | } 102 | } 103 | } 104 | } 105 | ```` 106 | 107 | #### [cURL](http://curl.haxx.se/) examples: 108 | 109 | [Search](https://apps.ideaconsult.net/ambit2/query/compound/search/all?search=caffeine&media=application/json&page=0&pagesize=1) for compound with name *caffeine* 110 | ```` 111 | curl -H "Accept:application/json" \ 112 | "https://apps.ideaconsult.net/ambit2/query/compound/search/all?search=caffeine&page=0&pagesize=1" 113 | ```` 114 | 115 | Retrieve the first 10 record of [dataset/1](https://apps.ideaconsult.net/ambit2/dataset/12?page=0&pagesize=10) 116 | ```` 117 | https://apps.ideaconsult.net/ambit2/dataset/12?media=application/json&page=0&pagesize=10 118 | ```` 119 | 120 | 121 | ### The ontology entries 122 | 123 | In RDF the feature type is denoted by a mandatory link to an ontology via owl:sameAs or directly subclassing a class from an ontology. 124 | The JSON representation uses the key **"sameAs"** and the same ontology URIs. 125 | 126 | The following ontology entries are used to denote: 127 | 128 | #### Chemical identifiers [opentox.owl](http://www.opentox.org/api/1.1/opentox.owl): 129 | 130 | * [CAS Registry](http://en.wikipedia.org/wiki/CAS_registry_number) number : "http://www.opentox.org/api/1.1#CASRN" 131 | * [EC Registry](http://en.wikipedia.org/wiki/European_Commission_number) number : "http://www.opentox.org/api/1.1#EINECS" 132 | * [IUPAC](http://www.iupac.org/) name : "http://www.opentox.org/api/1.1#IUPACName" 133 | * Chemical name : "http://www.opentox.org/api/1.1#ChemicalName" 134 | * [SMILES](http://en.wikipedia.org/wiki/Simplified_molecular-input_line-entry_system) : "http://www.opentox.org/api/1.1#SMILES" 135 | * [InChI](http://en.wikipedia.org/wiki/Inchi) : "http://www.opentox.org/api/1.1#InChI_std" 136 | * [InChIKey](http://en.wikipedia.org/wiki/Inchi) : "http://www.opentox.org/api/1.1#InChIKey_std" 137 | 138 | #### Toxicological endpoints [echaEndpoints.owl](http://www.opentox.org/echaEndpoints.owl), [SPARQL](http://apps.ideaconsult.net/ontology/query/Endpoints) 139 | 140 | Examples: 141 | 142 | * Fish toxicity http://www.opentox.org/echaEndpoints.owl#Acute_toxicity_to_fish_lethality 143 | * Carcinogenicity http://www.opentox.org/echaEndpoints.owl#Carcinogenicity 144 | 145 | 146 | 147 | -------------------------------------------------------------------------------- /ambit-json-docs/feature.md: -------------------------------------------------------------------------------- 1 | ## OpenTox REST API: Feature 2 | 3 | A Feature is a resource, representing any kind of a property or identifier, assigned to a Compound. 4 | 5 | * The feature types are determined via their links to ontologies, e.g. [BlueObelisk ontology](http://apps.ideaconsult.net:8080/ontology/query/BODO) and [ECHA endpoints ontology](http://www.opentox.org/echaEndpoints.owl). 6 | * Documentation (wiki) http://opentox.org/dev/apis/api-1.2/Feature 7 | * Documentation (runnable) http://ideaconsult.github.io/examples-ambit/apidocs/#!/feature 8 | 9 | ### JSON 10 | 11 | OpenTox mandatory representation of REST resources is [RDF](http://www.w3.org/RDF/) (W3C Resource Description Framework). 12 | Examples: [1](http://opentox.org/dev/apis/api-1.2/Feature),[2](http://ambit.sourceforge.net/api_feature.html). 13 | 14 | The JSON representation is a new development, implemented in AMBIT web services [1](http://ambit.sf.net),[2](http://www.jcheminf.com/content/3/1/18). 15 | 16 | * The dataset JSON representation closely follows the RDF data model; 17 | * A feature is identified by its URL and has a title, source,along with other properties 18 | * Title *title:* 19 | * Units *units:* 20 | * The origin of the Feature *source:*. Any OpenTox [Dataset](dataset.md), [Algorithm](algorithm.md) or [Model](model.md) can serve as feature source. 21 | * Relations to other resources, which represent the same entity, could be established via *sameAs:* property. 22 | * This approach is be used for example to link the [feature](feature.md) resource to a resource form another [ontology](#ONTOLOGY_ENTRY). 23 | * *isNumeric* denotes if a feature holds numeric or string values. 24 | * *isNominal* denote if a feature holds nominal values (a predefined list of string values). 25 | 26 | * The JSON or JSONP representation could be retrieved via HTTP Accept headers **"application/json"** or **"application/x-javascript"** respectively. 27 | * As a workaround for web browsers restriction, the URI parameter **?media=application/json** or **?media=application/x-javascript** could be used. 28 | 29 | 30 | 31 | ````json 32 | { 33 | "feature": { 34 | "key1": { 35 | "type": "Feature", 36 | "title": "Title1", 37 | "units": "", 38 | "isNominal": false, 39 | "isNumeric": false, 40 | "sameAs": "ONTOLOGY_ENTRY", 41 | "isModelPredictionFeature": false, 42 | "creator": "URI", 43 | "order": 1, 44 | "source": { 45 | "URI": "URI of a dataset, algorithm, or a model", 46 | "type": "Dataset" 47 | } 48 | }, 49 | "key2": { 50 | "type": "Feature", 51 | "title": "Title2", 52 | "units": "", 53 | "isNominal": false, 54 | "isNumeric": true, 55 | "sameAs": "ONTOLOGY_ENTRY", 56 | "isModelPredictionFeature": false, 57 | "creator": "URI", 58 | "order": 3, 59 | "source": { 60 | "URI": "URI of a dataset, algorithm, or a model", 61 | "type": "Algorithm" 62 | } 63 | }, 64 | "key3": { 65 | "type": "Feature", 66 | "title": "Title 3", 67 | "units": "", 68 | "isNominal": false, 69 | "isNumeric": false, 70 | "sameAs": "ONTOLOGY_ENTRY", 71 | "isModelPredictionFeature": true, 72 | "creator": "URI", 73 | "order": 2, 74 | "source": { 75 | "URI": "URI of a dataset, algorithm, or a model", 76 | "type": "Model" 77 | } 78 | } 79 | } 80 | } 81 | ```` 82 | 83 | #### [cURL](http://curl.haxx.se/) examples: 84 | 85 | ##### [Retrieve dataset features](http://apps.ideaconsult.net:8080/ambit2/dataset/1/feature). More about [dataset](dataset.md). 86 | ```` 87 | curl -H "Accept:application/json" \ 88 | "http://apps.ideaconsult.net:8080/ambit2/dataset/1/feature" 89 | ```` 90 | Result 91 | ````json 92 | { 93 | "feature": { 94 | "http://apps.ideaconsult.net:8080/ambit2/feature/2": { 95 | "type": "Feature", 96 | "title": "CasRN", 97 | "isNominal": false, 98 | "isNumeric": false, 99 | "sameAs": "http://www.opentox.org/api/1.1#CASRN", 100 | "isModelPredictionFeature": "false", 101 | "creator": "http://apps.echa.europa.eu/preregistered/prsDownload.aspx", 102 | "source": { 103 | "URI": "http://apps.ideaconsult.net:8080/ambit2/dataset/ECHA", 104 | "type": "Dataset" 105 | } 106 | }, 107 | "http://apps.ideaconsult.net:8080/ambit2/feature/3": { 108 | "type": "Feature", 109 | "title": "EC", 110 | "isNominal": false, 111 | "isNumeric": false, 112 | "sameAs": "http://www.opentox.org/api/1.1#EINECS", 113 | "isModelPredictionFeature": "false", 114 | "creator": "http://apps.echa.europa.eu/preregistered/prsDownload.aspx", 115 | "source": { 116 | "URI": "http://apps.ideaconsult.net:8080/ambit2/dataset/ECHA", 117 | "type": "Dataset" 118 | } 119 | }, 120 | "http://apps.ideaconsult.net:8080/ambit2/feature/4": { 121 | "type": "Feature", 122 | "title": "Names", 123 | "units": "", 124 | "isNominal": false, 125 | "isNumeric": true, 126 | "sameAs": "http://www.opentox.org/api/1.1#ChemicalName", 127 | "isModelPredictionFeature": "false", 128 | "creator": "http://apps.echa.europa.eu/preregistered/prsDownload.aspx", 129 | "source": { 130 | "URI": "http://apps.ideaconsult.net:8080/ambit2/dataset/ECHA", 131 | "type": "Dataset" 132 | } 133 | } 134 | } 135 | } 136 | ```` 137 | 138 | ###### [Retrieve model output variables](http://apps.ideaconsult.net:8080/ambit2/model/2/predicted) 139 | ```` 140 | curl "http://apps.ideaconsult.net:8080/ambit2/model/2/predicted?media=application/json&page=0&pagesize=10" 141 | ```` 142 | 143 | Result 144 | ````json 145 | { 146 | "feature": { 147 | "http://apps.ideaconsult.net:8080/ambit2/feature/9042927": { 148 | "type": "Feature", 149 | "title": "Cramer rules", 150 | "isNominal": "false", 151 | "isNumeric": "false", 152 | "sameAs": "Cramer rules", 153 | "isModelPredictionFeature": "false", 154 | "creator": "http://toxtree.sourceforge.net/cramer.html", 155 | "order": 9042927, 156 | "source": { 157 | "URI": "http://apps.ideaconsult.net:8080/ambit2/algorithm/Cramer+rules", 158 | "type": "Algorithm" 159 | } 160 | }, 161 | "http://apps.ideaconsult.net:8080/ambit2/feature/9042928": { 162 | "type": "Feature", 163 | "title": "Cramer rules#explanation", 164 | "isNominal": "false", 165 | "isNumeric": "false", 166 | "sameAs": "Cramer rules#explanation", 167 | "isModelPredictionFeature": "false", 168 | "creator": "http://toxtree.sourceforge.net/cramer.html", 169 | "source": { 170 | "URI": "http://apps.ideaconsult.net:8080/ambit2/algorithm/Cramer+rules", 171 | "type": "Algorithm" 172 | } 173 | } 174 | } 175 | } 176 | ```` 177 | 178 | ### The ontology entries 179 | 180 | In RDF the feature type is denoted by a mandatory link to an ontology via owl:sameAs or directly subclassing a class from an ontology. 181 | The JSON representation uses the key **"sameAs"** and the same ontology URIs. 182 | 183 | The following ontology entries are used to denote: 184 | 185 | #### Chemical identifiers [opentox.owl](http://www.opentox.org/api/1.1/opentox.owl): 186 | 187 | * [CAS Registry](http://en.wikipedia.org/wiki/CAS_registry_number) number : "http://www.opentox.org/api/1.1#CASRN" 188 | * [EC Registry](http://en.wikipedia.org/wiki/European_Commission_number) number : "http://www.opentox.org/api/1.1#EINECS" 189 | * [IUPAC](http://www.iupac.org/) name : "http://www.opentox.org/api/1.1#IUPACName" 190 | * Chemical name : "http://www.opentox.org/api/1.1#ChemicalName" 191 | * [SMILES](http://en.wikipedia.org/wiki/Simplified_molecular-input_line-entry_system) : "http://www.opentox.org/api/1.1#SMILES" 192 | * [InChI](http://en.wikipedia.org/wiki/Inchi) : "http://www.opentox.org/api/1.1#InChI_std" 193 | * [InChIKey]((http://en.wikipedia.org/wiki/Inchi)"http://www.opentox.org/api/1.1#InChIKey_std" 194 | 195 | #### Toxicological endpoints [echaEndpoints.owl](http://www.opentox.org/echaEndpoints.owl), [SPARQL](http://apps.ideaconsult.net:8080/ontology/query/Endpoints) 196 | 197 | Examples: 198 | 199 | * Fish toxicity http://www.opentox.org/echaEndpoints.owl#Acute_toxicity_to_fish_lethality 200 | * Carcinogenicity http://www.opentox.org/echaEndpoints.owl#Carcinogenicity 201 | 202 | 203 | 204 | -------------------------------------------------------------------------------- /ambit-json-docs/model.md: -------------------------------------------------------------------------------- 1 | ## OpenTox REST API: Models 2 | 3 | Provides different representations for QSAR/toxicology models. 4 | 5 | * Models are the output/result of (learning) [algorithms](algorithm.md) and cannot be modified. 6 | * To apply a model, it is necessary to provide as input a [dataset](dataset.md) with compatible descriptors/features. 7 | * Documentation http://opentox.org/dev/apis/api-1.2/Model 8 | * Documentation (runnable) http://ideaconsult.github.io/examples-ambit/apidocs/#!/model 9 | 10 | 11 | ### JSON 12 | 13 | OpenTox mandatory representation of REST resources is [RDF](http://www.w3.org/RDF/) (W3C Resource Description Framework). 14 | Examples: [1](http://opentox.org/dev/apis/api-1.2/algorithm),[2](http://ambit.sourceforge.net/api_algorithm.html). 15 | 16 | The JSON representation is a new development, implemented in AMBIT web services [1](http://ambit.sf.net),[2](http://www.jcheminf.com/content/3/1/18). 17 | 18 | * The model JSON representation closely follows the RDF representation; 19 | 20 | * The JSON or JSONP representation could be retrieved via HTTP Accept headers **"application/json"** or **"application/x-javascript"** respectively. 21 | * As a workaround for web browsers restriction, the URI parameter **?media=application/json** or **?media=application/x-javascript** could be used. 22 | 23 | #### Models 24 | #####Retrieve first 10 models 25 | ```` 26 | curl -H "Accept:application/json" "http://host:port/ambit2/model?page=0&pagesize=10" 27 | ```` 28 | 29 | Example: 30 | ```` 31 | curl -H "Accept:application/json" "https://apps.ideaconsult.net/ambit2/model?page=0&pagesize=10" 32 | ```` 33 | 34 | ````json 35 | todo 36 | 37 | ```` 38 | 39 | #####Retrieve a model, created by a given algorithm 40 | 41 | ```` 42 | curl -H "Accept:application/json" http://host:port/ambit2/model?algorithm=ALGORITHM_URI 43 | ```` 44 | 45 | Example: Retrieve the model, which will apply the Cramer rules algorithm 46 | 47 | See [Toxtree examples](toxtree.md) 48 | 49 | 50 | ######Create a model 51 | ```` 52 | curl -X POST http://host:port/ambit2/algorithm/{id} -H "Accept:application/json" 53 | ```` 54 | a task is returned 55 | 56 | ````json 57 | {"task": [ 58 | { 59 | "uri":"http://host:port/ambit2/task/{id}", 60 | "id": "7aadd2a5-06de-4ae2-851e-3e13ca6811d9", 61 | "name": "The model name", 62 | "status": "Running", 63 | "started": 1371742727965, 64 | "result": "http://host:port/ambit2/task/7aadd2a5-06de-4ae2-851e-3e13ca6811d9", 65 | } 66 | ] 67 | ```` 68 | 69 | poll the task 70 | ```` 71 | curl -H "Accept:application/json" "http://host:port/ambit2/task/7aadd2a5-06de-4ae2-851e-3e13ca6811d9" 72 | ```` 73 | 74 | the task is now completed and the model URI is http://host:port/ambit2/model/{md} 75 | ````json 76 | {"task": [ 77 | { 78 | "uri":"http://host:port/ambit2/model/{mid}", 79 | "id": "7aadd2a5-06de-4ae2-851e-3e13ca6811d9", 80 | "name": "Apply algorithm {aid} ", 81 | "status": "Completed", 82 | "started": 1371742727965, 83 | "completed": 1371742727974, 84 | "result": "http://host:port/ambit2/model/{mid}", 85 | } 86 | ] 87 | } 88 | ```` 89 | 90 | #### Retrieve model representation by URI 91 | 92 | 93 | ```` 94 | curl -H "Accept:application/json" "http://host:port/ambit2/model/{mid}" 95 | ```` 96 | 97 | ````json 98 | { 99 | "model": [ 100 | { 101 | "URI": "http://host:port/ambit2/model/{mid}", 102 | "id": 2, 103 | "title": "ToxTree: Cramer rules", 104 | "stars": 9, 105 | "algorithm": { 106 | "URI": "http://host:port/ambit2/algorithm/{aid}" 107 | }, 108 | "trainingDataset": "http://host:port/ambit2/dataset/{did}", 109 | "independent": "http://host:port/ambit2/model/2/independent", 110 | "dependent": "http://host:port/ambit2/model/{mid}/dependent", 111 | "predicted": "http://host:port/ambit2/model/{mid}/predicted", 112 | "ambitprop": { 113 | "legend": "http://host:port/ambit2/model/{mid}?media=image/png" 114 | } 115 | } 116 | ] 117 | } 118 | ```` 119 | 120 | #### Finally, get some prediction (e.g. apply the model to compound or dataset URI ) 121 | 122 | ```` 123 | curl -X POST -H "Accept:application/json" \ 124 | -d "dataset_uri=http://host:port/ambit2/compound/{cid}" \ 125 | "http://host:port/ambit2/model/{mid}" 126 | ```` 127 | 128 | ######here is the task 129 | 130 | ````json 131 | { 132 | "task": [ 133 | { 134 | "uri": "http://host:port/ambit2/task/80552714-de54-4319-9a88-ec9d39f64539", 135 | "id": "80552714-de54-4319-9a88-ec9d39f64539", 136 | "name": "Apply Model {mid} to http://host:port/ambit2/compound/{cid}", 137 | "status": "Running", 138 | "started": 1371743438742, 139 | "result": "http://host:port/ambit2/task/80552714-de54-4319-9a88-ec9d39f64539" 140 | } 141 | ] 142 | } 143 | ```` 144 | 145 | ######poll the task 146 | ```` 147 | curl -H "Accept:application/json" http://host:port/ambit2/task/80552714-de54-4319-9a88-ec9d39f64539 148 | ```` 149 | 150 | ######and now the task is completed. The **result** field contains the URI of the dataset with the predictions. 151 | ````json 152 | { 153 | "task": [ 154 | { 155 | "uri": "http://host:port/ambit2/compound/{cid}?feature_uris[]=http%3A%2F%2Fhost%3Aport%2Fambit2%2Fmodel%2Fmid%2Fpredicted", 156 | "id": "80552714-de54-4319-9a88-ec9d39f64539", 157 | "name": "Apply Model {mid} to http://host:port/ambit2/compound/{cid}", 158 | "status": "Completed", 159 | "started": 1371743438742, 160 | "completed": 1371743439633, 161 | "result": "http://host:port/ambit2/compound/{cid}?feature_uris[]=http%3A%2F%2Fhost%3Aport%2Fambit2%2Fmodel%2Fmid%2Fpredicted" 162 | } 163 | ] 164 | } 165 | ```` 166 | 167 | ######Retrieve the predictions 168 | ```` 169 | curl -H "Accept:application/json" "http://host:port/ambit2/compound/{cid?feature_uris[]=http%3A%2F%2Fhost%3Aport%2Fambit2%2Fmodel%2Fmid%2Fpredicted" 170 | ```` 171 | 172 | The resutls are in the same format, as if retrieving a [dataset](dataset.md). 173 | 174 | * For specific examples see the [Toxtree](toxtree.md) page. 175 | -------------------------------------------------------------------------------- /ambit-json-docs/query.md: -------------------------------------------------------------------------------- 1 | ## Searching chemical compounds 2 | 3 | * Documentation (runnable) [Chemical structure search](http://ideaconsult.github.io/examples-ambit/apidocs/#!/compound_0) 4 | 5 | All search queries return the results in the [dataset](dataset.md) format 6 | 7 | #### Exact search and search by chemical identifier 8 | ```` 9 | curl -H "Accept:application/json" \ 10 | "http://host:port/ambit2/query/compound/search/all?search=caffeine&page=0&pagesize=1" 11 | ```` 12 | 13 | Examples: 14 | 15 | [Search by name](https://apps.ideaconsult.net/ambit2/query/compound/search/all?search=caffeine&media=application/json&page=0&pagesize=1) for compound with name *caffeine* 16 | ```` 17 | curl -H "Accept:application/json" \ 18 | "https://apps.ideaconsult.net/ambit2/query/compound/search/all?search=caffeine&page=0&pagesize=1" 19 | ```` 20 | 21 | [Search by registry number](https://apps.ideaconsult.net/ambit2/query/compound/search/all?search=50-00-0&media=application/json&page=0&pagesize=1) for compound with registry number *50-00-0* 22 | ```` 23 | curl -H "Accept:application/json" \ 24 | "https://apps.ideaconsult.net/ambit2/query/compound/search/all?search=50-00-0&page=0&pagesize=1" 25 | ```` 26 | 27 | [Search by SMILES](https://apps.ideaconsult.net/ambit2/query/compound/search/all?search=c1ccccc1&media=application/json&page=0&pagesize=1) for compound with [SMILES](http://en.wikipedia.org/wiki/Simplified_molecular-input_line-entry_system) *c1cccc1* 28 | ```` 29 | curl -H "Accept:application/json" \ 30 | "http://apps.ideaconsult.net:8080/ambit2/query/compound/search/all?search=c1ccccc1&page=0&pagesize=1" 31 | ```` 32 | 33 | [Search by InChI](https://apps.ideaconsult.net/ambit2/query/compound/search/all?search=InChI%3D1%2FC2H6O%2Fc1-2-3%2Fh3H%2C2H2%2C1H3&media=application/json&page=0&pagesize=1) for compound with [InChI](http://en.wikipedia.org/wiki/International_Chemical_Identifier) *InChI=1/C2H6O/c1-2-3/h3H,2H2,1H3* 34 | ```` 35 | curl -H "Accept:application/json" \ 36 | "https://apps.ideaconsult.net/ambit2/query/compound/search/all?search=InChI%3D1%2FC2H6O%2Fc1-2-3%2Fh3H%2C2H2%2C1H3&page=0&pagesize=1" 37 | ```` 38 | 39 | [Search by URI](https://apps.ideaconsult.net/ambit2/query/compound/search/allnlinks?search=https://apps.ideaconsult.net/ambit2/compound/1&media=application/json&page=0&pagesize=1) for compound with URI https://apps.ideaconsult.net/ambit2/compound/1 40 | ```` 41 | curl -H "Accept:application/json" \ 42 | "https://apps.ideaconsult.net/ambit2/query/compound/search/allnlinks?search=https://apps.ideaconsult.net/ambit2/compound/1&media=application/json&page=0&pagesize=1" 43 | ```` 44 | 45 | #### Similarity search 46 | ```` 47 | curl -H "Accept:application/json" \ 48 | "http://host:port/ambit2/query/compound/search/all?search=caffeine&page=0&pagesize=1" 49 | ```` 50 | 51 | Examples: 52 | 53 | [Compounds similar](https://apps.ideaconsult.net/ambit2/query/similarity?search=c1ccccc1&threshold=0.8&page=0&pagesize=100&media=application/json) to SMILES c1ccccc1 with Tanimoto distance>=0.8 54 | ```` 55 | curl -H "Accept:application/json" \ 56 | "https://apps.ideaconsult.net/ambit2/query/similarity?search=c1ccccc1&threshold=0.8&page=0&pagesize=100" 57 | ```` 58 | 59 | #### Substructure search 60 | ```` 61 | curl -H "Accept:application/json" \ 62 | "http://host:port/ambit2/query/compound/search/all?search=caffeine&page=0&pagesize=1" 63 | ```` 64 | 65 | Examples: 66 | 67 | [Compounds containing substructure](https://apps.ideaconsult.net/ambit2/query/smarts?search=c1ccccc1&page=0&pagesize=100&media=application/json) , specified by SMILES c1ccccc1 68 | ```` 69 | curl -H "Accept:application/json" \ 70 | "https://apps.ideaconsult.net/ambit2/query/smarts?search=c1ccccc1&page=0&pagesize=100" 71 | ```` 72 | -------------------------------------------------------------------------------- /ambit-json-docs/restpolicy.md: -------------------------------------------------------------------------------- 1 | ##Local Policy Administration Point 2 | 3 | [http://host:port/app/admin/restpolicy](http://host:port/app/admin/restpolicy) 4 | 5 | ### JSON 6 | 7 | ````json 8 | { 9 | "policy": [ 10 | { 11 | "uri": "http://host:port/app/admin/restpolicy/1", 12 | "resource": "/model", 13 | "role": "ambit_admin", 14 | "methods": { 15 | "get": true, 16 | "post": true, 17 | "put": true, 18 | "delete": true 19 | } 20 | }, 21 | { 22 | "uri": "http://host:port/app/admin/restpolicy/2", 23 | "resource": "/dataset", 24 | "role": "ambit_admin", 25 | "methods": { 26 | "get": true, 27 | "post": true, 28 | "put": true, 29 | "delete": true 30 | } 31 | } 32 | ] 33 | } 34 | ```` 35 | 36 | ###REST Operations 37 | 38 | #### GET /admin/restpolicy 39 | Returns all policies (JSON as above) 40 | 41 | #### GET /admin/restpolicy/{id} 42 | Returns one policy (JSON as above). 43 | 44 | #### PUT /admin/restpolicy/{id} 45 | Updates one policy. Returns a task URI 46 | 47 | Expects Content-type:[application/x-www-form-urlencoded](http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4.1) with the following fields (all fields optional, unspecified fields will not be updated): 48 | 49 | ```` 50 |
51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 |
59 | ```` 60 | 61 | #### DELETE /admin/restpolicy/{id} 62 | Deletes one policy. Returns a task URI. 63 | 64 | #### POST /admin/restpolicy 65 | Creates a new policy. Returns a task URI. 66 | Expects Content-type:[application/x-www-form-urlencoded](http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4.1) with the following fields (role and resource fields mandatory, unspecified method fields will be assigned 'false'): 67 | 68 | ```` 69 |
70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 |
78 | ```` 79 | 80 | ##### [cURL](http://curl.haxx.se/) example 81 | 82 | ```` 83 | curl -X POST http://host:port/app/admin/restpolicy -H "Accept:application/json" -d"role=ambit_user" -d"resource=/ambit2/model/123" -i 84 | HTTP/1.1 202 Accepted 85 | Content-Language: en 86 | Date: Thu, 17 Jul 2014 15:53:24 GMT 87 | Vary: Accept-Charset, Accept-Encoding, Accept-Language, Accept 88 | Accept-Ranges: bytes 89 | Access-Control-Allow-Origin: * 90 | Access-Control-Allow-Methods: GET,POST,PUT,DELETE,OPTIONS 91 | Access-Control-Allow-Headers: Content-Type 92 | Access-Control-Allow-Credentials: true 93 | Access-Control-Max-Age: 60 94 | Content-Type: application/json;charset=UTF-8 95 | Content-Length: 522 96 | 97 | {"task": [ 98 | { 99 | "uri":"http://host:port/app/task/1c545da3-bc36-4c58-8d1f-ad2d4f05e07f", 100 | "id": "Started Thu Jul 17 18:53:24 EEST 2014 Completed ", 101 | "name": "Apply to XYZ", 102 | "error": "", 103 | "policyError": "", 104 | "status": "Running", 105 | "started": 1405612404938, 106 | "completed": -1, 107 | "result": "http://host:port/app/task/1c545da3-bc36-4c58-8d1f-ad2d4f05e07f", 108 | "user": "" 109 | } 110 | ] 111 | } 112 | 113 | ```` 114 | 115 | 116 | ### List of roles 117 | 118 | #### GET /admin/role 119 | 120 | ````json 121 | { 122 | "roles": [ 123 | "test_role", 124 | "test_admin" 125 | ] 126 | } 127 | ```` 128 | -------------------------------------------------------------------------------- /ambit-json-docs/substance_property.md: -------------------------------------------------------------------------------- 1 | 2 | Supporting information for [createProperty API](http://ideaconsult.github.io/examples-ambit/apidocs/#!/property/createProperty) 3 | 4 | Substance properties are "virtual" entities, generated from the data and NOT stored in database tables. 5 | The substance properties are generated from the study records by using the following entries: 6 | 7 | * Protocol category : Feature.sameAs (http://www.opentox.org/echaEndpoints.owl#CATEGORY) 8 | * Protocol guidance : Feature.source.URI (if the content is an URI, it is taken as it is, if the content is a string, it is converted to URI using the {base_uri}/dataset/URLENCODED(String) . 9 | * Effect endpoint : Feature.title 10 | * Effect units : Feature.units 11 | * Effect conditions : part of the SHA2 hash 12 | 13 | The Feature.URI is generated as follows: 14 | Example URI: https://apps.ideaconsult.net/enanomapper/property/P-CHEM/ZETA_POTENTIAL_SECTION/ZETA+POTENTIAL/7F8B3FB82019B1CCF8A8C3FD2B5A2DACBDDDB832/3ed642f9-1b42-387a-9966-dea5b91e5f8a 15 | * https://apps.ideaconsult.net/enanomapper/property : base URI of the server + "/property" resource 16 | * /P-CHEM - protocol top category (derived from protocol category) 17 | * /ZETA_POTENTIAL_SECTION - protocol endpoint category 18 | * /ZETA+POTENTIAL - effect endpoint 19 | * /7F8B3FB82019B1CCF8A8C3FD2B5A2DACBDDDB832 : SHA2 hash generated from Feature.title, Feature.units, Effect conditions 20 | * /3ed642f9-1b42-387a-9966-dea5b91e5f8a : UUID generated from Feature.source.URI 21 | 22 | The API supports two modes of creating properties - via web form and Feature RDF (JSON will follow shortly). 23 | The Feature RDF must contain owl:sameAs , ot:hasSource, dc:title, ot:units . 24 | 25 | (For RDF example see [feature.rdf](https://svn.code.sf.net/p/ambit/code/trunk/ambit2-all/ambit2-apps/ambit2-www/src/test/resources/feature.rdf)) 26 | 27 | ````RDF 28 | 29 | http://www.opentox.org/echaEndpoints.owl#EC_DAPHNIATOX 30 | mg/L 31 | EC10 32 | ```` 33 | 34 | To create a feature for e.g. modelling algorithm, ot:hasSource should point to the model URI; dc:title should be the title of the endpoint being predicted; owl:sameAs should reflect the endpoint category (see the [endpoint category drop down box](http://ideaconsult.github.io/examples-ambit/apidocs/#!/property/createProperty) for supported categories). The units should be rep[resented by ot:units (if relevant). These should match the data file, otherwise the generated property URI may differ. 35 | 36 | 37 | ###Examples: 38 | #### Study record 39 | ````json 40 | { 41 | "uuid": "FCSV-b42b9514-9693-3b87-b40e-6920a55ffb8e", 42 | "owner": { 43 | "substance": { 44 | "uuid": "FCSV-bc77c03d-4e75-3fab-bb3d-17b983663819" 45 | }, 46 | "company": { 47 | "uuid": "FCSV-319611c6-e7da-3977-a5ac-eb74d49a4319", 48 | "name": "Protein Corona Fingerprinting Predicts the Cellular Interaction of Gold and Silver Nanoparticles.csv" 49 | } 50 | }, 51 | "citation": { 52 | "title": "Protein Corona Fingerprinting Predicts the Cellular Interaction of Gold and Silver Nanoparticles.csv", 53 | "year": "2014", 54 | "owner": null 55 | }, 56 | "protocol": { 57 | "topcategory": "P-CHEM", 58 | "category": { 59 | "code": "ZETA_POTENTIAL_SECTION", 60 | "title": "4.29 Nanomaterial zeta potential" 61 | }, 62 | "endpoint": "DLS", 63 | "guideline": [ 64 | "doi: 10.1021/nn406018q" 65 | ] 66 | }, 67 | "parameters": { 68 | "DATA_GATHERING_INSTRUMENTS": "ZetaSizer Nano ZS (Malvern Instruments)", 69 | "Type of method": "DLS", 70 | "testmat_form": null 71 | }, 72 | "reliability": { 73 | "r_isRobustStudy": "false", 74 | "r_isUsedforClassification": "false", 75 | "r_isUsedforMSDS": "false", 76 | "r_purposeFlag": null, 77 | "r_studyResultType": "experimental result", 78 | "r_value": null 79 | }, 80 | "interpretation": { 81 | "result": null 82 | }, 83 | "effects": [ 84 | { 85 | "endpoint": "ZETA POTENTIAL", 86 | "conditions": { 87 | "MEDIUM": " ", 88 | "Remark": null, 89 | "pH": null 90 | }, 91 | "result": { 92 | "unit": "mV", 93 | "loQualifier": "mean", 94 | "loValue": -21.78, 95 | "errQualifier": "sd", 96 | "errorValue": 6.81 97 | } 98 | }, 99 | { 100 | "endpoint": "ZETA POTENTIAL", 101 | "conditions": { 102 | "MEDIUM": "Human serum (Sigma #H4522)", 103 | "Remark": null, 104 | "pH": null 105 | }, 106 | "result": { 107 | "unit": "mV", 108 | "loQualifier": "mean", 109 | "loValue": -9.11, 110 | "errQualifier": "sd", 111 | "errorValue": 1.11 112 | } 113 | } 114 | ] 115 | } 116 | ```` 117 | 118 | ####Study records serialized as [datasets](https://apps.ideaconsult.net/enanomapper/substanceowner/FCSV-319611C6-E7DA-3977-A5AC-EB74D49A4319/dataset?max=1&media=application/json) : 119 | 120 | ````json 121 | { 122 | "dataEntry": [ 123 | { 124 | "compound": { 125 | "URI": "https://apps.ideaconsult.net/enanomapper/substance/FCSV-bc77c03d-4e75-3fab-bb3d-17b983663819" 126 | }, 127 | "values": { 128 | "https://apps.ideaconsult.net/enanomapper/identifier/name": "G15.AC", 129 | "https://apps.ideaconsult.net/enanomapper/property/P-CHEM/ZETA_POTENTIAL_SECTION/ZETA+POTENTIAL/7F8B3FB82019B1CCF8A8C3FD2B5A2DACBDDDB832/3ed642f9-1b42-387a-9966-dea5b91e5f8a": [ 130 | { 131 | "loQualifier": "mean", 132 | "loValue": -21.78 133 | } 134 | ], 135 | "https://apps.ideaconsult.net/enanomapper/property/P-CHEM/ZETA_POTENTIAL_SECTION/ZETA+POTENTIAL/AD2880DCCB16852FB869B7E10223708801EB1B02/3ed642f9-1b42-387a-9966-dea5b91e5f8a": [ 136 | { 137 | "loQualifier": "mean", 138 | "loValue": -9.11 139 | } 140 | ] 141 | } 142 | } 143 | ], 144 | "model_uri": null, 145 | "feature": { 146 | "https://apps.ideaconsult.net/enanomapper/identifier/name": { 147 | "type": "Feature", 148 | "title": "Names", 149 | "units": "", 150 | "isNominal": false, 151 | "isNumeric": false, 152 | "isMultiValue": false, 153 | "sameAs": "http://www.opentox.org/api/1.1#ChemicalName", 154 | "isModelPredictionFeature": false, 155 | "creator": "", 156 | "order": 2, 157 | "source": { 158 | "URI": "https://apps.ideaconsult.net/enanomapper/dataset/Substance", 159 | "type": "Dataset" 160 | }, 161 | "annotation": [] 162 | }, 163 | "https://apps.ideaconsult.net/enanomapper/property/P-CHEM/ZETA_POTENTIAL_SECTION/ZETA+POTENTIAL/7F8B3FB82019B1CCF8A8C3FD2B5A2DACBDDDB832/3ed642f9-1b42-387a-9966-dea5b91e5f8a": { 164 | "type": "Feature", 165 | "title": "ZETA POTENTIAL", 166 | "units": "mV", 167 | "isNominal": false, 168 | "isNumeric": false, 169 | "isMultiValue": true, 170 | "sameAs": "http://www.opentox.org/echaEndpoints.owl#ZETA_POTENTIAL", 171 | "isModelPredictionFeature": false, 172 | "creator": "doi: 10.1021/nn406018q", 173 | "order": 1803, 174 | "source": { 175 | "URI": "https://apps.ideaconsult.net/enanomapper/dataset/doi%3A+10.1021%2Fnn406018q", 176 | "type": "Dataset" 177 | }, 178 | "annotation": [ 179 | { 180 | "p": "MEDIUM", 181 | "o": " " 182 | } 183 | ] 184 | }, 185 | "https://apps.ideaconsult.net/enanomapper/property/P-CHEM/ZETA_POTENTIAL_SECTION/ZETA+POTENTIAL/AD2880DCCB16852FB869B7E10223708801EB1B02/3ed642f9-1b42-387a-9966-dea5b91e5f8a": { 186 | "type": "Feature", 187 | "title": "ZETA POTENTIAL", 188 | "units": "mV", 189 | "isNominal": false, 190 | "isNumeric": false, 191 | "isMultiValue": true, 192 | "sameAs": "http://www.opentox.org/echaEndpoints.owl#ZETA_POTENTIAL", 193 | "isModelPredictionFeature": false, 194 | "creator": "doi: 10.1021/nn406018q", 195 | "order": 1804, 196 | "source": { 197 | "URI": "https://apps.ideaconsult.net/enanomapper/dataset/doi%3A+10.1021%2Fnn406018q", 198 | "type": "Dataset" 199 | }, 200 | "annotation": [ 201 | { 202 | "p": "MEDIUM", 203 | "o": "Human serum (Sigma #H4522)" 204 | } 205 | ] 206 | } 207 | } 208 | } 209 | ```` 210 | -------------------------------------------------------------------------------- /appdomain-example/README.md: -------------------------------------------------------------------------------- 1 | ### [AMBIT](http://ambit.sf.net) applicability domain estimation examples 2 | 3 | Moved to https://github.com/ideaconsult/appdomain 4 | -------------------------------------------------------------------------------- /examples-ml/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4.0.0 4 | net.idea.examples.ambit 5 | examples-ml 6 | 0.0.1-SNAPSHOT 7 | 8 | 9 | org.apache.spark 10 | spark-mllib_2.10 11 | 1.6.1 12 | 13 | 14 | 15 | 16 | 17 | src/main/resources 18 | true 19 | 20 | 21 | 22 | 23 | org.apache.maven.plugins 24 | maven-shade-plugin 25 | 2.4.2 26 | 27 | 28 | package 29 | 30 | shade 31 | 32 | 33 | 34 | 36 | 37 | net.idea.examples.ml.ClusteringApp 38 | ${buildNumber} 39 | Ideaconsult Ltd. 40 | ${project.version} 41 | net.idea.examples.ml 42 | ${buildNumber} 43 | http://ambit.sourceforge.net 44 | 45 | 46 | 47 | 48 | true 49 | true 50 | 51 | 52 | 53 | 54 | 61 | 62 | 63 | org.apache.maven.plugins 64 | maven-source-plugin 65 | 66 | 67 | 68 | jar 69 | test-jar 70 | 71 | 72 | 73 | 74 | 75 | 76 | org.apache.maven.plugins 77 | maven-jar-plugin 78 | 79 | 80 | 81 | test-jar 82 | 83 | 84 | 85 | 86 | 87 | 88 | org.codehaus.mojo 89 | exec-maven-plugin 90 | 1.1.1 91 | 92 | 93 | test 94 | 95 | java 96 | 97 | 98 | net.idea.examples.ml.ClusteringApp 99 | 100 | file:///d:/spark/toy 101 | file:///d:/spark/result 102 | 200000 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | org.apache.maven.plugins 111 | maven-site-plugin 112 | 3.1 113 | 114 | en 115 | 116 | 117 | 118 | 119 | 120 | 121 | org.apache.maven.plugins 122 | maven-compiler-plugin 123 | 3.2 124 | 125 | ${sourceVersion} 126 | ${sourceVersion} 127 | 128 | 129 | 130 | 131 | org.apache.maven.plugins 132 | maven-surefire-plugin 133 | 134 | false 135 | true 136 | -Xmx1024m 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | nexus-idea-snapshots 146 | https://nexus.ideaconsult.net/content/repositories/snapshots 147 | false 148 | 149 | 150 | 151 | nexus-idea-releases 152 | https://nexus.ideaconsult.net/content/repositories/releases 153 | 154 | 155 | 2015 156 | 157 | 158 | vedina 159 | Nina Jeliazkova 160 | jeliazkova.nina@gmail.com 161 | IdeaConsult Ltd. 162 | http://www.ideaconsult.net 163 | 164 | 165 | kerberizer 166 | Luchesar Iliev 167 | https://github.com/kerberizer 168 | IdeaConsult Ltd. 169 | http://www.ideaconsult.net 170 | 171 | 172 | 173 | 174 | LGPL3 175 | http://www.gnu.org/licenses/lgpl.txt 176 | repo 177 | LGPL 3 178 | 179 | 180 | 181 | 182 | 183 | 184 | development 185 | 186 | 187 | 188 | org.apache.maven.plugins 189 | maven-compiler-plugin 190 | 191 | true 192 | false 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | production 201 | 202 | 203 | 204 | org.apache.maven.plugins 205 | maven-compiler-plugin 206 | 207 | false 208 | true 209 | 210 | 211 | 212 | 213 | 214 | 215 | ambit-3.0.3-SNAPSHOT 216 | 217 | true 218 | 219 | 220 | 3.0.3-SNAPSHOT 221 | 222 | 223 | 224 | 225 | JRE7 226 | 227 | 1.7 228 | 229 | 230 | 1.7 231 | 232 | 233 | 234 | JRE8 235 | 236 | 1.8 237 | 238 | 239 | 1.8 240 | 241 | 242 | 243 | 244 | 245 | 246 | UTF-8 247 | 248 | -------------------------------------------------------------------------------- /examples-ml/src/main/java/net/idea/examples/ml/ClusteringApp.java: -------------------------------------------------------------------------------- 1 | package net.idea.examples.ml; 2 | 3 | import java.io.Serializable; 4 | import java.util.UUID; 5 | 6 | import org.apache.spark.SparkConf; 7 | import org.apache.spark.SparkContext; 8 | import org.apache.spark.api.java.JavaRDD; 9 | import org.apache.spark.api.java.JavaSparkContext; 10 | import org.apache.spark.api.java.function.Function; 11 | import org.apache.spark.graphx.Edge; 12 | import org.apache.spark.graphx.Graph; 13 | import org.apache.spark.graphx.lib.ConnectedComponents; 14 | import org.apache.spark.storage.StorageLevel; 15 | 16 | import scala.reflect.ClassTag; 17 | 18 | public class ClusteringApp implements Serializable { 19 | 20 | /** 21 | * 22 | */ 23 | private static final long serialVersionUID = 2806036525498486697L; 24 | 25 | public static void main(String args[]) { 26 | if (args.length < 2) { 27 | System.out.println("ClusteringApp inputfile outputfile [threshold]\nInputfile is a similarity matrix as generated from ambitcli -a simmatrix"); 28 | return; 29 | } 30 | double threshold = 0.95; 31 | try { 32 | threshold = Double.parseDouble(args[2]); 33 | } catch (Exception x) { 34 | threshold = 0.95; 35 | } 36 | 37 | ClusteringApp app = new ClusteringApp(); 38 | try { 39 | app.run(args[0], args[1], threshold); 40 | } catch (Exception x) { 41 | x.printStackTrace(); 42 | } 43 | } 44 | 45 | public void run(String inputPath, String outputPath, double threshold) throws Exception { 46 | // String dir = "file:///" + dir_; 47 | // System.getProperty("java.io.tmpdir") 48 | long now = System.currentTimeMillis(); 49 | 50 | SparkConf conf = new SparkConf().setAppName(ConnectedComponents.class.getName()).setMaster("local[*]"); 51 | SparkContext ctx = SparkContext.getOrCreate(conf); 52 | JavaSparkContext jsc = JavaSparkContext.fromSparkContext(ctx); 53 | 54 | JavaRDD> data = getMatrixAsRDD(jsc, inputPath, threshold); 55 | 56 | ClassTag vd = scala.reflect.ClassTag$.MODULE$.apply(String.class); 57 | ClassTag ed = scala.reflect.ClassTag$.MODULE$.apply(Double.class); 58 | Graph graph = Graph.fromEdges(data.rdd(), "node", StorageLevel.MEMORY_ONLY(), 59 | StorageLevel.MEMORY_ONLY(), vd, ed); 60 | 61 | System.out.println(String.format("Elapsed %s ms threshold %s\tvertices %s edges %s",(System.currentTimeMillis() - now ),threshold,graph.vertices().count(),graph.edges().count())); 62 | 63 | Graph cc = ConnectedComponents.run(graph, vd, ed); 64 | 65 | UUID uuid = UUID.randomUUID(); 66 | String path = String.format("file:///%s/results%s/%s-%s.triplets", outputPath, threshold, uuid, threshold); 67 | cc.triplets().saveAsTextFile(path); 68 | path = String.format("file:///%s/results%s/%s-%s.vertices", outputPath, threshold, uuid, threshold); 69 | cc.vertices().saveAsTextFile(path); 70 | 71 | System.out.println(String.format("Elapsed %s ms threshold %s\tvertices %s edges %s",(System.currentTimeMillis() - now ),threshold,cc.vertices().count(),cc.edges().count())); 72 | jsc.close(); 73 | 74 | } 75 | 76 | protected JavaRDD> getMatrixAsRDD(JavaSparkContext jsc, String inputhpath, final double threshold) { 77 | JavaRDD> data = jsc.textFile(inputhpath).filter(new Function() { 78 | @Override 79 | public Boolean call(String line) throws Exception { 80 | String[] tokens = line.split("\t"); 81 | Double attr = Double.parseDouble(tokens[2]); 82 | return attr >= threshold; 83 | } 84 | }).map(new Function>() { 85 | @Override 86 | public Edge call(String line) throws Exception { 87 | String[] tokens = line.split("\t"); 88 | Double attr = Double.parseDouble(tokens[2]); 89 | long srcId = Long.parseLong(tokens[0]); 90 | long dstId = Long.parseLong(tokens[1]); 91 | Edge edge = new Edge(srcId, dstId, attr); 92 | return edge; 93 | } 94 | }); 95 | return data; 96 | } 97 | } 98 | -------------------------------------------------------------------------------- /examples-ml/src/main/resources/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-version: 1.0 2 | Package: net.idea.examples.ml 3 | Main-Class: net.idea.examples.ml.ClusteringApp 4 | Name: net/idea/examples/ml 5 | Specification-Title: MLIB 6 | Specification-Version: ${project.version} 7 | Specification-Vendor: Ideaconsult LTD 8 | Implementation-Title: net.idea.examples.ml 9 | Implementation-Version: ${project.version}-${buildNumber}-${timestamp} 10 | Implementation-Vendor: Ideaconsult Ltd. 11 | Package-Title: net.idea.examples.ml 12 | Package-Version: ${project.version} 13 | Package-Vendor: Ideaconsult Ltd. -------------------------------------------------------------------------------- /excapedb/logging_config.ini: -------------------------------------------------------------------------------- 1 | #https://docs.python.org/2/library/logging.config.html 2 | 3 | [loggers] 4 | keys=root 5 | 6 | [handlers] 7 | keys=stream,file 8 | 9 | [formatters] 10 | keys=formatter 11 | 12 | [logger_root] 13 | level=DEBUG 14 | handlers=stream,file 15 | 16 | [handler_stream] 17 | class=StreamHandler 18 | level=DEBUG 19 | formatter=formatter 20 | args=(sys.stderr,) 21 | 22 | [handler_file] 23 | class=FileHandler 24 | level=DEBUG 25 | formatter=formatter 26 | args=('python.log', 'w') 27 | 28 | [formatter_formatter] 29 | #format=%(asctime)s %(name)-12s %(levelname)-8s %(message)s 30 | format=%(asctime)s %(levelname)-8s %(message)s -------------------------------------------------------------------------------- /molbrowser/README.md: -------------------------------------------------------------------------------- 1 | http://ideaconsult.github.io/examples-ambit/molbrowser/ 2 | 3 | 4 | This is a [command line application](https://github.com/ideaconsult/examples-ambit/tree/master/molbrowser), 5 | which can convert any SDF file into [JSON](http://ideaconsult.github.io/examples-ambit/molbrowser/mol.json) 6 | and a folder with images. 7 | 8 | [The page](http://ideaconsult.github.io/examples-ambit/molbrowser/) is a static one, 9 | with some [jQuery](http://jquery.com/) scripts and a bit of styling. The [entire directory structure](https://github.com/ideaconsult/examples-ambit/tree/master/molbrowser/src/main/resources/webapp) can be hosted at any HTTP server. 10 | 11 | 12 | ###Build 13 | 14 | ```` 15 | mvn clean package 16 | ```` 17 | 18 | Look for target\molbrowser-jar-with-dependencies.jar 19 | 20 | ###Run 21 | ```` 22 | java -jar molbrowser-jar-with-dependencies.jar 23 | File not assigned! Use -f command line option. 24 | Molbrowser 25 | usage: net.idea.ambit.molbrowser.MainApp 26 | -f,--file Input file name ( .sdf | .txt | .csv | .cml ) - 27 | recognised by extension! 28 | -h,--help Molbrowser 29 | -o,--output Output folder 30 | ```` 31 | 32 | Running the application will generate *mol.json* and */images* folder with structure diagrams as .png files. 33 | The newly generated files have to be combined with the [static content](https://github.com/ideaconsult/examples-ambit/tree/master/molbrowser/src/main/resources/webapp) 34 | and copied to a server of choice. 35 | 36 | ### Download 37 | 38 | [molbrowser-0.0.1-SNAPSHOT-jar-with-dependencies.jar](http://ambit.uni-plovdiv.bg:8083/nexus/content/repositories/snapshots/net/idea/examples/ambit/molbrowser/0.0.1-SNAPSHOT/molbrowser-0.0.1-20131025.084507-1-jar-with-dependencies.jar) 39 | 40 | #### Maven artifact [search](http://ambit.uni-plovdiv.bg:8083/nexus/index.html#nexus-search;quick~molbrowser) 41 | 42 | ```` 43 | 44 | net.idea.examples.ambit 45 | molbrowser 46 | 0.0.1-SNAPSHOT 47 | 48 | ```` 49 | 50 | 51 | -------------------------------------------------------------------------------- /molbrowser/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4.0.0 4 | net.idea.examples.ambit 5 | molbrowser 6 | 1.0.0-SNAPSHOT 7 | molbrowser 8 | 9 | 10 | nexus-idea-snapshots 11 | https://nexus.ideaconsult.net/content/repositories/snapshots 12 | 13 | 14 | nexus-idea-releases 15 | https://nexus.ideaconsult.net//content/repositories/releases 16 | 17 | 18 | website_ambit 19 | scp://shell.sourceforge.net/home/project-web/ambit/htdocs/AMBIT2-LIBS 20 | 21 | 22 | 23 | 24 | LGPL3 25 | http://www.gnu.org/licenses/lgpl.txt 26 | repo 27 | LGPL 3 28 | 29 | 30 | 2013 31 | 32 | 33 | vedina 34 | Nina Jeliazkova 35 | jeliazkova.nina@gmail.com 36 | https://github.com/vedina 37 | IdeaConsult Ltd. 38 | http://ideaconsult.net 39 | 40 | 41 | 42 | 43 | nexus-idea 44 | https://nexus.ideaconsult.net/content/repositories/thirdparty 45 | 46 | false 47 | always 48 | 49 | 50 | 51 | 52 | nexus-idea-releases 53 | https://nexus.ideaconsult.net/content/repositories/releases 54 | 55 | false 56 | 57 | 58 | true 59 | 60 | 61 | 62 | nexus-idea-snapshots 63 | https://nexus.ideaconsult.net/content/repositories/snapshots 64 | 65 | true 66 | always 67 | 68 | 69 | 70 | 71 | 72 | ambit 73 | ambit2-core 74 | ${ambit.version} 75 | jar 76 | compile 77 | 78 | 79 | ambit 80 | ambit2-rendering 81 | ${ambit.version} 82 | jar 83 | compile 84 | 85 | 86 | 87 | commons-cli 88 | commons-cli 89 | 1.1 90 | jar 91 | compile 92 | 93 | 94 | junit 95 | junit 96 | 4.11 97 | jar 98 | test 99 | 100 | 101 | 102 | UTF-8 103 | 4.8.1 104 | 4.0.0-SNAPSHOT 105 | 106 | 107 | GitHub 108 | https://github.com/ideaconsult/examples-ambit/issues 109 | 110 | 111 | git://github.com/ideaconsult/examples-ambit.git 112 | scm:git:git@github.com:ideaconsult/examples-ambit.git 113 | https://github.com/ideaconsult/examples-ambit.git 114 | 115 | 116 | Ideaconsult Ltd. 117 | http://www.idesconsult.net 118 | 119 | 120 | molbrowser 121 | 122 | 123 | src/main/resources 124 | true 125 | 126 | 127 | 128 | 129 | maven-assembly-plugin 130 | 2.2-beta-2 131 | 132 | 133 | create-executable-jar 134 | package 135 | 136 | single 137 | 138 | 139 | 140 | 141 | jar-with-dependencies 142 | 143 | 144 | 145 | src/main/resources/META-INF/MANIFEST.MF 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | org.apache.maven.plugins 156 | maven-compiler-plugin 157 | 2.3.1 158 | 159 | 1.7 160 | 1.7 161 | 162 | 163 | 164 | org.apache.maven.plugins 165 | maven-surefire-plugin 166 | 167 | true 168 | true 169 | -Xmx1024m 170 | 171 | 172 | 173 | org.apache.maven.plugins 174 | maven-resources-plugin 175 | 2.4.3 176 | 177 | 178 | exe 179 | dll 180 | obf 181 | prm 182 | 183 | 184 | 185 | 186 | org.apache.maven.plugins 187 | maven-jar-plugin 188 | 2.2 189 | 190 | 191 | 192 | true 193 | 194 | 195 | development 196 | ${project.url} 197 | 198 | target/classes/META-INF/MANIFEST.MF 199 | 200 | 201 | 202 | 203 | 204 | test-jar 205 | 206 | 207 | 208 | 209 | 210 | org.apache.maven.plugins 211 | maven-source-plugin 212 | 2.1.2 213 | 214 | 215 | attach-sources 216 | verify 217 | 218 | jar 219 | 220 | 221 | 222 | 223 | 224 | org.apache.maven.plugins 225 | maven-release-plugin 226 | 2.0 227 | 228 | release 229 | true 230 | 231 | true 232 | 233 | 234 | 235 | 236 | org.apache.maven.plugins 237 | maven-site-plugin 238 | 2.3 239 | 240 | en 241 | 242 | 243 | 244 | 245 | 246 | -------------------------------------------------------------------------------- /molbrowser/src/main/java/net/idea/ambit/molbrowser/MainApp.java: -------------------------------------------------------------------------------- 1 | package net.idea.ambit.molbrowser; 2 | 3 | import org.apache.commons.cli.CommandLine; 4 | import org.apache.commons.cli.CommandLineParser; 5 | import org.apache.commons.cli.HelpFormatter; 6 | import org.apache.commons.cli.Option; 7 | import org.apache.commons.cli.OptionBuilder; 8 | import org.apache.commons.cli.Options; 9 | import org.apache.commons.cli.PosixParser; 10 | 11 | /** 12 | * Molbrowser example application 13 | * @author nina 14 | * 15 | */ 16 | public class MainApp { 17 | private static final String title = "Molbrowser"; 18 | /** 19 | * Main 20 | * @param args 21 | */ 22 | public static void main(String[] args) { 23 | MainApp app = new MainApp(); 24 | int records = app.run(args); 25 | System.err.println("Records processed "+ records); 26 | } 27 | 28 | public int run(String[] args) { 29 | Options options = createOptions(); 30 | MolbrowserWizard worker = new MolbrowserWizard(); 31 | final CommandLineParser parser = new PosixParser(); 32 | try { 33 | CommandLine line = parser.parse( options, args,false ); 34 | if (line.hasOption(_option.help.name())) { 35 | printHelp(options, null); 36 | return -1; 37 | } 38 | 39 | for (_option o: _option.values()) 40 | if (line.hasOption(o.getShortName())) try { 41 | worker.setOption(o,line.getOptionValue(o.getShortName())); 42 | } catch (Exception x) { 43 | printHelp(options,x.getMessage()); 44 | return -1; 45 | } 46 | 47 | return worker.process(); 48 | 49 | } catch (Exception x ) { 50 | printHelp(options,x.getMessage()); 51 | return -1; 52 | } finally { 53 | try { 54 | //run whatever cleanup is needed 55 | } catch (Exception xx) { 56 | printHelp(options,xx.getMessage()); 57 | } 58 | } 59 | } 60 | /** 61 | * 62 | * @param options 63 | * @param message 64 | */ 65 | protected static void printHelp(Options options,String message) { 66 | if (message!=null) System.out.println(message); 67 | System.out.println(title); 68 | HelpFormatter formatter = new HelpFormatter(); 69 | formatter.printHelp( MainApp.class.getName(), options ); 70 | System.out.println("Examples:"); 71 | Runtime.getRuntime().runFinalization(); 72 | Runtime.getRuntime().exit(0); 73 | } 74 | 75 | /** 76 | * 77 | * @return 78 | */ 79 | protected static Options createOptions() { 80 | Options options = new Options(); 81 | for (_option o: _option.values()) { 82 | options.addOption(o.createOption()); 83 | } 84 | return options; 85 | } 86 | /** 87 | * 88 | * @author nina 89 | * 90 | */ 91 | enum _option { 92 | 93 | file { 94 | @Override 95 | public String getArgName() { 96 | return "file"; 97 | } 98 | @Override 99 | public String getDescription() { 100 | return "Input file name ( .sdf | .txt | .csv | .cml ) - recognised by extension!"; 101 | } 102 | @Override 103 | public String getShortName() { 104 | return "f"; 105 | } 106 | 107 | }, 108 | 109 | output { 110 | @Override 111 | public String getArgName() { 112 | return "output"; 113 | } 114 | @Override 115 | public String getDescription() { 116 | return "Output folder"; 117 | } 118 | @Override 119 | public String getShortName() { 120 | return "o"; 121 | } 122 | 123 | }, 124 | help { 125 | @Override 126 | public String getArgName() { 127 | return null; 128 | } 129 | @Override 130 | public String getDescription() { 131 | return title; 132 | } 133 | @Override 134 | public String getShortName() { 135 | return "h"; 136 | } 137 | @Override 138 | public String getDefaultValue() { 139 | return null; 140 | } 141 | public Option createOption() { 142 | Option option = OptionBuilder.withLongOpt(name()) 143 | .withDescription(getDescription()) 144 | .create(getShortName()); 145 | return option; 146 | } 147 | } 148 | ; 149 | public abstract String getArgName(); 150 | public abstract String getDescription(); 151 | public abstract String getShortName(); 152 | public String getDefaultValue() { return null; } 153 | 154 | public Option createOption() { 155 | String defaultValue = getDefaultValue(); 156 | Option option = OptionBuilder.withLongOpt(name()) 157 | .hasArg() 158 | .withArgName(getArgName()) 159 | .withDescription(String.format("%s %s %s",getDescription(),defaultValue==null?"":"Default value: ",defaultValue==null?"":defaultValue)) 160 | .create(getShortName()); 161 | 162 | return option; 163 | } 164 | } 165 | 166 | 167 | } 168 | -------------------------------------------------------------------------------- /molbrowser/src/main/java/net/idea/ambit/molbrowser/MolbrowserWizard.java: -------------------------------------------------------------------------------- 1 | package net.idea.ambit.molbrowser; 2 | 3 | import java.awt.image.BufferedImage; 4 | import java.io.BufferedWriter; 5 | import java.io.File; 6 | import java.io.FileInputStream; 7 | import java.io.FileNotFoundException; 8 | import java.io.FileOutputStream; 9 | import java.io.FileWriter; 10 | import java.io.InputStream; 11 | import java.io.Writer; 12 | import java.util.Iterator; 13 | import java.util.Map.Entry; 14 | import java.util.UUID; 15 | import java.util.logging.Level; 16 | import java.util.logging.Logger; 17 | 18 | import javax.imageio.ImageIO; 19 | 20 | import net.idea.ambit.molbrowser.MainApp._option; 21 | 22 | import org.openscience.cdk.aromaticity.CDKHueckelAromaticityDetector; 23 | import org.openscience.cdk.exception.CDKException; 24 | import org.openscience.cdk.interfaces.IAtomContainer; 25 | import org.openscience.cdk.io.IChemObjectReader.Mode; 26 | import org.openscience.cdk.io.IChemObjectReaderErrorHandler; 27 | import org.openscience.cdk.io.iterator.IIteratingChemObjectReader; 28 | import org.openscience.cdk.silent.SilentChemObjectBuilder; 29 | import org.openscience.cdk.smiles.FixBondOrdersTool; 30 | import org.openscience.cdk.tools.CDKHydrogenAdder; 31 | import org.openscience.cdk.tools.manipulator.AtomContainerManipulator; 32 | 33 | import ambit2.base.exceptions.AmbitIOException; 34 | import ambit2.base.json.JSONUtils; 35 | import ambit2.core.data.IStructureDiagramHighlights; 36 | import ambit2.core.io.FileInputState; 37 | import ambit2.core.io.FileState; 38 | import ambit2.core.io.InteractiveIteratingMDLReader; 39 | import ambit2.core.processors.structure.InchiProcessor; 40 | import ambit2.rendering.CompoundImageTools; 41 | 42 | /** 43 | * The class that does the work. 44 | * @author nina 45 | * 46 | */ 47 | public class MolbrowserWizard { 48 | private final static Logger LOGGER = Logger.getLogger(MolbrowserWizard.class.getName()); 49 | protected File file; 50 | protected File resultFolder; 51 | protected boolean all = true; 52 | protected InchiProcessor inchiProcessor; 53 | protected FixBondOrdersTool kekulizer = new FixBondOrdersTool(); 54 | protected CompoundImageTools tool = new CompoundImageTools(); 55 | 56 | public void setAll(boolean all) { 57 | this.all = all; 58 | } 59 | public File getResultFolder() { 60 | return resultFolder; 61 | } 62 | public void setResultFolder(File resultFolder) { 63 | this.resultFolder = resultFolder; 64 | } 65 | 66 | 67 | public MolbrowserWizard() { 68 | LOGGER.setLevel(Level.FINEST); 69 | } 70 | /** 71 | * 72 | * @return 73 | */ 74 | public File getFile() { 75 | return file; 76 | } 77 | /** 78 | * 79 | * @param file 80 | */ 81 | public void setFile(File file) { 82 | this.file = file; 83 | } 84 | /** 85 | * 86 | * @param option 87 | * @param argument 88 | * @throws Exception 89 | */ 90 | public void setOption(_option option, String argument) throws Exception { 91 | if (argument!=null) argument = argument.trim(); 92 | switch (option) { 93 | case file: { 94 | if ((argument==null) || "".equals(argument.trim())) return; 95 | setFile(new File(argument)); 96 | break; 97 | } 98 | case output: { 99 | if ((argument==null) || "".equals(argument.trim())) return; 100 | setResultFolder(new File(argument)); 101 | break; 102 | } 103 | default: 104 | } 105 | } 106 | 107 | protected IIteratingChemObjectReader getReader(InputStream in, String extension) throws CDKException, AmbitIOException { 108 | FileInputState instate = new FileInputState(); 109 | IIteratingChemObjectReader reader ; 110 | if (FileState._FILE_TYPE.SDF_INDEX.hasExtension(extension)) { 111 | reader = new InteractiveIteratingMDLReader(in,SilentChemObjectBuilder.getInstance()); 112 | ((InteractiveIteratingMDLReader) reader).setSkip(true); 113 | } else reader = instate.getReader(in,extension); 114 | 115 | reader.setReaderMode(Mode.RELAXED); 116 | reader.setErrorHandler(new IChemObjectReaderErrorHandler() { 117 | 118 | public void handleError(String message) { 119 | 120 | } 121 | 122 | public void handleError(String message, Exception exception) { 123 | } 124 | 125 | public void handleError(String message, int row, int colStart, 126 | int colEnd) { 127 | } 128 | 129 | public void handleError(String message, int row, int colStart, 130 | int colEnd, Exception exception) { 131 | 132 | } 133 | 134 | }); 135 | return reader; 136 | 137 | } 138 | /** 139 | * 140 | * @return 141 | * @throws Exception 142 | */ 143 | public int process() throws Exception { 144 | if (file==null) throw new Exception("File not assigned! Use -f command line option."); 145 | if (!file.exists()) throw new FileNotFoundException(file.getAbsolutePath()); 146 | if (resultFolder==null) { 147 | resultFolder = new File(file.getParentFile(),"molbrowser"); 148 | } else if (!resultFolder.isDirectory()) 149 | throw new Exception("A folder expected! Use -o command line option."); 150 | 151 | int records_read = 0; 152 | int records_processed = 0; 153 | int records_error = 0; 154 | 155 | 156 | InputStream in = new FileInputStream(file); 157 | /** 158 | * cdk-io module 159 | * http://ambit.uni-plovdiv.bg:8083/nexus/index.html#nexus-search;classname~IteratingMDLReader 160 | */ 161 | IIteratingChemObjectReader reader = null; 162 | Writer writer = createWriter(); 163 | jsonHeader(writer,file.getName()); 164 | try { 165 | /** 166 | * cdk-slient module 167 | * http://ambit.uni-plovdiv.bg:8083/nexus/index.html#nexus-search;classname~SilentChemObjectBuilder 168 | */ 169 | reader = getReader(in,file.getName()); 170 | LOGGER.log(Level.INFO, String.format("Reading %s",file.getAbsoluteFile())); 171 | LOGGER.log(Level.INFO, String.format("Writing to %s",getResultFolder())); 172 | while (reader.hasNext()) { 173 | /** 174 | * Note recent versions allow 175 | * IAtomContainer molecule = reader.next(); 176 | */ 177 | IAtomContainer molecule = reader.next(); 178 | records_read++; 179 | if (molecule==null) { 180 | records_error++; 181 | continue; 182 | } 183 | try { 184 | /** 185 | * cdk-standard module 186 | */ 187 | AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(molecule); 188 | CDKHueckelAromaticityDetector.detectAromaticity(molecule); 189 | /*implicit H count is NULL if read from InChI ... 190 | molecule = AtomContainerManipulator.removeHydrogens(molecule); 191 | CDKHydrogenAdder.getInstance(molecule.getBuilder()).addImplicitHydrogens(molecule); 192 | */ 193 | String imgURI = getImageURI(molecule, null, getResultFolder(), UUID.randomUUID().toString()); 194 | mol2json(molecule, imgURI, writer,records_processed); 195 | 196 | records_processed++;; 197 | } catch (Exception x) { 198 | System.err.println("*"); 199 | records_error++; 200 | LOGGER.log(Level.SEVERE, String.format("[Record %d] Error %s\n", records_read, file.getAbsoluteFile()), x); 201 | } 202 | 203 | } 204 | jsonFooter(writer); 205 | } catch (Exception x) { 206 | x.printStackTrace(); 207 | LOGGER.log(Level.SEVERE, String.format("[Record %d] Error %s\n", records_read, file.getAbsoluteFile()), x); 208 | } finally { 209 | try { reader.close(); } catch (Exception x) {} 210 | try { writer.close(); } catch (Exception x) {} 211 | } 212 | LOGGER.log(Level.INFO, String.format("[Records read/processed/error %d/%d/%d] %s", 213 | records_read,records_processed,records_error,file.getAbsoluteFile())); 214 | return records_read; 215 | } 216 | 217 | protected void mol2json(IAtomContainer mol,String imgURI, Writer writer, int record) throws Exception { 218 | if (record>0) writer.write(","); 219 | writer.write("{\n"); 220 | writer.write("\t\t\"record\":\t"); 221 | writer.write(Integer.toString(record+1)); 222 | writer.write(",\n"); 223 | writer.write("\t\t\"img\":\t\""); 224 | writer.write(imgURI); 225 | writer.write("\",\n"); 226 | writer.write("\t\t\"tags\":{\n"); 227 | Iterator> props = mol.getProperties().entrySet().iterator(); 228 | int i= 0; 229 | while (props.hasNext()) { 230 | Entry entry = props.next(); 231 | if (i>0) writer.write(",\n"); 232 | writer.write("\t\t\t\""); 233 | writer.write(JSONUtils.jsonEscape(entry.getKey().toString())); 234 | writer.write("\":\t"); 235 | try { 236 | Double d = Double.parseDouble(entry.getValue().toString()); 237 | writer.write(Double.toString(d)); 238 | } catch (Exception x) { 239 | writer.write("\""); 240 | writer.write(JSONUtils.jsonEscape(entry.getValue().toString())); 241 | writer.write("\""); 242 | } 243 | 244 | i++; 245 | } 246 | writer.write("\n\t\t}\n\t}"); 247 | writer.flush(); 248 | } 249 | protected Writer createWriter() throws Exception { 250 | return new BufferedWriter(new FileWriter(new File(getResultFolder(),"mol.json"))); 251 | } 252 | protected void jsonHeader(Writer writer,String title) throws Exception { 253 | writer.write("{\n"); 254 | writer.write("\"dataset\":\t{\n"); 255 | writer.write("\t\"name\":\""); 256 | writer.write(title); 257 | writer.write("\","); 258 | writer.write("\t\"molecule\":\t[\n"); 259 | } 260 | protected void jsonFooter(Writer writer) throws Exception { 261 | writer.write("\n\t]\n}\n}"); 262 | } 263 | 264 | protected String getImageURI(IAtomContainer ac, 265 | IStructureDiagramHighlights hilights, 266 | File folder, String name) { 267 | 268 | File imgFolder = new File(String.format("%s/%s/",folder,"images")); 269 | if (!imgFolder.exists()) imgFolder.mkdir(); 270 | String file = String.format("%s/%s.png", imgFolder.getAbsolutePath(),name); 271 | 272 | try { 273 | //IAtomContainer c = (IAtomContainer) ac.clone(); 274 | AtomContainerManipulator.removeHydrogensPreserveMultiplyBonded(ac); 275 | 276 | BufferedImage img = hilights==null?tool.getImage(ac,null,true,false):hilights.getImage(ac); 277 | ImageIO.write(img, "png",new FileOutputStream(file)); 278 | } catch (Exception x) { 279 | System.out.println(file); 280 | //x.printStackTrace(); 281 | } 282 | return String.format("images/%s.png", name); 283 | 284 | } 285 | } 286 | -------------------------------------------------------------------------------- /molbrowser/src/main/resources/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-version: 1.0 2 | Package: net.idea.ambit.molbrowser 3 | Main-Class: net.idea.ambit.molbrowser.MainApp 4 | 5 | Name: net/idea/ambit/molbrowser 6 | Specification-Title: Generates molbrowser web page 7 | Specification-Vendor: IdeaConsult Ltd. 8 | Specification-Version: 2013 9 | Package-Title: net.idea.ambit.molbrowser 10 | Package-Version: ${project.version} 11 | Package-Vendor: IdeaConsult Ltd. 12 | Implementation-Title: ambit2-core ${ambit.version} 13 | Implementation-Version: ${project.version} 14 | Implementation-Vendor: IdeaConsult Ltd. -------------------------------------------------------------------------------- /molbrowser/src/main/resources/webapp/24x24_ambit.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ideaconsult/apps-ambit/a9aa6daba7dd89cc2625989ed7a75684d7d7ff89/molbrowser/src/main/resources/webapp/24x24_ambit.gif -------------------------------------------------------------------------------- /molbrowser/src/main/resources/webapp/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ideaconsult/apps-ambit/a9aa6daba7dd89cc2625989ed7a75684d7d7ff89/molbrowser/src/main/resources/webapp/favicon.ico -------------------------------------------------------------------------------- /molbrowser/src/main/resources/webapp/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | AMBIT Mol Browser 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 34 | 35 | 36 |
37 |
  38 |
39 |
AMBIT Mol browser
40 |
41 |
42 |
43 |
44 |
45 |
46 | ambit.sf.net 47 |
48 | 49 |
50 |
51 |
 
52 |

53 |
 
54 |
55 | 56 |
57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 |
#StructureSDF tags
67 |
68 |
69 | 70 | 71 |
72 |
73 | 74 | 75 | 76 | -------------------------------------------------------------------------------- /molbrowser/src/main/resources/webapp/scripts/molbrowser.js: -------------------------------------------------------------------------------- 1 | function defineMolbrowserTable(root,url) { 2 | 3 | var oTable = $('#dataset').dataTable( { 4 | "sAjaxDataProp" : "dataset.molecule", 5 | "bProcessing": true, 6 | "bServerSide": false, 7 | "bStateSave": false, 8 | "aoColumnDefs": [ 9 | { "mDataProp": "record" , "asSorting": [ "asc", "desc" ], 10 | "aTargets": [ 0 ], 11 | "sWidth" : "5%", 12 | "bSearchable" : true, 13 | "bUseRendered" : false, 14 | "bSortable" : true, 15 | "fnRender" : function(o,val) { 16 | return val; 17 | } 18 | }, 19 | { "mDataProp": "img" , "asSorting": [ "asc", "desc" ], 20 | "aTargets": [ 1 ], 21 | "sWidth" : "150px", 22 | "sHeight" : "150px", 23 | "bSearchable" : true, 24 | "bUseRendered" : false, 25 | "bSortable" : true, 26 | "fnRender" : function(o,val) { 27 | return ''; 28 | } 29 | }, 30 | { "mDataProp": "tags" , "asSorting": [ "asc", "desc" ], 31 | "aTargets": [ 2 ], 32 | "bSearchable" : true, 33 | "bUseRendered" : false, 34 | "sClass" : "wrap", 35 | "bSortable" : true, 36 | "fnRender" : function(o,val) { 37 | var sOut = ""; 38 | $.each(val,function(index,tag) { 39 | sOut += ""; 40 | if ("link"==index) { 41 | sOut += ''; 42 | } else { 43 | sOut += ''; 44 | } 45 | sOut += ""; 46 | }); 47 | sOut += '
NameValue
link'+index + "" + tag + '
'; 48 | return sOut; 49 | } 50 | } 51 | 52 | ], 53 | "sSearch": "Filter:", 54 | "bJQueryUI" : true, 55 | "bSearchable": true, 56 | "sAjaxSource": url, 57 | "sDom" : '<"help remove-bottom"i><"help"p>Trt<"help"lf>', 58 | "bPaginate" : true, 59 | "sPaginationType": "full_numbers", 60 | "sPaginate" : ".dataTables_paginate _paging", 61 | "oLanguage": { 62 | "sProcessing": "", 63 | "sLoadingRecords": "No structures found.", 64 | "sZeroRecords": "No structures found.", 65 | "sInfo": "Showing _TOTAL_ structures (_START_ to _END_)", 66 | "sLengthMenu": 'Display structures.' 73 | }, 74 | "fnServerData" : function(sSource, aoData, fnCallback, 75 | oSettings) { 76 | 77 | oSettings.jqXHR = $.ajax({ 78 | "type" : "GET", 79 | "url" : sSource, 80 | "data" : aoData, 81 | "dataType" : "json", 82 | "contentType" : "application/json", 83 | "success" : function(json) { 84 | $("#title").text(json.dataset.name); 85 | fnCallback(json); 86 | }, 87 | "cache" : true, 88 | "error" : function(xhr, textStatus, error) { 89 | switch (xhr.status) { 90 | case 403: { 91 | alert("Restricted data access. You are not authorized to access the requested data."); 92 | break; 93 | } 94 | case 404: { 95 | //not found 96 | break; 97 | } 98 | default: { 99 | alert("Error loading data " + xhr.status + " " + error); 100 | } 101 | } 102 | oSettings.oApi._fnProcessingDisplay(oSettings, false); 103 | } 104 | }); 105 | }, 106 | } ); 107 | return oTable; 108 | } 109 | -------------------------------------------------------------------------------- /molbrowser/src/main/resources/webapp/styles/ambit.css: -------------------------------------------------------------------------------- 1 | .wrap { 2 | word-wrap:break-word; 3 | } 4 | 5 | 6 | td 7 | { 8 | vertical-align:top; 9 | } 10 | 11 | 12 | .dataTables_info { 13 | width: 40%; 14 | } 15 | 16 | 17 | .dataTables_paginate .fg-button { 18 | background:#ffffff; 19 | color:#000000; 20 | min-width:4em; 21 | border:1px; 22 | } 23 | -------------------------------------------------------------------------------- /molbrowser/src/main/resources/webapp/styles/base.css: -------------------------------------------------------------------------------- 1 | /* 2 | * Skeleton V1.2 3 | * Copyright 2011, Dave Gamache 4 | * www.getskeleton.com 5 | * Free to use under the MIT license. 6 | * http://www.opensource.org/licenses/mit-license.php 7 | * 6/20/2012 8 | */ 9 | 10 | 11 | /* Table of Content 12 | ================================================== 13 | #Reset & Basics 14 | #Basic Styles 15 | #Site Styles 16 | #Typography 17 | #Links 18 | #Lists 19 | #Images 20 | #Buttons 21 | #Forms 22 | #Misc */ 23 | 24 | 25 | /* #Reset & Basics (Inspired by E. Meyers) 26 | ================================================== */ 27 | html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas, details, embed, figure, figcaption, footer, header, hgroup, menu, nav, output, ruby, section, summary, time, mark, audio, video { 28 | margin: 0; 29 | padding: 0; 30 | border: 0; 31 | font-size: 100%; 32 | font: inherit; 33 | vertical-align: baseline; } 34 | article, aside, details, figcaption, figure, footer, header, hgroup, menu, nav, section { 35 | display: block; } 36 | body { 37 | line-height: 1; } 38 | ol, ul { 39 | list-style: none; } 40 | blockquote, q { 41 | quotes: none; } 42 | blockquote:before, blockquote:after, 43 | q:before, q:after { 44 | content: ''; 45 | content: none; } 46 | table { 47 | border-collapse: collapse; 48 | border-spacing: 0; } 49 | 50 | 51 | /* #Basic Styles 52 | ================================================== */ 53 | body { 54 | background: #fff; 55 | font: 14px/21px "HelveticaNeue", "Helvetica Neue", Helvetica, Arial, sans-serif; 56 | color: #444; 57 | -webkit-font-smoothing: antialiased; /* Fix for webkit rendering */ 58 | -webkit-text-size-adjust: 100%; 59 | } 60 | 61 | 62 | /* #Typography 63 | ================================================== */ 64 | h1, h2, h3, h4, h5, h6 { 65 | color: #181818; 66 | font-family: "Georgia", "Times New Roman", serif; 67 | font-weight: normal; } 68 | h1 a, h2 a, h3 a, h4 a, h5 a, h6 a { font-weight: inherit; } 69 | h1 { font-size: 46px; line-height: 50px; margin-bottom: 14px;} 70 | h2 { font-size: 35px; line-height: 40px; margin-bottom: 10px; } 71 | h3 { font-size: 28px; line-height: 34px; margin-bottom: 8px; } 72 | h4 { font-size: 21px; line-height: 30px; margin-bottom: 4px; } 73 | h5 { font-size: 17px; line-height: 24px; } 74 | h6 { font-size: 14px; line-height: 21px; } 75 | .subheader { color: #777; } 76 | 77 | p { margin: 0 0 20px 0; } 78 | p img { margin: 0; } 79 | p.lead { font-size: 21px; line-height: 27px; color: #777; } 80 | 81 | em { font-style: italic; } 82 | strong { font-weight: bold; color: #333; } 83 | small { font-size: 80%; } 84 | 85 | /* Blockquotes */ 86 | blockquote, blockquote p { font-size: 17px; line-height: 24px; color: #777; font-style: italic; } 87 | blockquote { margin: 0 0 20px; padding: 9px 20px 0 19px; border-left: 1px solid #ddd; } 88 | blockquote cite { display: block; font-size: 12px; color: #555; } 89 | blockquote cite:before { content: "\2014 \0020"; } 90 | blockquote cite a, blockquote cite a:visited, blockquote cite a:visited { color: #555; } 91 | 92 | hr { border: solid #ddd; border-width: 1px 0 0; clear: both; margin: 10px 0 30px; height: 0; } 93 | 94 | 95 | /* #Links 96 | ================================================== */ 97 | a, a:visited { color: #333; text-decoration: underline; outline: 0; } 98 | a:hover, a:focus { color: #000; } 99 | p a, p a:visited { line-height: inherit; } 100 | 101 | 102 | /* #Lists 103 | ================================================== */ 104 | ul, ol { margin-bottom: 20px; } 105 | ul { list-style: none outside; } 106 | ol { list-style: decimal; } 107 | ol, ul.square, ul.circle, ul.disc { margin-left: 30px; } 108 | ul.square { list-style: square outside; } 109 | ul.circle { list-style: circle outside; } 110 | ul.disc { list-style: disc outside; } 111 | ul ul, ul ol, 112 | ol ol, ol ul { margin: 4px 0 5px 30px; font-size: 90%; } 113 | ul ul li, ul ol li, 114 | ol ol li, ol ul li { margin-bottom: 6px; } 115 | li { line-height: 18px; margin-bottom: 12px; } 116 | ul.large li { line-height: 21px; } 117 | li p { line-height: 21px; } 118 | 119 | /* #Images 120 | ================================================== */ 121 | 122 | img.scale-with-grid { 123 | max-width: 100%; 124 | height: auto; } 125 | 126 | 127 | /* #Buttons 128 | ================================================== */ 129 | 130 | .button, 131 | button, 132 | input[type="submit"], 133 | input[type="reset"], 134 | input[type="button"] { 135 | background: #eee; /* Old browsers */ 136 | background: #eee -moz-linear-gradient(top, rgba(255,255,255,.2) 0%, rgba(0,0,0,.2) 100%); /* FF3.6+ */ 137 | background: #eee -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(255,255,255,.2)), color-stop(100%,rgba(0,0,0,.2))); /* Chrome,Safari4+ */ 138 | background: #eee -webkit-linear-gradient(top, rgba(255,255,255,.2) 0%,rgba(0,0,0,.2) 100%); /* Chrome10+,Safari5.1+ */ 139 | background: #eee -o-linear-gradient(top, rgba(255,255,255,.2) 0%,rgba(0,0,0,.2) 100%); /* Opera11.10+ */ 140 | background: #eee -ms-linear-gradient(top, rgba(255,255,255,.2) 0%,rgba(0,0,0,.2) 100%); /* IE10+ */ 141 | background: #eee linear-gradient(top, rgba(255,255,255,.2) 0%,rgba(0,0,0,.2) 100%); /* W3C */ 142 | border: 1px solid #aaa; 143 | border-top: 1px solid #ccc; 144 | border-left: 1px solid #ccc; 145 | -moz-border-radius: 3px; 146 | -webkit-border-radius: 3px; 147 | border-radius: 3px; 148 | color: #444; 149 | display: inline-block; 150 | font-size: 11px; 151 | font-weight: bold; 152 | text-decoration: none; 153 | text-shadow: 0 1px rgba(255, 255, 255, .75); 154 | cursor: pointer; 155 | margin-bottom: 20px; 156 | line-height: normal; 157 | padding: 8px 10px; 158 | font-family: "HelveticaNeue", "Helvetica Neue", Helvetica, Arial, sans-serif; } 159 | 160 | .button:hover, 161 | button:hover, 162 | input[type="submit"]:hover, 163 | input[type="reset"]:hover, 164 | input[type="button"]:hover { 165 | color: #222; 166 | background: #ddd; /* Old browsers */ 167 | background: #ddd -moz-linear-gradient(top, rgba(255,255,255,.3) 0%, rgba(0,0,0,.3) 100%); /* FF3.6+ */ 168 | background: #ddd -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(255,255,255,.3)), color-stop(100%,rgba(0,0,0,.3))); /* Chrome,Safari4+ */ 169 | background: #ddd -webkit-linear-gradient(top, rgba(255,255,255,.3) 0%,rgba(0,0,0,.3) 100%); /* Chrome10+,Safari5.1+ */ 170 | background: #ddd -o-linear-gradient(top, rgba(255,255,255,.3) 0%,rgba(0,0,0,.3) 100%); /* Opera11.10+ */ 171 | background: #ddd -ms-linear-gradient(top, rgba(255,255,255,.3) 0%,rgba(0,0,0,.3) 100%); /* IE10+ */ 172 | background: #ddd linear-gradient(top, rgba(255,255,255,.3) 0%,rgba(0,0,0,.3) 100%); /* W3C */ 173 | border: 1px solid #888; 174 | border-top: 1px solid #aaa; 175 | border-left: 1px solid #aaa; } 176 | 177 | .button:active, 178 | button:active, 179 | input[type="submit"]:active, 180 | input[type="reset"]:active, 181 | input[type="button"]:active { 182 | border: 1px solid #666; 183 | background: #ccc; /* Old browsers */ 184 | background: #ccc -moz-linear-gradient(top, rgba(255,255,255,.35) 0%, rgba(10,10,10,.4) 100%); /* FF3.6+ */ 185 | background: #ccc -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(255,255,255,.35)), color-stop(100%,rgba(10,10,10,.4))); /* Chrome,Safari4+ */ 186 | background: #ccc -webkit-linear-gradient(top, rgba(255,255,255,.35) 0%,rgba(10,10,10,.4) 100%); /* Chrome10+,Safari5.1+ */ 187 | background: #ccc -o-linear-gradient(top, rgba(255,255,255,.35) 0%,rgba(10,10,10,.4) 100%); /* Opera11.10+ */ 188 | background: #ccc -ms-linear-gradient(top, rgba(255,255,255,.35) 0%,rgba(10,10,10,.4) 100%); /* IE10+ */ 189 | background: #ccc linear-gradient(top, rgba(255,255,255,.35) 0%,rgba(10,10,10,.4) 100%); /* W3C */ } 190 | 191 | .button.full-width, 192 | button.full-width, 193 | input[type="submit"].full-width, 194 | input[type="reset"].full-width, 195 | input[type="button"].full-width { 196 | width: 100%; 197 | padding-left: 0 !important; 198 | padding-right: 0 !important; 199 | text-align: center; } 200 | 201 | /* Fix for odd Mozilla border & padding issues */ 202 | button::-moz-focus-inner, 203 | input::-moz-focus-inner { 204 | border: 0; 205 | padding: 0; 206 | } 207 | 208 | 209 | /* #Forms 210 | ================================================== */ 211 | 212 | form { 213 | margin-bottom: 20px; } 214 | fieldset { 215 | margin-bottom: 20px; } 216 | input[type="text"], 217 | input[type="password"], 218 | input[type="email"], 219 | textarea, 220 | select { 221 | border: 1px solid #ccc; 222 | padding: 6px 4px; 223 | outline: none; 224 | -moz-border-radius: 2px; 225 | -webkit-border-radius: 2px; 226 | border-radius: 2px; 227 | font: 13px "HelveticaNeue", "Helvetica Neue", Helvetica, Arial, sans-serif; 228 | color: #777; 229 | margin: 0; 230 | width: 210px; 231 | max-width: 100%; 232 | display: block; 233 | margin-bottom: 20px; 234 | background: #fff; } 235 | select { 236 | padding: 0; } 237 | input[type="text"]:focus, 238 | input[type="password"]:focus, 239 | input[type="email"]:focus, 240 | textarea:focus { 241 | border: 1px solid #aaa; 242 | color: #444; 243 | -moz-box-shadow: 0 0 3px rgba(0,0,0,.2); 244 | -webkit-box-shadow: 0 0 3px rgba(0,0,0,.2); 245 | box-shadow: 0 0 3px rgba(0,0,0,.2); } 246 | textarea { 247 | min-height: 60px; } 248 | label, 249 | legend { 250 | display: block; 251 | font-weight: bold; 252 | font-size: 13px; } 253 | select { 254 | width: 220px; } 255 | input[type="checkbox"] { 256 | display: inline; } 257 | label span, 258 | legend span { 259 | font-weight: normal; 260 | font-size: 13px; 261 | color: #444; } 262 | 263 | /* #Misc 264 | ================================================== */ 265 | .remove-bottom { margin-bottom: 0 !important; } 266 | .half-bottom { margin-bottom: 10px !important; } 267 | .add-bottom { margin-bottom: 20px !important; } 268 | 269 | 270 | -------------------------------------------------------------------------------- /molbrowser/src/main/resources/webapp/styles/images/ui-bg_glass_55_bcf903_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ideaconsult/apps-ambit/a9aa6daba7dd89cc2625989ed7a75684d7d7ff89/molbrowser/src/main/resources/webapp/styles/images/ui-bg_glass_55_bcf903_1x400.png -------------------------------------------------------------------------------- /molbrowser/src/main/resources/webapp/styles/images/ui-bg_gloss-wave_100_ece8da_500x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ideaconsult/apps-ambit/a9aa6daba7dd89cc2625989ed7a75684d7d7ff89/molbrowser/src/main/resources/webapp/styles/images/ui-bg_gloss-wave_100_ece8da_500x100.png -------------------------------------------------------------------------------- /molbrowser/src/main/resources/webapp/styles/images/ui-bg_highlight-hard_100_fafaf4_1x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ideaconsult/apps-ambit/a9aa6daba7dd89cc2625989ed7a75684d7d7ff89/molbrowser/src/main/resources/webapp/styles/images/ui-bg_highlight-hard_100_fafaf4_1x100.png -------------------------------------------------------------------------------- /molbrowser/src/main/resources/webapp/styles/images/ui-bg_highlight-hard_100_ffffff_1x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ideaconsult/apps-ambit/a9aa6daba7dd89cc2625989ed7a75684d7d7ff89/molbrowser/src/main/resources/webapp/styles/images/ui-bg_highlight-hard_100_ffffff_1x100.png -------------------------------------------------------------------------------- /molbrowser/src/main/resources/webapp/styles/images/ui-bg_highlight-hard_15_86ad2d_1x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ideaconsult/apps-ambit/a9aa6daba7dd89cc2625989ed7a75684d7d7ff89/molbrowser/src/main/resources/webapp/styles/images/ui-bg_highlight-hard_15_86ad2d_1x100.png -------------------------------------------------------------------------------- /molbrowser/src/main/resources/webapp/styles/images/ui-bg_highlight-hard_95_cccccc_1x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ideaconsult/apps-ambit/a9aa6daba7dd89cc2625989ed7a75684d7d7ff89/molbrowser/src/main/resources/webapp/styles/images/ui-bg_highlight-hard_95_cccccc_1x100.png -------------------------------------------------------------------------------- /molbrowser/src/main/resources/webapp/styles/images/ui-bg_highlight-soft_25_bcf903_1x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ideaconsult/apps-ambit/a9aa6daba7dd89cc2625989ed7a75684d7d7ff89/molbrowser/src/main/resources/webapp/styles/images/ui-bg_highlight-soft_25_bcf903_1x100.png -------------------------------------------------------------------------------- /molbrowser/src/main/resources/webapp/styles/images/ui-bg_highlight-soft_95_ffedad_1x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ideaconsult/apps-ambit/a9aa6daba7dd89cc2625989ed7a75684d7d7ff89/molbrowser/src/main/resources/webapp/styles/images/ui-bg_highlight-soft_95_ffedad_1x100.png -------------------------------------------------------------------------------- /molbrowser/src/main/resources/webapp/styles/images/ui-bg_inset-soft_15_2b2922_1x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ideaconsult/apps-ambit/a9aa6daba7dd89cc2625989ed7a75684d7d7ff89/molbrowser/src/main/resources/webapp/styles/images/ui-bg_inset-soft_15_2b2922_1x100.png -------------------------------------------------------------------------------- /molbrowser/src/main/resources/webapp/styles/images/ui-icons_516473_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ideaconsult/apps-ambit/a9aa6daba7dd89cc2625989ed7a75684d7d7ff89/molbrowser/src/main/resources/webapp/styles/images/ui-icons_516473_256x240.png -------------------------------------------------------------------------------- /molbrowser/src/main/resources/webapp/styles/images/ui-icons_847e71_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ideaconsult/apps-ambit/a9aa6daba7dd89cc2625989ed7a75684d7d7ff89/molbrowser/src/main/resources/webapp/styles/images/ui-icons_847e71_256x240.png -------------------------------------------------------------------------------- /molbrowser/src/main/resources/webapp/styles/images/ui-icons_8dc262_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ideaconsult/apps-ambit/a9aa6daba7dd89cc2625989ed7a75684d7d7ff89/molbrowser/src/main/resources/webapp/styles/images/ui-icons_8dc262_256x240.png -------------------------------------------------------------------------------- /molbrowser/src/main/resources/webapp/styles/images/ui-icons_cd0a0a_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ideaconsult/apps-ambit/a9aa6daba7dd89cc2625989ed7a75684d7d7ff89/molbrowser/src/main/resources/webapp/styles/images/ui-icons_cd0a0a_256x240.png -------------------------------------------------------------------------------- /molbrowser/src/main/resources/webapp/styles/images/ui-icons_eeeeee_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ideaconsult/apps-ambit/a9aa6daba7dd89cc2625989ed7a75684d7d7ff89/molbrowser/src/main/resources/webapp/styles/images/ui-icons_eeeeee_256x240.png -------------------------------------------------------------------------------- /molbrowser/src/main/resources/webapp/styles/jquery.dataTables.css: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Table 4 | */ 5 | table.dataTable { 6 | margin: 0 auto; 7 | clear: both; 8 | width: 100%; 9 | } 10 | 11 | table.dataTable thead th { 12 | padding: 3px 18px 3px 10px; 13 | border-bottom: 1px solid black; 14 | font-weight: bold; 15 | cursor: pointer; 16 | *cursor: hand; 17 | } 18 | 19 | table.dataTable tfoot th { 20 | padding: 3px 18px 3px 10px; 21 | border-top: 1px solid black; 22 | font-weight: bold; 23 | } 24 | 25 | table.dataTable td { 26 | padding: 3px 10px; 27 | } 28 | 29 | table.dataTable td.center, 30 | table.dataTable td.dataTables_empty { 31 | text-align: center; 32 | } 33 | 34 | table.dataTable tr.odd { background-color: white; } 35 | table.dataTable tr.even { background-color: #F5F2EB; } 36 | 37 | table.dataTable tr.odd td.sorting_3 { background-color: #E3DEC9; } 38 | table.dataTable tr.odd td.sorting_2 { background-color: #ECE8DA; } 39 | table.dataTable tr.odd td.sorting_1 { background-color: #F5F2EB; } 40 | table.dataTable tr.even td.sorting_3 { background-color: #DBD4B8; } 41 | table.dataTable tr.even td.sorting_2 { background-color: #E3DEC9; } 42 | table.dataTable tr.even td.sorting_1 { background-color: #ECE8DA; } 43 | 44 | 45 | /* 46 | * Table wrapper 47 | */ 48 | .dataTables_wrapper { 49 | position: relative; 50 | clear: both; 51 | *zoom: 1; 52 | } 53 | 54 | 55 | /* 56 | * Page length menu 57 | */ 58 | .dataTables_length { 59 | float: left; 60 | padding: 5px 10px !important; 61 | font-size: 10pt !important; 62 | font-weight: normal !important; 63 | } 64 | 65 | 66 | /* 67 | * Filter 68 | */ 69 | .dataTables_filter { 70 | float: right; 71 | text-align: right; 72 | padding: 5px 10px !important; 73 | font-size: 10pt !important; 74 | } 75 | 76 | 77 | /* 78 | * Table information 79 | */ 80 | .dataTables_info { 81 | clear: both; 82 | float: left; 83 | padding: 5px 10px !important; 84 | font-size: 10pt !important; 85 | font-weight: normal !important; 86 | } 87 | 88 | 89 | /* 90 | * Pagination 91 | */ 92 | .dataTables_paginate { 93 | float: right; 94 | text-align: right; 95 | padding: 5px 10px !important; 96 | font-size: 10pt !important; 97 | } 98 | 99 | /* Two button pagination - previous / next */ 100 | .paginate_disabled_previous, 101 | .paginate_enabled_previous, 102 | .paginate_disabled_next, 103 | .paginate_enabled_next { 104 | height: 19px; 105 | float: left; 106 | cursor: pointer; 107 | *cursor: hand; 108 | color: #111 !important; 109 | } 110 | .paginate_disabled_previous:hover, 111 | .paginate_enabled_previous:hover, 112 | .paginate_disabled_next:hover, 113 | .paginate_enabled_next:hover { 114 | text-decoration: none !important; 115 | } 116 | .paginate_disabled_previous:active, 117 | .paginate_enabled_previous:active, 118 | .paginate_disabled_next:active, 119 | .paginate_enabled_next:active { 120 | outline: none; 121 | } 122 | 123 | .paginate_disabled_previous, 124 | .paginate_disabled_next { 125 | color: #666 !important; 126 | } 127 | .paginate_disabled_previous, 128 | .paginate_enabled_previous { 129 | padding-left: 23px; 130 | } 131 | .paginate_disabled_next, 132 | .paginate_enabled_next { 133 | padding-right: 23px; 134 | margin-left: 10px; 135 | } 136 | 137 | .paginate_enabled_previous { background: url('../images/back_enabled.png') no-repeat top left; } 138 | .paginate_enabled_previous:hover { background: url('../images/back_enabled_hover.png') no-repeat top left; } 139 | .paginate_disabled_previous { background: url('../images/back_disabled.png') no-repeat top left; } 140 | 141 | .paginate_enabled_next { background: url('../images/forward_enabled.png') no-repeat top right; } 142 | .paginate_enabled_next:hover { background: url('../images/forward_enabled_hover.png') no-repeat top right; } 143 | .paginate_disabled_next { background: url('../images/forward_disabled.png') no-repeat top right; } 144 | 145 | /* Full number pagination */ 146 | .paging_full_numbers { 147 | height: 22px; 148 | line-height: 22px; 149 | } 150 | .paging_full_numbers a:active { 151 | outline: none 152 | } 153 | .paging_full_numbers a:hover { 154 | text-decoration: none; 155 | } 156 | 157 | .paging_full_numbers a.paginate_button, 158 | .paging_full_numbers a.paginate_active { 159 | border: 1px solid #aaa; 160 | -webkit-border-radius: 5px; 161 | -moz-border-radius: 5px; 162 | border-radius: 5px; 163 | padding: 2px 5px; 164 | margin: 0 3px; 165 | cursor: pointer; 166 | *cursor: hand; 167 | color: #333 !important; 168 | } 169 | 170 | .paging_full_numbers a.paginate_button { 171 | background-color: #ddd; 172 | } 173 | 174 | .paging_full_numbers a.paginate_button:hover { 175 | background-color: #ccc; 176 | text-decoration: none !important; 177 | } 178 | 179 | .paging_full_numbers a.paginate_active { 180 | background-color: #99B3FF; 181 | } 182 | 183 | 184 | /* 185 | * Processing indicator 186 | */ 187 | .dataTables_processing { 188 | position: absolute; 189 | top: 50%; 190 | left: 50%; 191 | width: 250px; 192 | height: 30px; 193 | margin-left: -125px; 194 | margin-top: -15px; 195 | padding: 14px 0 2px 0; 196 | border: 1px solid #ddd; 197 | text-align: center; 198 | color: #999; 199 | font-size: 14px; 200 | background-color: white; 201 | } 202 | 203 | 204 | /* 205 | * Sorting 206 | */ 207 | .sorting { background: url('../images/sort_both.png') no-repeat center right; } 208 | .sorting_asc { background: url('../images/sort_asc.png') no-repeat center right; } 209 | .sorting_desc { background: url('../images/sort_desc.png') no-repeat center right; } 210 | 211 | .sorting_asc_disabled { background: url('../images/sort_asc_disabled.png') no-repeat center right; } 212 | .sorting_desc_disabled { background: url('../images/sort_desc_disabled.png') no-repeat center right; } 213 | 214 | table.dataTable th:active { 215 | outline: none; 216 | } 217 | 218 | 219 | /* 220 | * Scrolling 221 | */ 222 | .dataTables_scroll { 223 | clear: both; 224 | } 225 | 226 | .dataTables_scrollBody { 227 | *margin-top: -1px; 228 | } 229 | 230 | /* 231 | * jQueryUI 232 | */ 233 | #DataTables_Table_0_previous { 234 | padding: 0 5px 0 0; 235 | } -------------------------------------------------------------------------------- /molbrowser/src/main/resources/webapp/styles/layout.css: -------------------------------------------------------------------------------- 1 | /* 2 | * Skeleton V1.2 3 | * Copyright 2011, Dave Gamache 4 | * www.getskeleton.com 5 | * Free to use under the MIT license. 6 | * http://www.opensource.org/licenses/mit-license.php 7 | * 6/20/2012 8 | */ 9 | 10 | /* Table of Content 11 | ================================================== 12 | #Site Styles 13 | #Page Styles 14 | #Media Queries 15 | #Font-Face */ 16 | 17 | /* #Site Styles 18 | ================================================== */ 19 | 20 | /* #Page Styles 21 | ================================================== */ 22 | 23 | /* #Media Queries 24 | ================================================== */ 25 | 26 | /* Smaller than standard 960 (devices and browsers) */ 27 | @media only screen and (max-width: 959px) {} 28 | 29 | /* Tablet Portrait size to standard 960 (devices and browsers) */ 30 | @media only screen and (min-width: 768px) and (max-width: 959px) {} 31 | 32 | /* All Mobile Sizes (devices and browser) */ 33 | @media only screen and (max-width: 767px) {} 34 | 35 | /* Mobile Landscape Size to Tablet Portrait (devices and browsers) */ 36 | @media only screen and (min-width: 480px) and (max-width: 767px) {} 37 | 38 | /* Mobile Portrait Size to Mobile Landscape Size (devices and browsers) */ 39 | @media only screen and (max-width: 479px) {} 40 | 41 | 42 | /* #Font-Face 43 | ================================================== */ 44 | /* This is the proper syntax for an @font-face file 45 | Just create a "fonts" folder at the root, 46 | copy your FontName into code below and remove 47 | comment brackets */ 48 | 49 | /* @font-face { 50 | font-family: 'FontName'; 51 | src: url('../fonts/FontName.eot'); 52 | src: url('../fonts/FontName.eot?iefix') format('eot'), 53 | url('../fonts/FontName.woff') format('woff'), 54 | url('../fonts/FontName.ttf') format('truetype'), 55 | url('../fonts/FontName.svg#webfontZam02nTh') format('svg'); 56 | font-weight: normal; 57 | font-style: normal; } 58 | */ -------------------------------------------------------------------------------- /molbrowser/src/main/resources/webapp/styles/skeleton.css: -------------------------------------------------------------------------------- 1 | /* 2 | * Skeleton V1.2 3 | * Copyright 2011, Dave Gamache 4 | * www.getskeleton.com 5 | * Free to use under the MIT license. 6 | * http://www.opensource.org/licenses/mit-license.php 7 | * 6/20/2012 8 | */ 9 | 10 | 11 | /* Table of Contents 12 | ================================================== 13 | #Base 960 Grid 14 | #Tablet (Portrait) 15 | #Mobile (Portrait) 16 | #Mobile (Landscape) 17 | #Clearing */ 18 | 19 | 20 | 21 | /* #Base 960 Grid 22 | ================================================== */ 23 | 24 | .container { position: relative; width: 960px; margin: 0 auto; padding: 0; } 25 | .container .column, 26 | .container .columns { float: left; display: inline; margin-left: 10px; margin-right: 10px; } 27 | .row { margin-bottom: 20px; } 28 | 29 | /* Nested Column Classes */ 30 | .column.alpha, .columns.alpha { margin-left: 0; } 31 | .column.omega, .columns.omega { margin-right: 0; } 32 | 33 | /* Base Grid */ 34 | .container .one.column, 35 | .container .one.columns { width: 40px; } 36 | .container .two.columns { width: 100px; } 37 | .container .three.columns { width: 160px; } 38 | .container .four.columns { width: 220px; } 39 | .container .five.columns { width: 280px; } 40 | .container .six.columns { width: 340px; } 41 | .container .seven.columns { width: 400px; } 42 | .container .eight.columns { width: 460px; } 43 | .container .nine.columns { width: 520px; } 44 | .container .ten.columns { width: 580px; } 45 | .container .eleven.columns { width: 640px; } 46 | .container .twelve.columns { width: 700px; } 47 | .container .thirteen.columns { width: 760px; } 48 | .container .fourteen.columns { width: 820px; } 49 | .container .fifteen.columns { width: 880px; } 50 | .container .sixteen.columns { width: 940px; } 51 | 52 | .container .one-third.column { width: 300px; } 53 | .container .two-thirds.column { width: 620px; } 54 | 55 | /* Offsets */ 56 | .container .offset-by-one { padding-left: 60px; } 57 | .container .offset-by-two { padding-left: 120px; } 58 | .container .offset-by-three { padding-left: 180px; } 59 | .container .offset-by-four { padding-left: 240px; } 60 | .container .offset-by-five { padding-left: 300px; } 61 | .container .offset-by-six { padding-left: 360px; } 62 | .container .offset-by-seven { padding-left: 420px; } 63 | .container .offset-by-eight { padding-left: 480px; } 64 | .container .offset-by-nine { padding-left: 540px; } 65 | .container .offset-by-ten { padding-left: 600px; } 66 | .container .offset-by-eleven { padding-left: 660px; } 67 | .container .offset-by-twelve { padding-left: 720px; } 68 | .container .offset-by-thirteen { padding-left: 780px; } 69 | .container .offset-by-fourteen { padding-left: 840px; } 70 | .container .offset-by-fifteen { padding-left: 900px; } 71 | 72 | 73 | 74 | /* #Tablet (Portrait) 75 | ================================================== */ 76 | 77 | /* Note: Design for a width of 768px */ 78 | 79 | @media only screen and (min-width: 768px) and (max-width: 959px) { 80 | .container { width: 768px; } 81 | .container .column, 82 | .container .columns { margin-left: 10px; margin-right: 10px; } 83 | .column.alpha, .columns.alpha { margin-left: 0; margin-right: 10px; } 84 | .column.omega, .columns.omega { margin-right: 0; margin-left: 10px; } 85 | .alpha.omega { margin-left: 0; margin-right: 0; } 86 | 87 | .container .one.column, 88 | .container .one.columns { width: 28px; } 89 | .container .two.columns { width: 76px; } 90 | .container .three.columns { width: 124px; } 91 | .container .four.columns { width: 172px; } 92 | .container .five.columns { width: 220px; } 93 | .container .six.columns { width: 268px; } 94 | .container .seven.columns { width: 316px; } 95 | .container .eight.columns { width: 364px; } 96 | .container .nine.columns { width: 412px; } 97 | .container .ten.columns { width: 460px; } 98 | .container .eleven.columns { width: 508px; } 99 | .container .twelve.columns { width: 556px; } 100 | .container .thirteen.columns { width: 604px; } 101 | .container .fourteen.columns { width: 652px; } 102 | .container .fifteen.columns { width: 700px; } 103 | .container .sixteen.columns { width: 748px; } 104 | 105 | .container .one-third.column { width: 236px; } 106 | .container .two-thirds.column { width: 492px; } 107 | 108 | /* Offsets */ 109 | .container .offset-by-one { padding-left: 48px; } 110 | .container .offset-by-two { padding-left: 96px; } 111 | .container .offset-by-three { padding-left: 144px; } 112 | .container .offset-by-four { padding-left: 192px; } 113 | .container .offset-by-five { padding-left: 240px; } 114 | .container .offset-by-six { padding-left: 288px; } 115 | .container .offset-by-seven { padding-left: 336px; } 116 | .container .offset-by-eight { padding-left: 384px; } 117 | .container .offset-by-nine { padding-left: 432px; } 118 | .container .offset-by-ten { padding-left: 480px; } 119 | .container .offset-by-eleven { padding-left: 528px; } 120 | .container .offset-by-twelve { padding-left: 576px; } 121 | .container .offset-by-thirteen { padding-left: 624px; } 122 | .container .offset-by-fourteen { padding-left: 672px; } 123 | .container .offset-by-fifteen { padding-left: 720px; } 124 | } 125 | 126 | 127 | /* #Mobile (Portrait) 128 | ================================================== */ 129 | 130 | /* Note: Design for a width of 320px */ 131 | 132 | @media only screen and (max-width: 767px) { 133 | .container { width: 300px; } 134 | .container .columns, 135 | .container .column { margin: 0; } 136 | 137 | .container .one.column, 138 | .container .one.columns, 139 | .container .two.columns, 140 | .container .three.columns, 141 | .container .four.columns, 142 | .container .five.columns, 143 | .container .six.columns, 144 | .container .seven.columns, 145 | .container .eight.columns, 146 | .container .nine.columns, 147 | .container .ten.columns, 148 | .container .eleven.columns, 149 | .container .twelve.columns, 150 | .container .thirteen.columns, 151 | .container .fourteen.columns, 152 | .container .fifteen.columns, 153 | .container .sixteen.columns, 154 | .container .one-third.column, 155 | .container .two-thirds.column { width: 300px; } 156 | 157 | /* Offsets */ 158 | .container .offset-by-one, 159 | .container .offset-by-two, 160 | .container .offset-by-three, 161 | .container .offset-by-four, 162 | .container .offset-by-five, 163 | .container .offset-by-six, 164 | .container .offset-by-seven, 165 | .container .offset-by-eight, 166 | .container .offset-by-nine, 167 | .container .offset-by-ten, 168 | .container .offset-by-eleven, 169 | .container .offset-by-twelve, 170 | .container .offset-by-thirteen, 171 | .container .offset-by-fourteen, 172 | .container .offset-by-fifteen { padding-left: 0; } 173 | 174 | } 175 | 176 | 177 | /* #Mobile (Landscape) 178 | ================================================== */ 179 | 180 | /* Note: Design for a width of 480px */ 181 | 182 | @media only screen and (min-width: 480px) and (max-width: 767px) { 183 | .container { width: 420px; } 184 | .container .columns, 185 | .container .column { margin: 0; } 186 | 187 | .container .one.column, 188 | .container .one.columns, 189 | .container .two.columns, 190 | .container .three.columns, 191 | .container .four.columns, 192 | .container .five.columns, 193 | .container .six.columns, 194 | .container .seven.columns, 195 | .container .eight.columns, 196 | .container .nine.columns, 197 | .container .ten.columns, 198 | .container .eleven.columns, 199 | .container .twelve.columns, 200 | .container .thirteen.columns, 201 | .container .fourteen.columns, 202 | .container .fifteen.columns, 203 | .container .sixteen.columns, 204 | .container .one-third.column, 205 | .container .two-thirds.column { width: 420px; } 206 | } 207 | 208 | 209 | /* #Clearing 210 | ================================================== */ 211 | 212 | /* Self Clearing Goodness */ 213 | .container:after { content: "\0020"; display: block; height: 0; clear: both; visibility: hidden; } 214 | 215 | /* Use clearfix class on parent to clear nested columns, 216 | or wrap each row of columns in a
*/ 217 | .clearfix:before, 218 | .clearfix:after, 219 | .row:before, 220 | .row:after { 221 | content: '\0020'; 222 | display: block; 223 | overflow: hidden; 224 | visibility: hidden; 225 | width: 0; 226 | height: 0; } 227 | .row:after, 228 | .clearfix:after { 229 | clear: both; } 230 | .row, 231 | .clearfix { 232 | zoom: 1; } 233 | 234 | /* You can also use a
to clear columns */ 235 | .clear { 236 | clear: both; 237 | display: block; 238 | overflow: hidden; 239 | visibility: hidden; 240 | width: 0; 241 | height: 0; 242 | } 243 | -------------------------------------------------------------------------------- /smirks-example/Readme.md: -------------------------------------------------------------------------------- 1 | # Ambit-SMIRKS 2 | 3 | Ambit-SMIRKS is an extension of the [AMBIT-SMARTS](http://ambit.sourceforge.net/download_ambitlibs.html) Java library, both part of the [AMBIT project](http://ambit.sf.net) 4 | 5 | The SMIRKS module is used to enable metabolite predictions in [Toxtree](http://toxtree.sourceforge.net), 6 | once that site of metabolisms are predicted by [SMARTCyp](http://www.farma.ku.dk/smartcyp/) 7 | 8 | ## Main functionality 9 | 10 | * Parsing of [SMIRKS linear notations](http://www.daylight.com/dayhtml_tutorials/languages/smirks/) into internal reaction (transformation) representations based on [The Chemistry Development Kit](http://cdk.sf.net) objects 11 | * Application of the stored reactions against target molecules for actual transformation of the target chemical objects 12 | 13 | ##### Transformation mapping modes 14 | 15 | The transformations can be applied on various sites of the target molecule in several modes: 16 | * single 17 | * non-overlapping 18 | * non-identical 19 | * non-homomorphic or 20 | * externally specified list of sites 21 | 22 | ##### [Test online](https://apps.ideaconsult.net/data/depict/reaction?search=c1ccccc1&smirks=%5Bc%3A1%5D%5BH%3A2%5D%3E%3E%5Bc%3A1%5D%5BO%5D%5BH%3A2%5D) 23 | 24 | #### Maven artifacts 25 | 26 | * Depends on [The CDK](http://cdk.sf.net) 1.4.11 27 | 28 | ```` 29 | 30 | ambit 31 | ambit2-smarts 32 | 2.7.3 33 | 34 | 35 | ambit-plovdiv-releases 36 | http://ambit.uni-plovdiv.bg:8083/nexus/content/repositories/releases 37 | 38 | ```` 39 | 40 | * Depends on [The CDK](http://cdk.sf.net) 1.5.10 41 | 42 | ```` 43 | 44 | ambit 45 | ambit2-smarts 46 | 3.0.0-SNAPSHOT 47 | 48 | 49 | ambit-plovdiv-snapshots 50 | http://ambit.uni-plovdiv.bg:8083/nexus/content/repositories/snapshots 51 | 52 | ```` 53 | 54 | #### Code examples 55 | 56 | ```java 57 | IAtomContainer target = (initialize) 58 | SMIRKSManager smrkMan = new SMIRKSManager(); 59 | SMIRKSReaction reaction = smrkMan.parse(smirks); 60 | if (!smrkMan.getErrors().equals("")) { 61 | throw(new Exception("Smirks Parser errors:\n" + smrkMan.getErrors())); 62 | } 63 | if (smrkMan.applyTransformation(target, reaction)) 64 | return target; //all products inside the same atomcontainer, could be disconnected 65 | else return null; 66 | ``` 67 | * Generate separate products for every possible reaction (used in [Toxtree](http://toxtree.sf.net/smartcyp.html)) 68 | 69 | ```java 70 | SMIRKSManager smrkMan = new SMIRKSManager(); 71 | SMIRKSReaction smr = smrkMan.parse(reaction.getSMIRKS()); 72 | IAtomContainer product = reactant; //(IAtomContainer) reactant.clone(); 73 | IAtomContainerSet rproducts = smrkMan.applyTransformationWithSingleCopyForEachPos(product, null, smr); 74 | //products returned in a separate atom sontainer set 75 | ``` 76 | 77 | ## Application in metabolite generation 78 | 79 | [Toxtree](http://toxtree.sf.net) is an open-source application that predicts various kinds of toxic effects, mostly by applying structural alerts, arranged in a decision tree fashion. 80 | You could [download the application](http://toxtree.sourceforge.net/download.html) or test [Toxtree online](http://toxtree.sourceforge.net/predict?search=omeprazole) 81 | 82 | [SMARTCyp](http://www.farma.ku.dk/smartcyp/) (Cytochrome P450-Mediated Drug Metabolism) model is developed by [Patrik Rydberg](https://plus.google.com/108819997902788567005) et al and is included as [Toxtree module](http://toxtree.sourceforge.net/smartcyp.html) since Toxtree 2.1.0. 83 | 84 | ' 85 | 86 | --- 87 | 88 | ### Publications 89 | 90 | * Best poster award at [OpenTox Euro 2013](https://www.slideshare.net/jeliazkova_nina/bx37-ambit-smirksmainzseptember2013) 91 | 92 | * AMBIT SMARTS Publication [N. Jeliazkova and N. Kochev, “AMBIT-SMARTS: Efficient Searching of Chemical Structures and Fragments,” Mol. Inform., vol. 30, no. 8, pp. 707–720, 2011.](http://onlinelibrary.wiley.com/doi/10.1002/minf.201100028/abstract) 93 | 94 | ### Social 95 | * [Ambit at Google+](https://plus.google.com/b/116849658963631645389/116849658963631645389/posts) | 96 | 97 | * [This page](http://tinyurl.com/ambitsmirks) 98 | 99 | 100 | -------------------------------------------------------------------------------- /smirks-example/src/main/java/net/idea/examples/ambit/smirks/ChemWizard.java: -------------------------------------------------------------------------------- 1 | package net.idea.examples.ambit.smirks; 2 | 3 | import java.io.File; 4 | import java.io.FileInputStream; 5 | import java.io.FileNotFoundException; 6 | import java.io.InputStream; 7 | import java.io.OutputStreamWriter; 8 | import java.util.logging.Level; 9 | import java.util.logging.Logger; 10 | 11 | import net.idea.examples.ambit.smirks.MainApp._option; 12 | 13 | import org.openscience.cdk.DefaultChemObjectBuilder; 14 | import org.openscience.cdk.interfaces.IAtom; 15 | import org.openscience.cdk.interfaces.IAtomContainer; 16 | import org.openscience.cdk.io.SDFWriter; 17 | import org.openscience.cdk.io.iterator.IteratingSDFReader; 18 | import org.openscience.cdk.silent.SilentChemObjectBuilder; 19 | import org.openscience.cdk.smiles.SmilesGenerator; 20 | import org.openscience.cdk.tools.manipulator.AtomContainerManipulator; 21 | 22 | import ambit2.smarts.SMIRKSManager; 23 | import ambit2.smarts.SMIRKSReaction; 24 | 25 | /** 26 | * The class that does the work. 27 | * 28 | * @author nina 29 | * 30 | */ 31 | public class ChemWizard { 32 | private final static Logger LOGGER = Logger.getLogger(ChemWizard.class 33 | .getName()); 34 | protected File file; 35 | private SmilesGenerator smilesGenerator = new SmilesGenerator(); 36 | 37 | private static final String[][] smirks = { 38 | { "Aliphatic hydroxylation", "[C;X4:1][H:2]>>[C:1][O][H:2]" }, 39 | { "Aromatic hydroxylation", "[c:1][H:2]>>[c:1][O][H:2]" }, 40 | { "O-dealkylation", "[O:1][C:2]([H])>>[O:1][H].[C:2]=[O]" }, 41 | { "Dioxolane demethylation", 42 | "[C:3]([#8:1])[#8:2]>>[#8:1].[#8:2].[C:3]=[O]" }, 43 | { "N-dealkylation", "[#7:1][C:2]([H])>>[#7:1][H].[C:2]=[O]" }, 44 | { "S-oxydation", "[#16:1] >> [#16:1](=[O])" }, 45 | { "Thioesther cleavage", "[#16:1][C;X3:2] >>[#16:1][H].[C;X3:2][O]" }, 46 | { "N-oxydation", "[#7:1][#6:2]>>[#7+:1]([O-])[#6:2]" }, 47 | { "Amine hydroxylation", 48 | "[N:1]([H:3])[#6:2]>>[N:1]([O][H:3])[#6:2]" }, 49 | { "Aldehyde oxidation", "[C;H1:1]=[O:2]>>[C:1](O)=[O:2]" }, 50 | { "Alcohol oxidation", "[C:1]([H])[O:2][H]>>[C:1]=[O:2]" }, 51 | { "Dihydropyrrole aromatization]", 52 | "[N:1]1[C:2][C:3]=[C:4][C:5]1>>[N:1]1[C:2]=[C:3][C:4]=[C:5]1" }, 53 | { 54 | "Aromatization of dihydropyridines", 55 | "[N;X3:1]1([H])[#6:2]=[#6:3][#6;X4:4]([H])[#6:5]=[#6:6]1>>[n;H0:1]1=[#6:2][#6:3]=[#6:4][#6:5]=[#6:6]1" }, 56 | { "Thioester bond breaking", 57 | "[S:1][C:2]=[O:3]>>[S:1][H].[C:2](O)=[O:3]" }, 58 | { "Desulphurization of phosphor", 59 | "[*:1][P:2](=S)([*:3])[*:4]>>[*:1][P:2](=O)([*:3])[*:4]" }, 60 | { "Epoxidation", "[C:1]=[C:2]>>[C:1]1[C:2][O]1" } 61 | 62 | }; 63 | private static final SMIRKSReaction[] reactions = new SMIRKSReaction[smirks.length]; 64 | private final SMIRKSManager smrkMan; 65 | 66 | public ChemWizard() { 67 | smrkMan = new SMIRKSManager(SilentChemObjectBuilder.getInstance()); 68 | smrkMan.setFlagProcessResultStructures(true); 69 | smrkMan.setFlagAddImplicitHAtomsOnResultProcess(true); 70 | 71 | LOGGER.setLevel(Level.FINEST); 72 | } 73 | 74 | /** 75 | * 76 | * @return 77 | */ 78 | public File getFile() { 79 | return file; 80 | } 81 | 82 | /** 83 | * 84 | * @param file 85 | */ 86 | public void setFile(File file) { 87 | this.file = file; 88 | } 89 | 90 | /** 91 | * 92 | * @param option 93 | * @param argument 94 | * @throws Exception 95 | */ 96 | public void setOption(_option option, String argument) throws Exception { 97 | if (argument != null) 98 | argument = argument.trim(); 99 | switch (option) { 100 | case file: { 101 | if ((argument == null) || "".equals(argument.trim())) 102 | return; 103 | setFile(new File(argument)); 104 | } 105 | default: 106 | } 107 | } 108 | 109 | private enum FIELD { 110 | SMILES_Kekule, SMILES_Aromatic 111 | } 112 | 113 | /** 114 | * 115 | * @return 116 | * @throws Exception 117 | */ 118 | public int process() throws Exception { 119 | if (file == null) 120 | throw new Exception( 121 | "File not assigned! Use -f command line option."); 122 | if (!file.exists()) 123 | throw new FileNotFoundException(file.getAbsolutePath()); 124 | int records_read = 0; 125 | int records_processed = 0; 126 | int records_error = 0; 127 | 128 | InputStream in = new FileInputStream(file); 129 | /** 130 | * cdk-io module 131 | * http://ambit.uni-plovdiv.bg:8083/nexus/index.html#nexus- 132 | * search;classname~IteratingMDLReader 133 | */ 134 | IteratingSDFReader reader = null; 135 | 136 | SDFWriter writer = new SDFWriter(new OutputStreamWriter(System.out)); 137 | 138 | try { 139 | 140 | reader = new IteratingSDFReader(in, 141 | DefaultChemObjectBuilder.getInstance()); 142 | LOGGER.log(Level.INFO, 143 | String.format("Reading %s", file.getAbsoluteFile())); 144 | while (reader.hasNext()) { 145 | /** 146 | * Note recent versions allow IAtomContainer molecule = 147 | * reader.next(); 148 | */ 149 | Object object = reader.next(); 150 | IAtomContainer molecule = null; 151 | if (object instanceof IAtomContainer) 152 | molecule = (IAtomContainer) object; 153 | else 154 | break; 155 | 156 | records_read++; 157 | try { 158 | /** 159 | * cdk-standard module 160 | */ 161 | AtomContainerManipulator 162 | .percieveAtomTypesAndConfigureAtoms(molecule); 163 | // CDKHueckelAromaticityDetector.detectAromaticity(molecule); 164 | for (IAtom atom : molecule.atoms()) 165 | if (atom.getImplicitHydrogenCount() == null) { 166 | LOGGER.fine(atom.getSymbol() + "\t" 167 | + atom.getAtomTypeName() + "\t" 168 | + atom.getImplicitHydrogenCount()); 169 | atom.setImplicitHydrogenCount(0); 170 | 171 | } 172 | 173 | molecule = AtomContainerManipulator 174 | .copyAndSuppressedHydrogens(molecule); 175 | 176 | /** 177 | * Generate SMILES and assign as properties 178 | */ 179 | assignSMILES(molecule); 180 | molecule.setProperty("REACTION", "REACTANT"); 181 | molecule.setProperty("SMIRKS", ""); 182 | /** 183 | * Apply reactions 184 | */ 185 | writer.write(molecule); 186 | for (int r = 0; r < smirks.length; r++) { 187 | if (reactions[r] == null) { 188 | reactions[r] = smrkMan.parse(smirks[r][1]); 189 | } 190 | IAtomContainer reactant = molecule.clone(); 191 | if (smrkMan.applyTransformation(reactant, reactions[r])) { 192 | AtomContainerManipulator 193 | .percieveAtomTypesAndConfigureAtoms(reactant); 194 | reactant.setProperty("REACTION", "PRODUCT OF " 195 | + smirks[r][0]); 196 | reactant.setProperty("SMIRKS", smirks[r][1]); 197 | try { 198 | assignSMILES(reactant); 199 | } catch (Exception x) { 200 | LOGGER.log(Level.WARNING, x.getMessage()); 201 | } 202 | writer.write(reactant); 203 | 204 | } 205 | 206 | } 207 | records_processed++; 208 | ; 209 | } catch (Exception x) { 210 | System.err.println("*"); 211 | records_error++; 212 | LOGGER.log(Level.SEVERE, String.format( 213 | "[Record %d] Error %s\n", records_read, 214 | file.getAbsoluteFile()), x); 215 | } 216 | 217 | } 218 | } catch (Exception x) { 219 | LOGGER.log( 220 | Level.SEVERE, 221 | String.format("[Record %d] Error %s\n", records_read, 222 | file.getAbsoluteFile()), x); 223 | } finally { 224 | try { 225 | reader.close(); 226 | } catch (Exception x) { 227 | } 228 | try { 229 | writer.close(); 230 | } catch (Exception x) { 231 | } 232 | } 233 | LOGGER.log(Level.INFO, String.format( 234 | "[Records read/processed/error %d/%d/%d] %s", records_read, 235 | records_processed, records_error, file.getAbsoluteFile())); 236 | return records_read; 237 | } 238 | 239 | protected void assignSMILES(IAtomContainer molecule) throws Exception { 240 | try { 241 | molecule.setProperty(FIELD.SMILES_Kekule.name(), SmilesGenerator 242 | .unique().create(molecule)); 243 | } catch (Exception x) { 244 | molecule.setProperty(FIELD.SMILES_Kekule, x.getMessage()); 245 | } 246 | try { 247 | molecule.setProperty(FIELD.SMILES_Aromatic.name(), smilesGenerator 248 | .aromatic().create(molecule)); 249 | } catch (Exception x) { 250 | molecule.setProperty(FIELD.SMILES_Aromatic, x.getMessage()); 251 | } 252 | 253 | } 254 | 255 | } 256 | -------------------------------------------------------------------------------- /smirks-example/src/main/java/net/idea/examples/ambit/smirks/MainApp.java: -------------------------------------------------------------------------------- 1 | package net.idea.examples.ambit.smirks; 2 | 3 | import org.apache.commons.cli.CommandLine; 4 | import org.apache.commons.cli.CommandLineParser; 5 | import org.apache.commons.cli.HelpFormatter; 6 | import org.apache.commons.cli.Option; 7 | import org.apache.commons.cli.OptionBuilder; 8 | import org.apache.commons.cli.Options; 9 | import org.apache.commons.cli.PosixParser; 10 | 11 | /** 12 | * Main example application 13 | * @author nina 14 | * 15 | */ 16 | public class MainApp { 17 | private static final String title = "SMIRKS example"; 18 | /** 19 | * Main 20 | * @param args 21 | */ 22 | public static void main(String[] args) { 23 | 24 | Options options = createOptions(); 25 | ChemWizard worker = null; 26 | final CommandLineParser parser = new PosixParser(); 27 | try { 28 | worker = new ChemWizard(); 29 | CommandLine line = parser.parse( options, args,false ); 30 | if (line.hasOption(_option.help.name())) { 31 | printHelp(options, null); 32 | return; 33 | } 34 | 35 | for (_option o: _option.values()) 36 | if (line.hasOption(o.getShortName())) try { 37 | worker.setOption(o,line.getOptionValue(o.getShortName())); 38 | } catch (Exception x) { 39 | printHelp(options,x.getMessage()); 40 | return; 41 | } 42 | 43 | 44 | worker.process(); 45 | 46 | } catch (Exception x ) { 47 | printHelp(options,x.getMessage()); 48 | } finally { 49 | try { 50 | //run whatever cleanup is needed 51 | } catch (Exception xx) { 52 | printHelp(options,xx.getMessage()); 53 | } 54 | } 55 | } 56 | /** 57 | * 58 | * @param options 59 | * @param message 60 | */ 61 | protected static void printHelp(Options options,String message) { 62 | if (message!=null) System.out.println(message); 63 | System.out.println(title); 64 | HelpFormatter formatter = new HelpFormatter(); 65 | formatter.printHelp( MainApp.class.getName(), options ); 66 | System.out.println("Examples:"); 67 | System.out.println(example1()); 68 | Runtime.getRuntime().runFinalization(); 69 | Runtime.getRuntime().exit(0); 70 | } 71 | 72 | /** 73 | * 74 | * @return 75 | */ 76 | protected static Options createOptions() { 77 | Options options = new Options(); 78 | for (_option o: _option.values()) { 79 | options.addOption(o.createOption()); 80 | } 81 | return options; 82 | } 83 | /** 84 | * 85 | * @author nina 86 | * 87 | */ 88 | enum _option { 89 | 90 | 91 | file { 92 | @Override 93 | public String getArgName() { 94 | return "file"; 95 | } 96 | @Override 97 | public String getDescription() { 98 | return "Input file"; 99 | } 100 | @Override 101 | public String getShortName() { 102 | return "f"; 103 | } 104 | 105 | }, 106 | 107 | help { 108 | @Override 109 | public String getArgName() { 110 | return null; 111 | } 112 | @Override 113 | public String getDescription() { 114 | return title; 115 | } 116 | @Override 117 | public String getShortName() { 118 | return "h"; 119 | } 120 | @Override 121 | public String getDefaultValue() { 122 | return null; 123 | } 124 | public Option createOption() { 125 | Option option = OptionBuilder.withLongOpt(name()) 126 | .withDescription(getDescription()) 127 | .create(getShortName()); 128 | return option; 129 | } 130 | } 131 | ; 132 | public abstract String getArgName(); 133 | public abstract String getDescription(); 134 | public abstract String getShortName(); 135 | public String getDefaultValue() { return null; } 136 | 137 | public Option createOption() { 138 | String defaultValue = getDefaultValue(); 139 | Option option = OptionBuilder.withLongOpt(name()) 140 | .hasArg() 141 | .withArgName(getArgName()) 142 | .withDescription(String.format("%s %s %s",getDescription(),defaultValue==null?"":"Default value: ",defaultValue==null?"":defaultValue)) 143 | .create(getShortName()); 144 | 145 | return option; 146 | } 147 | } 148 | 149 | /** 150 | * 151 | * @return 152 | */ 153 | protected static String example1() { 154 | return String.format( 155 | "Read file : \tjava -jar %s\t-f filename\n", 156 | "examples-smirks-0.0.1-SNAPSHOT.jar" 157 | ); 158 | 159 | } 160 | } 161 | -------------------------------------------------------------------------------- /smirks-example/src/main/resources/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-version: 1.0 2 | Package-Title: net.idea.examples.ambit.smirks 3 | Main-Class: net.idea.examples.ambit.smirks.MainApp 4 | Specification-Title: Example of a AMBIT-SMIRKS 5 | Specification-Vendor: IdeaConsult Ltd. 6 | Specification-Version: 2015 7 | Package-Version: ${project.version} 8 | Package-Vendor: IdeaConsult Ltd. 9 | Implementation-Title: Example of AMBIT-SMIRKS 10 | Implementation-Version: ${project.version} 11 | Implementation-Vendor: IdeaConsult Ltd 12 | cdk.version: ${cdk.version} -------------------------------------------------------------------------------- /smirks-example/src/main/resources/net/idea/examples/ambit/smirks/example1.properties: -------------------------------------------------------------------------------- 1 | cdk.version=${cdk.version} -------------------------------------------------------------------------------- /smirks-example/src/main/resources/net/idea/examples/lacticacid.sdf: -------------------------------------------------------------------------------- 1 | C3H6O3 2 | APtclcactv12231113212D 0 0.00000 0.00000 3 | 4 | 12 11 0 0 0 0 0 0 0 0999 V2000 5 | 4.2690 1.2500 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0 6 | 5.6719 0.0600 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0 7 | 3.4030 -1.2500 0.0000 O 0 0 0 0 0 0 0 0 0 0 0 0 8 | 5.1350 -0.2500 0.0000 O 0 0 0 0 0 0 0 0 0 0 0 0 9 | 2.5369 0.2500 0.0000 O 0 0 0 0 0 0 0 0 0 0 0 0 10 | 3.4030 -0.2500 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0 11 | 2.0000 -0.0600 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0 12 | 4.2690 0.2500 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0 13 | 4.2690 -0.3700 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0 14 | 4.8890 1.2500 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0 15 | 4.2690 1.8700 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0 16 | 3.6490 1.2500 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0 17 | 6 8 1 0 0 0 0 18 | 1 8 1 0 0 0 0 19 | 4 8 1 0 0 0 0 20 | 3 6 2 0 0 0 0 21 | 5 6 1 0 0 0 0 22 | 8 9 1 0 0 0 0 23 | 1 10 1 0 0 0 0 24 | 1 11 1 0 0 0 0 25 | 1 12 1 0 0 0 0 26 | 2 4 1 0 0 0 0 27 | 5 7 1 0 0 0 0 28 | M END 29 | $$$$ 30 | -------------------------------------------------------------------------------- /smirks-example/src/site/apt/index.apt: -------------------------------------------------------------------------------- 1 | ----- 2 | CDK examples 3 | ----- 4 | Background 5 | ----- 6 | April 2015 7 | 8 | Examples AMBIT-SMIRKS 9 | ~~~~~~~ 10 | 11 | This is a simple example how to use {{{http://ambit.sf.net}AMBIT}} SMIRKS package via Apache {{{http://maven.apache.org} Apache Maven}} dependencies. It reads an SDF file, generates reaction products and writes the original content plus both reaction products into a new SDF file. 12 | 13 | Demonstration how to use Maven profiles to switch between AMBIT versions. 14 | 15 | * Fork it. 16 | 17 | * Get {{{http://maven.apache.org} Apache Maven}} 18 | 19 | * Build. Don't worry about downloading jars and setting classpath dependencies. Maven does it for you. 20 | 21 | -------------------- 22 | 23 | mvn clean install 24 | 25 | -------------------- 26 | 27 | * Run 28 | 29 | -------------------- 30 | 31 | java -jar target/examples-smirks-0.0.1-SNAPSHOT.jar -f file_name.sdf 32 | 33 | -------------------- 34 | 35 | * Build with specific AMBIT version 36 | 37 | -------------------- 38 | 39 | mvn clean install -P ambit-3.0.0-SNAPSHOT 40 | 41 | -------------------- 42 | 43 | * More examples with {{{https://github.com/ideaconsult/examples-ambit} Examples AMBIT}} 44 | -------------------------------------------------------------------------------- /smirks-example/src/site/resources/images/ideaconsult_80.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ideaconsult/apps-ambit/a9aa6daba7dd89cc2625989ed7a75684d7d7ff89/smirks-example/src/site/resources/images/ideaconsult_80.png -------------------------------------------------------------------------------- /smirks-example/src/site/site.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | examples-cdk 6 | ./images/ideaconsult_80.png 7 | http://www.ideaconsult.net 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | org.apache.maven.skins 55 | maven-fluido-skin 56 | 1.2.1 57 | 58 | 59 | 60 | 61 | true 62 | true 63 | false 64 | 65 | examples-cdk 66 | examples-cdk 67 | ./images/ideaconsult_80.png 68 | ./index.html 69 | 70 | 71 | 72 | http://ideaconsult.github.com/examples-ambit 73 | 74 | 75 | true 76 | 77 | 78 | ideaconsult/examples-ambit 79 | right 80 | black 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | -------------------------------------------------------------------------------- /smirks-example/src/test/java/net/idea/examples/ambit/smirks/SMARTSTest.java: -------------------------------------------------------------------------------- 1 | package net.idea.examples.ambit.smirks; 2 | 3 | import org.junit.Test; 4 | import org.openscience.cdk.interfaces.IAtomContainer; 5 | 6 | import ambit2.smarts.IsomorphismTester; 7 | import ambit2.smarts.SmartsHelper; 8 | import ambit2.smarts.SmartsParser; 9 | import ambit2.smarts.groups.GroupMatch; 10 | 11 | public class SMARTSTest { 12 | 13 | public static int searchForAllInstances(String smarts, String smiles) throws Exception 14 | { 15 | try { 16 | IAtomContainer mol = SmartsHelper.getMoleculeFromSmiles(smiles, true) ; 17 | 18 | SmartsParser sp = new SmartsParser(); 19 | IsomorphismTester isoTester = new IsomorphismTester(); 20 | GroupMatch groupMatch = new GroupMatch(smarts, sp, isoTester); 21 | 22 | int posCount = groupMatch.matchCount(mol); 23 | System.out.println("Group " + smarts + " found at " + posCount + " positions in " + smiles); 24 | 25 | return posCount; 26 | 27 | } catch (Exception e) { 28 | System.out.println( "Cdk error smiles processing: " +smiles + " smarts: "+smarts); 29 | return -1; 30 | } 31 | } 32 | 33 | @Test 34 | public void test() throws Exception { 35 | searchForAllInstances("[H]O[#6]", "OC(=P)CCCCCCO"); 36 | 37 | 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /smirks-example/src/test/java/net/idea/examples/ambit/smirks/SmilesTest.java: -------------------------------------------------------------------------------- 1 | package net.idea.examples.ambit.smirks; 2 | 3 | import org.junit.Test; 4 | import org.openscience.cdk.DefaultChemObjectBuilder; 5 | import org.openscience.cdk.interfaces.IAtomContainer; 6 | import org.openscience.cdk.smiles.SmilesGenerator; 7 | import org.openscience.cdk.smiles.SmilesParser; 8 | 9 | public class SmilesTest { 10 | @Test 11 | public void test() throws Exception { 12 | String smiles = 13 | "CC(C)(C)C1=CC(=C(OP2OCC3(COP(OC4=CC=C(C=C4C(C)(C)C)C(C)(C)C)OC3)CO2)C=C1)C(C)(C)C"; 14 | SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance()); 15 | IAtomContainer m = sp.parseSmiles(smiles); 16 | SmilesGenerator sg = new SmilesGenerator(); 17 | String s_out = sg.create(m); 18 | System.out.println(s_out); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /smirks-example/toxtree-metabolites.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ideaconsult/apps-ambit/a9aa6daba7dd89cc2625989ed7a75684d7d7ff89/smirks-example/toxtree-metabolites.png -------------------------------------------------------------------------------- /standardize/ambit_standardize_demo.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Chemical structure standardisation with AMBIT\n", 8 | "\n", 9 | "- ambitcli - command line \n", 10 | "- Guide and download: http://ambit.sourceforge.net/ambitcli_standardisation.html\n", 11 | "- Download: https://zenodo.org/record/1145812\n", 12 | "- Used to standardize [ExCAPE-DB](https://jcheminf.springeropen.com/articles/10.1186/s13321-017-0203-5)" 13 | ] 14 | }, 15 | { 16 | "cell_type": "markdown", 17 | "metadata": {}, 18 | "source": [ 19 | "This is a Jupyter notebook using BeakerX kernels. The main kernel is Python, mainly to demonstrate the usage of Java code in Python notebook. " 20 | ] 21 | }, 22 | { 23 | "cell_type": "markdown", 24 | "metadata": {}, 25 | "source": [ 26 | "### Configuring Maven repositories and Maven dependencies" 27 | ] 28 | }, 29 | { 30 | "cell_type": "code", 31 | "execution_count": 2, 32 | "metadata": {}, 33 | "outputs": [ 34 | { 35 | "data": { 36 | "application/vnd.jupyter.widget-view+json": { 37 | "model_id": "6ee00624-1282-4304-8660-7472dee6cd43", 38 | "version_major": 2, 39 | "version_minor": 0 40 | }, 41 | "method": "display_data" 42 | }, 43 | "metadata": {}, 44 | "output_type": "display_data" 45 | }, 46 | { 47 | "data": { 48 | "application/vnd.jupyter.widget-view+json": { 49 | "model_id": "23272971-28f4-4c80-88d7-c93b780bf6c5", 50 | "version_major": 2, 51 | "version_minor": 0 52 | }, 53 | "method": "display_data" 54 | }, 55 | "metadata": {}, 56 | "output_type": "display_data" 57 | } 58 | ], 59 | "source": [ 60 | "%%java\n", 61 | "%classpath config resolver mvnLocal\n", 62 | "%classpath config resolver nexus-idea-releases https://nexus.ideaconsult.net/content/repositories/releases\n", 63 | "%classpath config resolver nexus-idea-snapshots https://nexus.ideaconsult.net/content/repositories/snapshots\n", 64 | "%classpath add mvn ambit ambit2-tautomers 3.3.0-SNAPSHOT\n", 65 | "%classpath add mvn ambit ambit2-dbcli 3.3.0-SNAPSHOT" 66 | ] 67 | }, 68 | { 69 | "cell_type": "markdown", 70 | "metadata": {}, 71 | "source": [ 72 | "### Standardize single structure" 73 | ] 74 | }, 75 | { 76 | "cell_type": "code", 77 | "execution_count": 3, 78 | "metadata": {}, 79 | "outputs": [ 80 | { 81 | "name": "stdout", 82 | "output_type": "stream", 83 | "text": [ 84 | "Clear isotopes false\tGenerate 2D false\tGenerate InChI true\tGenerate SMILES true\tAromatic false\tCanonical false\n", 85 | "Stereo from 2D false\tTautomers false\tImplicit H false\tNeutralise false\tSplit fragments false\n", 86 | "2018-08-03 15:19:25:624 +0300 [javash0] INFO ConfigManager - Loading global configuration\n", 87 | "2018-08-03 15:19:25:628 +0300 [javash0] INFO ConfigManager - Loading artefact configuration: jniinchi-1.03_1\n", 88 | "2018-08-03 15:19:25:632 +0300 [javash0] INFO ClasspathRepository - Searching classpath for: jniinchi-1.03_1-WINDOWS-AMD64\n", 89 | "2018-08-03 15:19:25:635 +0300 [javash0] INFO LocalRepository - Searching local repository for: jniinchi-1.03_1-WINDOWS-AMD64\n", 90 | "2018-08-03 15:19:25:643 +0300 [javash0] INFO ManifestReader - Reading manifest\n" 91 | 92 | ] 93 | }, 94 | { 95 | "data": { 96 | "text/plain": [ 97 | "CC(=O)CC(C1=CC=CC=C1)C2=C(C3=CC=CC=C3OC2=O)O" 98 | ] 99 | }, 100 | "execution_count": 3, 101 | "metadata": {}, 102 | "output_type": "execute_result" 103 | } 104 | ], 105 | "source": [ 106 | "%%java\n", 107 | "import ambit2.tautomers.processor.StructureStandardizer;\n", 108 | "import org.openscience.cdk.interfaces.IAtomContainer;\n", 109 | "import org.openscience.cdk.smiles.SmilesGenerator;\n", 110 | "import org.openscience.cdk.smiles.SmilesParser;\n", 111 | "import org.openscience.cdk.silent.SilentChemObjectBuilder;\n", 112 | "\n", 113 | "SmilesParser sp = new SmilesParser(SilentChemObjectBuilder.getInstance());\n", 114 | "IAtomContainer mol = sp.parseSmiles(\"CC(=O)CC(C1=CC=CC=C1)C2=C(C3=CC=CC=C3OC2=O)O\");\n", 115 | "StructureStandardizer std = new StructureStandardizer();\n", 116 | "System.out.println(String.format(\"Clear isotopes %s\\tGenerate 2D %s\\tGenerate InChI %s\\tGenerate SMILES %s\\tAromatic %s\\tCanonical %s\\nStereo from 2D %s\\tTautomers %s\\tImplicit H %s\\tNeutralise %s\\tSplit fragments %s\",\n", 117 | " std.isClearIsotopes(),\n", 118 | " std.isGenerate2D(),\n", 119 | " std.isGenerateInChI(),\n", 120 | " std.isGenerateSMILES(),\n", 121 | " std.isGenerateSMILES_Aromatic(),\n", 122 | " std.isGenerateSMILES_Canonical(),\n", 123 | " std.isGenerateStereofrom2D(),\n", 124 | " std.isGenerateTautomers(),\n", 125 | " std.isImplicitHydrogens(),\n", 126 | " std.isNeutralise(),\n", 127 | " std.isSplitFragments()\n", 128 | " ));\n", 129 | "IAtomContainer mol_std = std.process(mol);\n", 130 | "return SmilesGenerator.generic().create(mol_std);" 131 | ] 132 | }, 133 | { 134 | "cell_type": "markdown", 135 | "metadata": {}, 136 | "source": [ 137 | "### Standardize file with chemical structures\n", 138 | "- using tab-delimited file with SMILES column" 139 | ] 140 | }, 141 | { 142 | "cell_type": "code", 143 | "execution_count": 14, 144 | "metadata": {}, 145 | "outputs": [ 146 | { 147 | "data": { 148 | "application/vnd.jupyter.widget-view+json": { 149 | "model_id": "d7d2cf2c2dad46878b3a389d6fe04aaf", 150 | "version_major": 2, 151 | "version_minor": 0 152 | } 153 | }, 154 | "metadata": {}, 155 | "output_type": "display_data" 156 | } 157 | ], 158 | "source": [ 159 | "import pandas as pd\n", 160 | "df = pd.read_csv(\"test.txt\")\n", 161 | "(df)" 162 | ] 163 | }, 164 | { 165 | "cell_type": "code", 166 | "execution_count": 12, 167 | "metadata": {}, 168 | "outputs": [ 169 | { 170 | "name": "stderr", 171 | "output_type": "stream", 172 | "text": [ 173 | "INFO InChI native library loaded in 1 msec \n", 174 | "INFO Reading from test.txt Writing to test_std.txt\n", 175 | "INFO Records read:1 [1.000 msec/record]\tprocessed:1 [441.000 msec/record]\terror:0\tskipped:0\tTotal time 442 msec.\n", 176 | "INFO Records read:2 [0.500 msec/record]\tprocessed:2 [224.500 msec/record]\terror:0\tskipped:0\tTotal time 450 msec.\n", 177 | "INFO Records read:2 [0.500 msec/record]\tprocessed:2 [224.500 msec/record]\terror:0\tskipped:0\tTotal time 450 msec.\n", 178 | "INFO ambitcli-3.3.0-SNAPSHOT Records read:2 [0.500 msec/record]\tprocessed:2 [224.500 msec/record]\terror:0\tskipped:0\tTotal time 450 msec.\n" 179 | ] 180 | }, 181 | { 182 | "data": { 183 | "text/plain": [ 184 | "test_std.txt" 185 | ] 186 | }, 187 | "execution_count": 6, 188 | "metadata": {}, 189 | "output_type": "execute_result" 190 | } 191 | ], 192 | "source": [ 193 | "%%java\n", 194 | "import ambit2.dbcli.AmbitCli;\n", 195 | "import ambit2.dbcli.CliOptions;\n", 196 | "\n", 197 | "String infile=\"test.txt\";\n", 198 | "String out = \"test_std.txt\";\n", 199 | "\n", 200 | "String[] args = new String[] { \"-a\", \"standardize\", \"-i\", infile, \"-m\", \"post\", \"-o\", out, \"-d\",\n", 201 | " \"smiles=true\", \"-d\", \"inchi=true\", \"-d\", \"tautomers=true\" };\n", 202 | "CliOptions options = new CliOptions();\n", 203 | "if (options.parse(args))\n", 204 | "try {\n", 205 | " AmbitCli cli = new AmbitCli(options);\n", 206 | " cli.go(options.getCmd(), options.getSubcommand().name());\n", 207 | "} finally {\n", 208 | " // (new File(out)).delete();\n", 209 | "}\n", 210 | "return out;" 211 | ] 212 | }, 213 | { 214 | "cell_type": "code", 215 | "execution_count": 24, 216 | "metadata": {}, 217 | "outputs": [ 218 | { 219 | "data": { 220 | "application/vnd.jupyter.widget-view+json": { 221 | "model_id": "c286a9a399834d46b0b994db581d343f", 222 | "version_major": 2, 223 | "version_minor": 0 224 | } 225 | }, 226 | "metadata": {}, 227 | "output_type": "display_data" 228 | } 229 | ], 230 | "source": [ 231 | "df=pd.read_csv(\"./test_std.txt\",sep='\\t', keep_default_na=False)\n", 232 | "(df)" 233 | ] 234 | }, 235 | { 236 | "cell_type": "code", 237 | "execution_count": null, 238 | "metadata": {}, 239 | "outputs": [], 240 | "source": [] 241 | } 242 | ], 243 | "metadata": { 244 | "kernelspec": { 245 | "display_name": "Python 3", 246 | "language": "python", 247 | "name": "python3" 248 | }, 249 | "language_info": { 250 | "codemirror_mode": { 251 | "name": "ipython", 252 | "version": 3 253 | }, 254 | "file_extension": ".py", 255 | "mimetype": "text/x-python", 256 | "name": "python", 257 | "nbconvert_exporter": "python", 258 | "pygments_lexer": "ipython3", 259 | "version": "3.6.6" 260 | }, 261 | "toc": { 262 | "base_numbering": 1, 263 | "nav_menu": {}, 264 | "number_sections": false, 265 | "sideBar": false, 266 | "skip_h1_title": false, 267 | "title_cell": "Table of Contents", 268 | "title_sidebar": "Contents", 269 | "toc_cell": false, 270 | "toc_position": {}, 271 | "toc_section_display": false, 272 | "toc_window_display": false 273 | } 274 | }, 275 | "nbformat": 4, 276 | "nbformat_minor": 2 277 | } 278 | -------------------------------------------------------------------------------- /standardize/test.txt: -------------------------------------------------------------------------------- 1 | SMILES 2 | CC(=O)CC(C1=CC=CC=C1)C2=C(C3=CC=CC=C3OC2=O)O 3 | c1cc(oc1/C=C/[N+](=O)[O-])[N+](=O)[O-] -------------------------------------------------------------------------------- /standardize/test_std.txt: -------------------------------------------------------------------------------- 1 | InChIKey InChI SMILES RANK ERROR cdk:Title 2 | FQEPJUOLUDFINX-UHFFFAOYNA-N InChI=1/C19H16O4/c1-12(20)11-15(13-7-3-2-4-8-13)17-18(21)14-9-5-6-10-16(14)23-19(17)22/h2-10,15,17H,11H2,1H3 CC(=O)CC(C1=CC=CC=C1)C2C(C3=CC=CC=C3OC2=O)=O -1.0350e+01 3 | NMZDNQIJZAERIO-ONEGZZNKNA-N InChI=1/C6H4N2O5/c9-7(10)4-3-5-1-2-6(13-5)8(11)12/h1-4H/b4-3+ C=1C=C(OC1/C=C/[N+](=O)[O-])[N+](=O)[O-] 4 | -------------------------------------------------------------------------------- /tautomers-example/ChangeLog.md: -------------------------------------------------------------------------------- 1 | #Change log 2 | 3 | ###2.0.0-SNAPSHOT 4 | 5 | * Ambit dependency updated to [3.0.0-SNAPSHOT](http://ambit.uni-plovdiv.bg:8083/nexus/#nexus-search;gav~ambit~~3.0.0-SNAPSHOT~~). This version uses [CDK 1.5.10](http://efficientbits.blogspot.bg/2014/12/cdk-release-1510.html) ! 6 | 7 | ###1.0.1-SNAPSHOT 8 | 9 | * Fixed Doesn't stop anymore if an incorrect SDF record is found. 10 | 11 | * Ambit dependency updated to 2.7.1 12 | 13 | * Added new flags 14 | -------------------------------------------------------------------------------- /tautomers-example/docs.md: -------------------------------------------------------------------------------- 1 | #Ambit-tautomer configurations 2 | 3 | The flags are used for fine-tuning the tautomer generation process and post-generation filtering in [Ambit-Tautomer](README.md) 4 | 5 | * Tautomeric shifts: 6 | [FlagUse13Shifts](#FlagUse13Shifts), [FlagUse15Shifts](#FlagUse15Shifts), [FlagUse17Shifts](#FlagUse17Shifts), [FlagUse19Shifts](#FlagUse19Shifts) 7 | 8 | * Rules: 9 | [FlagRecurseBackResultTautomers](#FlagRecurseBackResultTautomers), [FlagUseRingChainRules](#FlagUseRingChainRules), [FlagUseChlorineRules](#FlagUseChlorineRules), [ruleNumberLimit](#ruleNumberLimit), [FlagSwitchToCombinatorialOnReachingRuleLimit](#FlagSwitchToCombinatorialOnReachingRuleLimit) 10 | 11 | * Filters: 12 | [FlagApplyWarningFilter](#FlagApplyWarningFilter), [FlagApplyExcludeFilter](#FlagApplyExcludeFilter), [FlagApplyDuplicationFilter](#FlagApplyDuplicationFilter) 13 | 14 | * Duplicates handling: 15 | [FlagCheckDuplicationOnRegistering](#FlagCheckDuplicationOnRegistering), [FlagApplyDuplicationCheckIsomorphism](#FlagApplyDuplicationCheckIsomorphism) 16 | 17 | * Algorithm termination handling: 18 | [maxNumOfBackTracks](#maxNumOfBackTracks), [maxNumOfTautomerRegistrations](#maxNumOfTautomerRegistrations), [maxNumOfSubCombinations](#maxNumOfSubCombinations) 19 | 20 | All examples bellow are valid for an object, *tman*, of the class *TautomerManager* e.g. following line of code is assumed: 21 | *TaotmerManager tman = new TautomerManager();* 22 | 23 | ####tman.getKnowledgeBase().FlagUse13Shifts 24 | * Default value : *true* 25 | * Determines whether to use rules for 1-3 tautomer shifts. These are the primary rules therefore this flag should not be false. 26 | 27 | ####tman.getKnowledgeBase().FlagUse15Shifts | tman.getKnowledgeBase().use15ShiftRules(true) 28 | * Default value : *true* 29 | * Determines whether to use rules for 1-5 tautomer shifts. These rules are also considered as important ones therefore by default this flag is true. This flag could be set to be *false* in order to improve the tautomer generation speed where it is expected the percentage of tautomers omitted to be low. 30 | 31 | ####tman.getKnowledgeBase().FlagUse17Shifts | tman.getKnowledgeBase().use17ShiftRules(true) 32 | * Default value : *false* 33 | * Determines whether to use the rules for 1-7 tautomer shifts. These rules can be used optionally. If this flag is *true*, the tautomer generation for complicated cases will be slower, however more exhaustive results will be guaranteed. 34 | 35 | ####tman.getKnowledgeBase().FlagUse19Shifts 36 | * Default value : *false* 37 | * Preserved for future usage. 38 | 39 | ####tman.getRuleSelector().setRuleNumberLimit(limit) 40 | * Default value : *10* 41 | * This is a limit for the number of used rules. If the initial number of found rules is larger than limit, *l*, then only *l* rules are used. This is a restriction for molecules which have lots of rules and potencialy determine milions or even bilions of tautomers. 42 | 43 | ####tman.FlagSwitchToCombinatorialOnReachingRuleLimit 44 | * Default value : *true* 45 | * When this flag is true, the incremental algorithm is switched to improved combinatorial one for the cases of molecules reaching *(ruleNumberLimit + 3)* rules. This switching is needed because the incremental algorithm would 'find' the excluded rules (due the the reached limit) and reuse them again. 46 | 47 | 48 | ####tman.FlagRecurseBackResultTautomers 49 | * Default value : *false* 50 | * Determines whether to apply recursion in the tautomer generation process. If this flag is true all generated tautomers are returned back and considered as starting structures hence tautomer generation is run for each tautomer as well. The testing statistics show that this option increases the computation time more than 40 times for medium complexity molecules. This option supplies some sort of extreme exhaustiveness of the generation algorithm which in most of the case is not practically needed except for some theoretical and benchmark tests. 51 | 52 | ####tman.getKnowledgeBase().FlagUseRingChainRules 53 | * Default value : *false* 54 | * Preserved for future usage. This functionality is not implemented yet. 55 | 56 | ####tman.getKnowledgeBase().FlagUseChlorineRules 57 | * Default value : *false* 58 | * Preserved for future usage. This functionality is not implemented yet. 59 | 60 | ####tman.FlagCheckDuplicationOnRegistering 61 | * Default value : *true* 62 | * This is a software specific flag. It determines whether to check the for tautomer duplication during the generation process. The check is performed based on the internal atom/bond numbering therefore only the identical tautomers are filtered. The tautomers which are topologically equivalent are not recognized. This is a sort of pre-filtering option which speeds up the algorithm. Typically this flag should be *true*. 63 | 64 | ####tman.tautomerFilter.FlagApplyWarningFilter 65 | * Default value : *true* 66 | * Activates / deactivates the post-filtering of type _warning_. The _warning_ filters are fully customable by the user. The general idea is to detect chemically correct structures which are weird or unwanted for a particular reason. Currently the default _warning_ filter removes tautomers which contain allene atoms in its acyclic parts (in order to apply this filter, allene atom must not be present in the original structure). 67 | 68 | ####tman.tautomerFilter.FlagApplyExcludeFilter 69 | * Default value : *true* 70 | * Activates / deactivates the post-filtering of type _exclusion_. 71 | The _exclusion_ filters are another type of fully customable filters. The structures removed by _exclusion_ filter are considered chemically incorrect. This type of filter is considered to be most strict and expected to be active always (of course for some particular reason the user may deactivate this type of filter as well). The default predefined _exclusion_ filter removes tautomers which contain allene atoms in a cycle. This filter is very practical since cases of cyclic allene atom appear often when there is rule overlapping within a cyclic systems. 72 | 73 | ####tman.tautomerFilter.FlagApplyDuplicationFilter 74 | * Default value : *true* 75 | * The duplicate tautomers are detected by comparison of their internal string codes. Ambit-Tautomer uses its own unique string representation of the tautomers which includes mainly information about the bonds orders (and if needed some atoms attributes). The string code is simple and is calculated very fast. It relies on the fact that the atom bond numbering for each tautomer is the same. The current implementation of the Ambit-Tautomer string code cannot detect topologically equivalent structures. 76 | 77 | ####tman.tautomerFilter.FlagApplyDuplicationCheckIsomorphism 78 | * Default value : *true* 79 | * If this flag is *true*, all topologically equivalent structures are to be removed. 80 | 81 | ####tman.maxNumOfBackTracks 82 | * Default value : *5000* 83 | * This is the maximal number of back-tracking steps performed by the Depth-First Search algorithm for tautomer generation. Typically a value of *10000* should be enough to find most of the tautomers for quite complicated molecules. Value of *100000* guarantees full exhaustiveness in majority of the cases, however this value may cause very long calculation times for more complicated molecules. In order to achieve faster calculations one may use a lower value (e.g. *1000*) which would guarantee exhaustiveness for small molecules and quite reasonable tautomer sets for medium and larger molecules. 84 | 85 | ####tman.maxNumOfTautomerRegistrations 86 | * Default value : *1000* 87 | * This is the maximal number of tautomer registrations performed by the combinatorial and improved combinatorial algorithms. If flag *FlagCheckNumOfRegistrationsForIncrementalAlgorithm=true* then maxNumOfTautomerRegistrations restriction is applied for the incremental algorithm (DFS-IA) as well. 88 | 89 | ####tman.maxNumOfSubCombinations 90 | * Default value : *10000* 91 | * This is the maximal number of rule subcombinations generated by the improved combinatorial algorithms. 92 | -------------------------------------------------------------------------------- /tautomers-example/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4.0.0 4 | net.idea.examples.ambit 5 | ambit-tautomers-example 6 | 3.3.0-SNAPSHOT 7 | ambit-tautomers-example 8 | Ambit Tautomers Example 9 | 10 | 11 | nexus-idea-snapshots 12 | https://nexus.ideaconsult.net/content/repositories/snapshots 13 | 14 | 15 | nexus-idea-releases 16 | https://nexus.ideaconsult.net/content/repositories/releases 17 | 18 | 19 | 20 | 21 | nexus-idea 22 | https://nexus.ideaconsult.net/content/repositories/thirdparty 23 | 24 | false 25 | 26 | 27 | 28 | nexus-idea-releases 29 | https://nexus.ideaconsult.net/content/repositories/releases 30 | 31 | false 32 | 33 | 34 | 35 | nexus-idea-snapshots 36 | https://nexus.ideaconsult.net/content/repositories/snapshots 37 | 38 | true 39 | always 40 | 41 | 42 | 43 | 44 | 45 | ambit 46 | ambit2-tautomers 47 | ${ambit.version} 48 | jar 49 | compile 50 | 51 | 52 | 53 | commons-cli 54 | commons-cli 55 | 1.1 56 | jar 57 | compile 58 | 59 | 60 | junit 61 | junit 62 | 4.11 63 | jar 64 | test 65 | 66 | 67 | 68 | UTF-8 69 | 4.8.1 70 | 4.0.0-SNAPSHOT 71 | 72 | 73 | GitHub 74 | https://github.com/ideaconsult/examples-ambit/issues 75 | 76 | 2012 77 | 78 | git://github.com/ideaconsult/examples-ambit.git 79 | scm:git:git@github.com:ideaconsult/examples-ambit.git 80 | https://github.com/ideaconsult/examples-ambit.git 81 | 82 | 83 | Ideaconsult Ltd. 84 | http://www.idesconsult.net 85 | 86 | 87 | ambit-tautomers 88 | 89 | 90 | src/main/resources 91 | true 92 | 93 | 94 | 95 | 96 | maven-assembly-plugin 97 | 2.6 98 | 99 | 100 | create-executable-jar 101 | package 102 | 103 | single 104 | 105 | 106 | 107 | 108 | jar-with-dependencies 109 | 110 | 111 | 112 | src/main/resources/META-INF/MANIFEST.MF 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | org.apache.maven.plugins 123 | maven-compiler-plugin 124 | 2.3.1 125 | 126 | 1.7 127 | 1.7 128 | 129 | 130 | 131 | org.apache.maven.plugins 132 | maven-surefire-plugin 133 | 134 | true 135 | true 136 | -Xmx1024m 137 | 138 | 139 | 140 | org.apache.maven.plugins 141 | maven-resources-plugin 142 | 2.4.3 143 | 144 | 145 | exe 146 | dll 147 | obf 148 | prm 149 | 150 | 151 | 152 | 153 | org.apache.maven.plugins 154 | maven-jar-plugin 155 | 2.2 156 | 157 | 158 | 159 | 163 | true 164 | 168 | 169 | 170 | development 171 | ${project.url} 172 | 173 | target/classes/META-INF/MANIFEST.MF 174 | 175 | 176 | 177 | 178 | 179 | test-jar 180 | 181 | 182 | 183 | 184 | 185 | org.apache.maven.plugins 186 | maven-source-plugin 187 | 2.1.2 188 | 189 | 190 | attach-sources 191 | verify 192 | 193 | jar 194 | 195 | 196 | 197 | 198 | 199 | org.apache.maven.plugins 200 | maven-release-plugin 201 | 2.0 202 | 203 | release 204 | true 205 | 206 | true 207 | 208 | 209 | 210 | 211 | org.apache.maven.plugins 212 | maven-site-plugin 213 | 2.3 214 | 215 | en 216 | 217 | 218 | 219 | 220 | 221 | 222 | -------------------------------------------------------------------------------- /tautomers-example/src/main/java/net/idea/example/ambit/tautomers/GenerationParameters.java: -------------------------------------------------------------------------------- 1 | package net.idea.example.ambit.tautomers; 2 | 3 | import java.util.ArrayList; 4 | 5 | import ambit2.tautomers.TautomerManager; 6 | 7 | public class GenerationParameters 8 | { 9 | public int[] maxNumOfBackTracks = null; 10 | public int[] rule15 = null; 11 | public int[] rule17 = null; 12 | 13 | private int nCombinations = 0; 14 | private int curComb = 0; 15 | private ArrayList params = new ArrayList(); 16 | private ArrayList paramDesignations = new ArrayList(); 17 | private int pos[] = null; //pointers to the current positions 18 | 19 | 20 | public void gotoFirstParamCombination() 21 | { 22 | nCombinations = 1; 23 | params.clear(); 24 | paramDesignations.clear(); 25 | 26 | if (maxNumOfBackTracks != null) 27 | if (maxNumOfBackTracks.length > 0) 28 | { 29 | params.add(maxNumOfBackTracks); 30 | paramDesignations.add("m"); 31 | nCombinations *= maxNumOfBackTracks.length; 32 | } 33 | 34 | if (rule15 != null) 35 | if (rule15.length > 0) 36 | { 37 | params.add(rule15); 38 | paramDesignations.add("r15"); 39 | nCombinations *= rule15.length; 40 | } 41 | 42 | if (rule17 != null) 43 | if (rule17.length > 0) 44 | { 45 | params.add(rule17); 46 | paramDesignations.add("r17"); 47 | nCombinations *= rule17.length; 48 | } 49 | 50 | pos = new int[params.size()]; 51 | for (int i = 0; i < pos.length; i++) 52 | pos[i] = 0; 53 | } 54 | 55 | public void gotoNextParamCombination() 56 | { 57 | for (int i = 0; i < pos.length; i++) 58 | { 59 | pos[i]++; 60 | if (pos[i]== params.get(i).length) 61 | pos[i] = 0; 62 | else 63 | break; 64 | } 65 | curComb++; 66 | } 67 | 68 | public boolean hasNext() 69 | { 70 | return (curComb < nCombinations); 71 | } 72 | 73 | public String getCombinationsAsString() 74 | { 75 | StringBuffer sb = new StringBuffer(); 76 | for (int i = params.size()-1; i >= 0; i--) 77 | { 78 | sb.append(paramDesignations.get(i) + "-" + params.get(i)[pos[i]]); 79 | if (i > 0) 80 | sb.append("_"); 81 | } 82 | return sb.toString(); 83 | } 84 | 85 | public void applyCurrentParameters(TautomerManager manager) 86 | { 87 | for (int i = 0; i < params.size(); i++) 88 | { 89 | if (params.get(i) == maxNumOfBackTracks) 90 | manager.maxNumOfBackTracks = maxNumOfBackTracks[pos[i]]; 91 | else 92 | if (params.get(i) == rule15) 93 | manager.getKnowledgeBase().FlagUse15Shifts = toBoolean(rule15[pos[i]]); 94 | else 95 | if (params.get(i) == rule15) 96 | manager.getKnowledgeBase().FlagUse15Shifts = toBoolean(rule15[pos[i]]); 97 | 98 | } 99 | } 100 | 101 | 102 | private boolean toBoolean(int i) 103 | { 104 | return (i!=0); 105 | } 106 | 107 | /* 108 | public static GenerationParameters parseFromString(String s) throws Exception 109 | { 110 | GenerationParameters gen = new GenerationParameters(); 111 | //TODO 112 | return gen; 113 | } 114 | */ 115 | 116 | 117 | } 118 | -------------------------------------------------------------------------------- /tautomers-example/src/main/java/net/idea/example/ambit/writers/RDFTautomersWriter.java: -------------------------------------------------------------------------------- 1 | package net.idea.example.ambit.writers; 2 | 3 | import java.io.IOException; 4 | import java.io.Writer; 5 | 6 | import org.openscience.cdk.interfaces.IAtomContainer; 7 | 8 | import ambit2.core.io.DelimitedFileFormat; 9 | import ambit2.core.io.DelimitedFileWriter; 10 | 11 | /** 12 | * Dead simple RDF writer. Not really a DelimitedFileWriter. 13 | * @author nina 14 | * 15 | */ 16 | public class RDFTautomersWriter extends DelimitedFileWriter { 17 | IAtomContainer originalMolecule; 18 | public IAtomContainer getOriginalMolecule() { 19 | return originalMolecule; 20 | } 21 | public void setOriginalMolecule(IAtomContainer originalMolecule) { 22 | this.originalMolecule = originalMolecule; 23 | } 24 | 25 | public RDFTautomersWriter(Writer out, DelimitedFileFormat format) { 26 | super(out,format); 27 | } 28 | @Override 29 | protected void writeHeader() throws IOException { 30 | // do nothing, just the prefix 31 | writer.write("@prefix rom: .\n"); 32 | } 33 | @Override 34 | public void writeMolecule(IAtomContainer molecule) { 35 | if (!writingStarted) try { 36 | writeHeader(); 37 | writingStarted = true; 38 | } catch (IOException x) { logger.severe(x.getMessage()); } 39 | 40 | Object parent = molecule.getProperty("tautomerOf"); 41 | if (parent==null) return; 42 | Object inchi = molecule.getProperty("InChI"); 43 | try { 44 | writer.write("\t"); 47 | writer.write(":tautomerOf"); 48 | writer.write("\t"); 49 | writer.write("."); 52 | writer.write("\n"); 53 | writer.flush(); 54 | } catch (Exception x) { 55 | logger.severe(x.getMessage()); 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /tautomers-example/src/main/resources/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-version: 1.0 2 | Package: net.idea.example.ambit.tautomers 3 | Main-Class: net.idea.example.ambit.tautomers.MainApp 4 | 5 | Name: net/idea/example/ambit/tautomers 6 | Specification-Title: Example of Ambit tautomers generation 7 | Specification-Vendor: IdeaConsult Ltd. 8 | Specification-Version: 2012 9 | Package-Title: net.idea.example.ambit.tautomers 10 | Package-Version: ${project.version} 11 | Package-Vendor: IdeaConsult Ltd. 12 | Implementation-Title: ambit2-tautomers ${ambit.version} 13 | Implementation-Version: ${project.version} 14 | Implementation-Vendor: IdeaConsult Ltd. -------------------------------------------------------------------------------- /tautomers-example/src/main/resources/logging.properties: -------------------------------------------------------------------------------- 1 | #This is AMBIT ${project.version} Java logging configuration file 2 | #See http://docs.oracle.com/javase/1.5.0/docs/api/index.html?java/util/logging/LogManager.html 3 | # This defines a whitespace separated list of class names for handler classes to load and register as handlers on the root Logger (the Logger named ""). 4 | #Console logging will end up in e.g. Apache TomCat logs, if executed in a servlet environment 5 | handlers=java.util.logging.ConsoleHandler 6 | # Set the default global logging level for the root logger 7 | #Loggers and Handlers can override this logging level (!) 8 | .level = INFO 9 | # Set the default logging level for new ConsoleHandler instances 10 | java.util.logging.ConsoleHandler.level = INFO 11 | # Set the default logging level for new FileHandler instances 12 | #java.util.logging.FileHandler.level = INFO 13 | # Set the default formatter for new ConsoleHandler instances 14 | #java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter 15 | # Specify the logging level for a specific package. 16 | #Ambit modules http://ambit.sourceforge.net/AMBIT2-LIBS/ 17 | ambit2.mopac.level = WARNING 18 | ambit2.smi23d.level = WARNING 19 | ambit2.db.level = INFO 20 | ambit2.core.level = SEVERE 21 | ambit2.core.processors.structure.level = SEVERE 22 | #Toxtree http://toxtree.sourceforge.net/ 23 | toxtree.level = WARNING 24 | mutant.level = WARNING 25 | #Restlet http://www.restlet.org/ 26 | #org.restlet.engine.level = WARNING 27 | #Inchi 28 | org.openscience.cdk.level = SEVERE 29 | #jnati 30 | net.sf.jnati.level= SEVERE -------------------------------------------------------------------------------- /tautomers-example/src/test/java/net/idea/example/ambit/tautomers/TautomersTest.java: -------------------------------------------------------------------------------- 1 | package net.idea.example.ambit.tautomers; 2 | 3 | import java.net.URL; 4 | 5 | import org.junit.Test; 6 | 7 | public class TautomersTest { 8 | 9 | @Test 10 | public void test() throws Exception { 11 | MainApp app = new MainApp(); 12 | URL url = TautomersTest.class.getClassLoader().getResource("net/idea/example/ambit/tautomers/inchi.txt"); 13 | 14 | org.junit.Assert.assertNotNull(url.getFile()); 15 | String[] args = new String[] { 16 | "-"+MainApp._option.file.getShortName(),url.getFile(), 17 | "-"+MainApp._option.output.getShortName(),url.getFile().replace(".txt", "_result.n3")}; 18 | for (String arg:args) System.out.println(arg); 19 | app.run(args); 20 | } 21 | 22 | @Test 23 | public void testSDF() throws Exception { 24 | MainApp app = new MainApp(); 25 | URL url = TautomersTest.class.getClassLoader().getResource("net/idea/example/ambit/tautomers/input.sdf"); 26 | 27 | org.junit.Assert.assertNotNull(url.getFile()); 28 | String[] args = new String[] { 29 | "-"+MainApp._option.file.getShortName(),url.getFile(), 30 | "-"+MainApp._option.output.getShortName(),url.getFile().replace(".sdf", "_result.sdf")}; 31 | for (String arg:args) System.out.println(arg); 32 | app.run(args); 33 | } 34 | 35 | @Test 36 | public void testDrugBankError() throws Exception { 37 | MainApp app = new MainApp(); 38 | URL url = TautomersTest.class.getClassLoader().getResource("net/idea/example/ambit/tautomers/drugbank_error.sdf"); 39 | 40 | org.junit.Assert.assertNotNull(url.getFile()); 41 | String[] args = new String[] { 42 | "-"+MainApp._option.file.getShortName(),url.getFile(), 43 | "-"+MainApp._option.output.getShortName(),url.getFile().replace(".sdf", "_result.sdf")}; 44 | for (String arg:args) System.out.println(arg); 45 | app.run(args); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /tautomers-example/src/test/resources/MolInf2013/AmbitTatutomersSet1.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ideaconsult/apps-ambit/a9aa6daba7dd89cc2625989ed7a75684d7d7ff89/tautomers-example/src/test/resources/MolInf2013/AmbitTatutomersSet1.zip -------------------------------------------------------------------------------- /tautomers-example/src/test/resources/MolInf2013/AmbitTautomersSet2.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ideaconsult/apps-ambit/a9aa6daba7dd89cc2625989ed7a75684d7d7ff89/tautomers-example/src/test/resources/MolInf2013/AmbitTautomersSet2.zip -------------------------------------------------------------------------------- /tautomers-example/src/test/resources/MolInf2013/AmbitTautomersSet3.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ideaconsult/apps-ambit/a9aa6daba7dd89cc2625989ed7a75684d7d7ff89/tautomers-example/src/test/resources/MolInf2013/AmbitTautomersSet3.zip -------------------------------------------------------------------------------- /tautomers-example/src/test/resources/MolInf2013/AmbitTautomersSet4.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ideaconsult/apps-ambit/a9aa6daba7dd89cc2625989ed7a75684d7d7ff89/tautomers-example/src/test/resources/MolInf2013/AmbitTautomersSet4.zip -------------------------------------------------------------------------------- /tautomers-example/src/test/resources/MolInf2013/AmbitTautomersSet5.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ideaconsult/apps-ambit/a9aa6daba7dd89cc2625989ed7a75684d7d7ff89/tautomers-example/src/test/resources/MolInf2013/AmbitTautomersSet5.zip -------------------------------------------------------------------------------- /tautomers-example/src/test/resources/MolInf2013/AmbitTautomersSet6.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ideaconsult/apps-ambit/a9aa6daba7dd89cc2625989ed7a75684d7d7ff89/tautomers-example/src/test/resources/MolInf2013/AmbitTautomersSet6.zip -------------------------------------------------------------------------------- /tautomers-example/src/test/resources/MolInf2013/README.md: -------------------------------------------------------------------------------- 1 | Set 1 2 | AmbitTatutomersSet1.zip 3 | Large set of organic compounds which is a subset of the Downloadable Structure Files of NCI Open Database Compounds. The subset was generated by the restriction: maximal number of rings is 4 4 | 5 | Set 2 6 | AmbitTatutomersSet2.zip 7 | Set of molecules widely used for organic synthesis. It includes different inhibitors, stabilizers, precursors, solvents, herbicides, amino acids, drugs and others 8 | 9 | Set 3 10 | AmbitTatutomersSet3.zip 11 | Molecules with small sizes which are widely used drugs, solvents, amino acids, etc 12 | 13 | Set 4 14 | AmbitTatutomersSet4.zip 15 | A structure set taken from reference [5] (M. Sitzmann, W.D. Ihlenfeldt, M. Nicklaus, J. Comput. Aided Mol. Des. 2010, 24, 521-551) used for comparison of the canonical forms obtained from different software packages 16 | 17 | Set 5 18 | AmbitTatutomersSet5.zip 19 | The set contains 10 682 structures used for estimating the time for which all tautomers are generated 20 | 21 | Set 6 22 | AmbitTatutomersSet6.zip 23 | Set of 1771 compounds (a subset of Set 1) used for recursive algorithm speed test. 24 | -------------------------------------------------------------------------------- /tautomers-example/src/test/resources/net/idea/example/ambit/tautomers/inchi.txt: -------------------------------------------------------------------------------- 1 | InChI MyTitle 2 | InChI=1S/C2H6O/c1-2-3/h3H,2H2,1H3 Test molecule 1 3 | InChI=1S/C6H8O6/c7-1-2(8)5-3(9)4(10)6(11)12-5/h2,5,7-8,10-11H,1H2/t2-,5+/m0/s1 Test Molecule 2 -------------------------------------------------------------------------------- /tautomers-example/src/test/resources/net/idea/example/ambit/tautomers/input.sdf: -------------------------------------------------------------------------------- 1 | 2 | CDK 0608131133 3 | 4 | 15 16 0 0 0 0 0 0 0 0999 V2000 5 | 1.2990 3.7500 0.0000 N 0 0 0 0 0 0 0 0 0 0 0 0 6 | 1.2990 2.2500 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0 7 | 2.5981 1.5000 0.0000 N 0 0 0 0 0 0 0 0 0 0 0 0 8 | 2.5981 -0.0000 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0 9 | 1.2990 -0.7500 0.0000 N 0 0 0 0 0 0 0 0 0 0 0 0 10 | 0.0000 0.0000 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0 11 | -1.4266 -0.4635 0.0000 N 0 0 0 0 0 0 0 0 0 0 0 0 12 | -2.3083 0.7500 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0 13 | -1.4266 1.9635 0.0000 N 0 0 0 0 0 0 0 0 0 0 0 0 14 | 0.0000 1.5000 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0 15 | 2.5981 4.5000 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0 16 | 0.0000 4.5000 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0 17 | 3.8971 -0.7500 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0 18 | -3.8083 0.7500 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0 19 | -1.8901 3.3901 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0 20 | 1 2 1 0 0 0 0 21 | 1 11 1 0 0 0 0 22 | 1 12 1 0 0 0 0 23 | 2 10 2 0 0 0 0 24 | 2 3 1 0 0 0 0 25 | 3 4 2 0 0 0 0 26 | 4 5 1 0 0 0 0 27 | 4 13 1 0 0 0 0 28 | 5 6 2 0 0 0 0 29 | 6 10 1 0 0 0 0 30 | 6 7 1 0 0 0 0 31 | 7 8 2 0 0 0 0 32 | 8 9 1 0 0 0 0 33 | 8 14 1 0 0 0 0 34 | 9 10 1 0 0 0 0 35 | 9 15 1 0 0 0 0 36 | M END 37 | > 38 | NC=1N=CN=C2N=CNC2=1 39 | 40 | > 41 | Created from SMILES 42 | 43 | -------------------------------------------------------------------------------- /tautomers-jmh/README.md: -------------------------------------------------------------------------------- 1 | # JMH benchmarking 2 | 3 | Uses http://openjdk.java.net/projects/code-tools/jmh/ 4 | 5 | Generated by 6 | ```` 7 | mvn archetype:generate -DinteractiveMode=false -DarchetypeGroupId=org.openjdk.jmh -DarchetypeArtifactId=jmh-java-benchmark-archetype -DgroupId=net.idea.benchmark -DartifactId=tautomers-jmh -Dversion=1.0 8 | ```` 9 | 10 | ## Build (-P ambit-version) 11 | ```` 12 | mvn package -P 3.2.0-SNAPSHOT 13 | ```` 14 | 15 | ## Run 16 | Run with (check the AMBIT version): 17 | ```` 18 | java -jar target/benchmarks-ambit-4.0.0-SNAPSHOT.jar 19 | ```` 20 | 21 | ## Results 22 | 23 | Note the results are generated with default settings, which might differ across versions! 24 | 25 | ### ambit-4.0.0-SNAPSHOT 26 | (with CDK 2.1.1) 27 | 28 | ``` 29 | tbd 30 | ``` 31 | 32 | ### ambit-3.0.1-SNAPSHOT 33 | ```` 34 | # Run complete. Total time: 00:00:21 35 | 36 | Benchmark Mode Cnt Score Error Units 37 | TautomersBenchmark.generateTautomers avgt 10 66.181 ± 1.206 ms/op 38 | ```` 39 | 40 | ### ambit-3.0.0 41 | ```` 42 | # Run complete. Total time: 00:00:21 43 | 44 | Benchmark Mode Cnt Score Error Units 45 | TautomersBenchmark.generateTautomers avgt 10 68.269 ± 1.188 ms/op 46 | ```` 47 | 48 | ### ambit-2.7.4 49 | 50 | ```` 51 | Result "generateTautomers": 52 | 128.993 ±(99.9%) 3.548 ms/op [Average] 53 | (min, avg, max) = (127.013, 128.993, 134.916), stdev = 2.347 54 | CI (99.9%): [125.445, 132.541] (assumes normal distribution) 55 | 56 | 57 | # Run complete. Total time: 00:00:22 58 | 59 | Benchmark Mode Cnt Score Error Units 60 | TautomersBenchmark.generateTautomers avgt 10 128.993 ± 3.548 ms/op 61 | ```` 62 | 63 | ### ambit-2.7.2 64 | ```` 65 | Result "generateTautomers": 66 | 131.504 ±(99.9%) 9.339 ms/op [Average] 67 | (min, avg, max) = (125.599, 131.504, 144.393), stdev = 6.177 68 | CI (99.9%): [122.166, 140.843] (assumes normal distribution) 69 | 70 | 71 | # Run complete. Total time: 00:00:22 72 | 73 | Benchmark Mode Cnt Score Error Units 74 | TautomersBenchmark.generateTautomers avgt 10 131.504 ± 9.339 ms/op 75 | ```` 76 | 77 | ### ambit-2.5.4 78 | ```` 79 | Result "generateTautomers": 80 | 161.230 ±(99.9%) 27.662 ms/op [Average] 81 | (min, avg, max) = (142.075, 161.230, 204.533), stdev = 18.297 82 | CI (99.9%): [133.568, 188.892] (assumes normal distribution) 83 | 84 | 85 | # Run complete. Total time: 00:00:22 86 | 87 | Benchmark Mode Cnt Score Error Units 88 | TautomersBenchmark.generateTautomers avgt 10 161.230 ± 27.662 ms/op 89 | ```` 90 | 91 | Result "generateTautomers": 92 | 140.456 ±(99.9%) 2.383 ms/op [Average] 93 | (min, avg, max) = (139.358, 140.456, 143.476), stdev = 1.576 94 | CI (99.9%): [138.074, 142.839] (assumes normal distribution) 95 | 96 | ### ambit-2.4.11 97 | ```` 98 | # Run complete. Total time: 00:00:22 99 | 100 | Benchmark Mode Cnt Score Error Units 101 | TautomersBenchmark.generateTautomers avgt 10 140.456 ± 2.383 ms/op 102 | ```` -------------------------------------------------------------------------------- /tautomers-jmh/pom.xml: -------------------------------------------------------------------------------- 1 | 21 | 22 | 24 | 4.0.0 25 | 26 | net.idea.benchmark 27 | tautomers-jmh 28 | 1.0 29 | jar 30 | 31 | Ambit tautomers JMH benchmark 32 | 33 | 34 | 3.0 35 | 36 | 37 | 38 | 39 | nexus-idea 40 | https://nexus.ideaconsult.net/content/repositories/thirdparty 41 | 42 | false 43 | 44 | 45 | 46 | nexus-idea-releases 47 | https://nexus.ideaconsult.net/content/repositories/releases 48 | 49 | false 50 | 51 | 52 | 53 | nexus-idea-snapshots 54 | https://nexus.ideaconsult.net/content/repositories/snapshots 55 | 56 | true 57 | always 58 | 59 | 60 | 61 | 62 | 63 | org.openjdk.jmh 64 | jmh-core 65 | ${jmh.version} 66 | 67 | 68 | org.openjdk.jmh 69 | jmh-generator-annprocess 70 | ${jmh.version} 71 | provided 72 | 73 | 74 | ambit 75 | ambit2-tautomers 76 | ${ambit.version} 77 | 78 | 79 | com.google.guava 80 | guava 81 | [24.1.1,) 82 | 83 | 84 | 85 | 86 | UTF-8 87 | 1.11.2 88 | 1.7 89 | benchmarks-ambit-${ambit.version} 90 | 91 | 92 | 93 | 94 | 95 | org.apache.maven.plugins 96 | maven-compiler-plugin 97 | 3.1 98 | 99 | ${javac.target} 100 | ${javac.target} 101 | ${javac.target} 102 | 103 | 104 | 105 | org.apache.maven.plugins 106 | maven-shade-plugin 107 | 2.2 108 | 109 | 110 | package 111 | 112 | shade 113 | 114 | 115 | ${uberjar.name} 116 | 117 | 119 | org.openjdk.jmh.Main 120 | 121 | 122 | 123 | 124 | 125 | *:* 126 | 127 | META-INF/*.SF 128 | META-INF/*.DSA 129 | META-INF/*.RSA 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | maven-clean-plugin 142 | 2.5 143 | 144 | 145 | maven-deploy-plugin 146 | 2.8.1 147 | 148 | 149 | maven-install-plugin 150 | 2.5.1 151 | 152 | 153 | maven-jar-plugin 154 | 2.4 155 | 156 | 157 | maven-javadoc-plugin 158 | 2.9.1 159 | 160 | 161 | maven-resources-plugin 162 | 2.6 163 | 164 | 165 | maven-site-plugin 166 | 3.3 167 | 168 | 169 | maven-source-plugin 170 | 2.2.1 171 | 172 | 173 | maven-surefire-plugin 174 | 2.17 175 | 176 | 177 | 178 | 179 | 180 | 181 | 4.0.0-SNAPSHOT 182 | 183 | true 184 | 185 | 186 | 4.0.0-SNAPSHOT 187 | 188 | 189 | 190 | 3.3.0-SNAPSHOT 191 | 192 | false 193 | 194 | 195 | 3.3.0-SNAPSHOT 196 | 197 | 198 | 199 | 3.2.0-SNAPSHOT 200 | 201 | false 202 | 203 | 204 | 3.2.0-SNAPSHOT 205 | 206 | 207 | 208 | 3.1.0 209 | 210 | false 211 | 212 | 213 | 3.1.0 214 | 215 | 216 | 217 | 3.0.0 218 | 219 | false 220 | 221 | 222 | 3.0.0 223 | 224 | 225 | 226 | 2.7.4 227 | 228 | false 229 | 230 | 231 | 2.7.4 232 | 233 | 234 | 235 | 2.7.2 236 | 237 | false 238 | 239 | 240 | 2.7.2 241 | 242 | 243 | 244 | 2.5.4 245 | 246 | false 247 | 248 | 249 | 2.5.4 250 | 251 | 252 | 253 | 2.4.11 254 | 255 | false 256 | 257 | 258 | 2.4.11 259 | 260 | 261 | 262 | 263 | -------------------------------------------------------------------------------- /tautomers-jmh/src/main/java/net/idea/benchmark/TautomersBenchmark.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, Oracle America, Inc. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * * Redistributions of source code must retain the above copyright notice, 9 | * this list of conditions and the following disclaimer. 10 | * 11 | * * Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 15 | * * Neither the name of Oracle nor the names of its contributors may be used 16 | * to endorse or promote products derived from this software without 17 | * specific prior written permission. 18 | * 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 23 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 29 | * THE POSSIBILITY OF SUCH DAMAGE. 30 | */ 31 | 32 | package net.idea.benchmark; 33 | 34 | import java.io.InputStream; 35 | import java.util.List; 36 | import java.util.concurrent.TimeUnit; 37 | 38 | import org.openjdk.jmh.annotations.Benchmark; 39 | import org.openjdk.jmh.annotations.BenchmarkMode; 40 | import org.openjdk.jmh.annotations.Fork; 41 | import org.openjdk.jmh.annotations.Level; 42 | import org.openjdk.jmh.annotations.Measurement; 43 | import org.openjdk.jmh.annotations.Mode; 44 | import org.openjdk.jmh.annotations.OutputTimeUnit; 45 | import org.openjdk.jmh.annotations.Scope; 46 | import org.openjdk.jmh.annotations.Setup; 47 | import org.openjdk.jmh.annotations.State; 48 | import org.openjdk.jmh.annotations.TearDown; 49 | import org.openjdk.jmh.annotations.Warmup; 50 | import org.openjdk.jmh.runner.Runner; 51 | import org.openjdk.jmh.runner.RunnerException; 52 | import org.openjdk.jmh.runner.options.Options; 53 | import org.openjdk.jmh.runner.options.OptionsBuilder; 54 | import org.openscience.cdk.exception.CDKException; 55 | import org.openscience.cdk.interfaces.IAtomContainer; 56 | import org.openscience.cdk.io.MDLReader; 57 | import org.openscience.cdk.silent.AtomContainer; 58 | import org.openscience.cdk.silent.SilentChemObjectBuilder; 59 | import org.openscience.cdk.smiles.SmilesParser; 60 | import org.openscience.cdk.tools.CDKHydrogenAdder; 61 | import org.openscience.cdk.tools.manipulator.AtomContainerManipulator; 62 | 63 | import ambit2.tautomers.TautomerManager; 64 | 65 | import com.google.common.base.Verify; 66 | 67 | @BenchmarkMode(Mode.AverageTime) 68 | @OutputTimeUnit(TimeUnit.MILLISECONDS) 69 | @Warmup(iterations = 10) 70 | @Measurement(iterations = 10) 71 | @Fork(1) 72 | public class TautomersBenchmark { 73 | 74 | @State(Scope.Benchmark) 75 | public static class TautomerManagerFactory { 76 | TautomerManager instance; 77 | 78 | @Setup(Level.Trial) 79 | public void initialize() { 80 | instance = new TautomerManager(); 81 | /* 82 | * instance.FlagCalculateCACTVSEnergyRank = true; 83 | * 84 | * instance.tautomerFilter.FlagApplyDuplicationCheckIsomorphism 85 | * =false; .setFlagApplyDuplicationCheckIsomorphism(false); 86 | * instance.tautomerFilter.setFlagApplyDuplicationCheckInChI(true); 87 | * 88 | * instance.FlagRegisterOnlyBestRankTautomers = true; 89 | * instance.FlagSetStereoElementsOnTautomerProcess = true; 90 | */ 91 | /* 92 | * System.out.println(String.format("%s %s %s %s %s %s %s %s %s %s %s" 93 | * , instance.FlagApplySimpleAromaticityRankCorrection, 94 | * instance.FlagCalculateCACTVSEnergyRank, 95 | * instance.FlagCheckDuplicationOnRegistering, 96 | * instance.FlagCheckNumOfRegistrationsForIncrementalAlgorithm, 97 | * instance.FlagCheckValencyOnRegistering, 98 | * instance.FlagEnergyRankingMethod, 99 | * instance.FlagExcludeWarnFiltersOnRegistering, 100 | * instance.FlagNewRuleInstanceSearchOnEnergyRanking, 101 | * instance.FlagPrintExtendedRuleInstances, 102 | * instance.FlagStopGenerationOnReachingRuleSelectorLimit, 103 | * instance.FlagSwitchToCombinatorialOnReachingRuleLimit)); 104 | */ 105 | 106 | } 107 | 108 | @TearDown(Level.Trial) 109 | public void shutdown() { 110 | 111 | } 112 | } 113 | 114 | @State(Scope.Benchmark) 115 | public static class MoleculeSDFFactory { 116 | IAtomContainer instance = null; 117 | 118 | @Setup(Level.Trial) 119 | public void initialize() { 120 | MDLReader reader = null; 121 | try { 122 | IAtomContainer mol = null; 123 | InputStream in = getClass().getClassLoader() 124 | .getResourceAsStream( 125 | "net/idea/benchmark/warfarin.mol"); 126 | Verify.verifyNotNull(in); 127 | reader = new MDLReader(in); 128 | mol = reader.read(new AtomContainer()); 129 | AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(mol); 130 | CDKHydrogenAdder.getInstance(mol.getBuilder()).addImplicitHydrogens(mol); 131 | instance = mol; 132 | Verify.verifyNotNull(instance); 133 | Verify.verify(instance.getAtomCount() == 581); 134 | } catch (CDKException x) { 135 | x.printStackTrace(); 136 | 137 | } finally { 138 | try { 139 | if (reader != null) 140 | reader.close(); 141 | } catch (Exception x) { 142 | } 143 | } 144 | 145 | } 146 | } 147 | 148 | @State(Scope.Benchmark) 149 | public static class MoleculeSMILESFactory { 150 | IAtomContainer instance = null; 151 | 152 | @Setup(Level.Trial) 153 | public void initialize() { 154 | try { 155 | SmilesParser parser = new SmilesParser( 156 | SilentChemObjectBuilder.getInstance()); 157 | IAtomContainer mol = parser 158 | .parseSmiles("N[C@H](C(=O)N1[C@H](C(=O)N[C@H](C(=O)N[C@H](C(=O)N[C@H](C(=O)N[C@H](C(=O)N2[C@H](C(=O)N[C@H](C(=O)N[C@H](C(=O)O)CS)CC3=CC=CC=C3)CCC2)CC(C)C)CC(C)C)CC4=CN=CN4)CC5=CNC6=C5C=CC=C6)CCC1)CS"); 159 | AtomContainerManipulator 160 | .percieveAtomTypesAndConfigureAtoms(mol); 161 | CDKHydrogenAdder.getInstance( 162 | SilentChemObjectBuilder.getInstance()) 163 | .addImplicitHydrogens(mol); 164 | instance = mol; 165 | } catch (Exception x) { 166 | x.printStackTrace(); 167 | 168 | } finally { 169 | } 170 | 171 | } 172 | } 173 | 174 | @Benchmark 175 | public List generateTautomers( 176 | TautomerManagerFactory tautomerManager, 177 | MoleculeSMILESFactory molecule) 178 | 179 | throws Exception { 180 | tautomerManager.instance.setStructure(molecule.instance); 181 | List res = tautomerManager.instance 182 | .generateTautomersIncrementaly(); 183 | 184 | return res; 185 | } 186 | 187 | @Benchmark 188 | public List generateTautomers_warfarin( 189 | TautomerManagerFactory tautomerManager, MoleculeSDFFactory molecule) 190 | 191 | throws Exception { 192 | tautomerManager.instance.setStructure(molecule.instance); 193 | List res = tautomerManager.instance 194 | .generateTautomersIncrementaly(); 195 | 196 | return res; 197 | } 198 | 199 | public static void main(String[] args) throws RunnerException { 200 | Options opt = new OptionsBuilder() 201 | .include(".*" + TautomersBenchmark.class.getSimpleName() + ".*") 202 | .warmupIterations(5).measurementIterations(5).forks(1).build(); 203 | 204 | new Runner(opt).run(); 205 | } 206 | } 207 | -------------------------------------------------------------------------------- /tautomers-jmh/src/main/resources/net/idea/benchmark/warfarin.mol: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 23 25 0 0000 0 0 0 0 0999 V2000 5 | 3.4537 -5.9863 0.0000 O 0 0 0 0 0 0 0 0 0 0 0 6 | 4.6049 -5.3232 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 7 | 5.7561 -5.9863 0.0000 O 0 0 0 0 0 0 0 0 0 0 0 8 | 6.9073 -5.3232 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 9 | 6.9073 -3.9878 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 10 | 8.0585 -3.3247 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 11 | 9.2097 -3.9878 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 12 | 9.2097 -5.3232 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 13 | 8.0585 -5.9863 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 14 | 5.7561 -3.3247 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 15 | 5.7561 -1.9985 0.0000 O 0 0 0 0 0 0 0 0 0 0 0 16 | 4.6049 -3.9878 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 17 | 3.4537 -3.3247 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 18 | 3.4537 -1.9985 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 19 | 2.3024 -1.3354 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 20 | 2.3024 0.0000 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 21 | 1.1512 -1.9985 0.0000 O 0 0 0 0 0 0 0 0 0 0 0 22 | 2.3024 -3.9878 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 23 | 1.1512 -3.3247 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 24 | 0.0000 -3.9878 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 25 | 0.0000 -5.3232 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 26 | 1.1512 -5.9863 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 27 | 2.3024 -5.3232 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 28 | 1 2 2 0 29 | 2 3 1 0 30 | 2 12 1 0 31 | 3 4 1 0 32 | 4 5 2 0 33 | 4 9 1 0 34 | 5 6 1 0 35 | 5 10 1 0 36 | 6 7 2 0 37 | 7 8 1 0 38 | 8 9 2 0 39 | 10 11 1 0 40 | 10 12 2 0 41 | 12 13 1 0 42 | 13 14 1 0 43 | 13 18 1 0 44 | 14 15 1 0 45 | 15 16 1 0 46 | 15 17 2 0 47 | 18 19 2 0 48 | 18 23 1 0 49 | 19 20 1 0 50 | 20 21 2 0 51 | 21 22 1 0 52 | 22 23 2 0 53 | M END 54 | 55 | > 56 | InChI=1S/C19H16O4/c1-12(20)11-15(13-7-3-2-4-8-13)17-18(21)14-9-5-6-10-16(14)23-19(17)22/h2-10,15,21H,11H2,1H3 57 | 58 | > 59 | PJVWKTKQMONHTI-UHFFFAOYSA-N 60 | 61 | > 62 | 1/0/N:16,21,20,22,7,8,19,23,6,9,14,15,18,5,13,4,12,10,2,17,11,1,3/E:(3,4)(7,8)/rA:23nOCOCCCCCCCOCCCCCOCCCCCC/rB:d1;s2;s3;d4;s5;d6;s7;s4d8;s5;s10;s2d10;s12;s13;s14;s15;d15;s13;d18;s19;d20;s21;s18d22;/rC:3.4537,-5.9863,0;4.6049,-5.3232,0;5.7561,-5.9863,0;6.9073,-5.3232,0;6.9073,-3.9878,0;8.0585,-3.3247,0;9.2097,-3.9878,0;9.2097,-5.3232,0;8.0585,-5.9863,0;5.7561,-3.3247,0;5.7561,-1.9985,0;4.6049,-3.9878,0;3.4537,-3.3247,0;3.4537,-1.9985,0;2.3024,-1.3354,0;2.3024,0,0;1.1512,-1.9985,0;2.3024,-3.9878,0;1.1512,-3.3247,0;0,-3.9878,0;0,-5.3232,0;1.1512,-5.9863,0;2.3024,-5.3232,0; 63 | 64 | > 65 | C19 H16 O4 66 | 67 | > 68 | 308.3279 69 | 70 | > 71 | O=C1C(C(C2C=CC=CC=2)CC(=O)C)=C(O)C2C=CC=CC=2O1 72 | 73 | > 74 | 10442445 75 | 76 | $$$$ 77 | --------------------------------------------------------------------------------