From 291337e920cc95510fce3c0cdcc62b4443cd3bc4 Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Thu, 13 Oct 2016 14:03:19 +0200 Subject: Fix retrieving pubchem infos for ambiguous names --- ChangeLog | 12 ++++++++++++ DESCRIPTION | 4 ++-- GNUmakefile | 2 ++ R/chent.R | 2 +- test.log | 11 +++++------ tests/testthat/test_pai.R | 8 ++++---- 6 files changed, 26 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index 38c401e..5fe2f05 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +commit 65c481910d65f6935b7f52450ea809586e71d384 +Author: Johannes Ranke +Date: 2016-10-13 10:08:32 +0200 + + Do not fail if PythonInR is not installed + +commit 7517eb0ed1a66488b937c039d4bcadefeff6b479 +Author: Johannes Ranke +Date: 2016-10-08 03:07:50 +0200 + + Add a method to write cropped pdf files + commit d22214d9f1b17bd3ab2febe810ab996bebb01410 Author: Johannes Ranke Date: 2016-09-28 08:56:57 +0200 diff --git a/DESCRIPTION b/DESCRIPTION index 11a63f8..bc02e64 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,8 @@ Package: chents Type: Package Title: Chemical Entities as R Objects -Version: 0.2-3 -Date: 2016-10-07 +Version: 0.2-4 +Date: 2016-10-13 Authors@R: c(person("Johannes", "Ranke", role = c("aut", "cre", "cph"), email = "jranke@uni-bremen.de")) Description: Utilities for dealing with chemical entities and associated diff --git a/GNUmakefile b/GNUmakefile index 76339e7..c22ff44 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -5,6 +5,8 @@ TGZ := $(PKGNAME)_$(PKGVERS).tar.gz R_HOME ?= $(shell R RHOME) DATE := $(shell date +%Y-%m-%d) +all: install + .PHONEY: usage check clean roxygen sd usage: diff --git a/R/chent.R b/R/chent.R index e170307..fe87d5e 100644 --- a/R/chent.R +++ b/R/chent.R @@ -89,7 +89,7 @@ chent <- R6Class("chent", try_pubchem = function(identifier) { message("PubChem:") if (missing(identifier)) identifier <- self$identifier - pubchem_cids = webchem::get_cid(identifier) + pubchem_cids = webchem::get_cid(identifier)[[identifier]] if (is.na(pubchem_cids[1])) { message("Query ", identifier, " did not give results at PubChem") diff --git a/test.log b/test.log index e2dbdd5..158cb5a 100644 --- a/test.log +++ b/test.log @@ -1,23 +1,22 @@ Loading chents Loading required package: testthat - +Testing chents +Generation of chent objects: Initialize Python Version 2.7.9 (default, Jun 29 2016, 13:11:10) [GCC 4.9.2] -Testing chents -Generation of chent objects: Trying to get chemical information from RDKit using user SMILES +Trying to get chemical information from RDKit using user SMILES CCCCCCCCO ...... Generation of pai objects: alanwood.net: Querying glyphosate.html PubChem: -http://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/name/glyphosate/cids/JSON -No encoding supplied: defaulting to UTF-8. +http://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/name/cids/JSON Found 1 entries in PubChem, using the first one. http://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/cid/property/MolecularFormula,MolecularWeight,CanonicalSMILES,IsomericSMILES,InChI,InChIKey,IUPACName,XLogP,ExactMass,MonoisotopicMass,TPSA,Complexity,Charge,HBondDonorCount,HBondAcceptorCount,RotatableBondCount,HeavyAtomCount,IsotopeAtomCount,AtomStereoCount,DefinedAtomStereoCount,UndefinedAtomStereoCount,BondStereoCount,DefinedBondStereoCount,UndefinedBondStereoCount,CovalentUnitCount,Volume3D,XStericQuadrupole3D,YStericQuadrupole3D,ZStericQuadrupole3D,FeatureCount3D,FeatureAcceptorCount3D,FeatureDonorCount3D,FeatureAnionCount3D,FeatureCationCount3D,FeatureRingCount3D,FeatureHydrophobeCount3D,ConformerModelRMSD3D,EffectiveRotorCount3D,ConformerCount3D,Fingerprint2D/JSON http://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/cid/synonyms/JSON Trying to get chemical information from RDKit using PubChem_Canonical SMILES C(C(=O)O)NCP(=O)(O)O -........ +....... DONE =========================================================================== diff --git a/tests/testthat/test_pai.R b/tests/testthat/test_pai.R index 944ad04..1718a9a 100644 --- a/tests/testthat/test_pai.R +++ b/tests/testthat/test_pai.R @@ -1,8 +1,8 @@ context("Generation of pai objects") glyphosate <- pai$new("glyphosate", chyaml = FALSE) - -test_that("We can generate a pai object from its ISO common name", { + +test_that("a pai object is generated from its ISO common name", { expect_equivalent(glyphosate$alanwood$cas, "1071-83-6") expect_equivalent(glyphosate$alanwood$formula, "C3H8NO5P") expect_equivalent(glyphosate$alanwood$iupac_name, "N-(phosphonomethyl)glycine") @@ -12,8 +12,8 @@ test_that("We can generate a pai object from its ISO common name", { expect_equal(glyphosate$inchikey, ik) }) -test_that("RDKit information was added", { - expect_equivalent(glyphosate$rdkit$mw, 169.073) +test_that("a pai object is generated from an ambiguous name", { + deltamethrin <- pai$new("deltamethrin", chyaml = FALSE) }) test_that("PubChem information was added via webchem", { -- cgit v1.2.1