-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* move from magrittr to base r * fix imports and add url * update docs and Description * style pkgdown * add orcid * rename * update depict for rxn check * add rxn smiles test * style pass * update allowable classes * add a get_svg_string function * add icon * update to use SVG strings directly * use cat to get cleaner vignette --------- Co-authored-by: Zachary Charlop-Powers <[email protected]>
- Loading branch information
Showing
24 changed files
with
320 additions
and
267 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,26 @@ | ||
Package: depict | ||
Type: Package | ||
Title: Draw Beautiful Molecular Structures | ||
Version: 0.3.1 | ||
Authors@R: c(person('Zachary', 'Charlop-Powers', role=c('cre','aut',"cph"), email='[email protected]')) | ||
Version: 0.4.0 | ||
Authors@R: c( | ||
person('Zachary', 'Charlop-Powers', ,'[email protected]',role=c('cre'), | ||
comment = c(ORCID = "0000-0001-8816-4680"))) | ||
Description: Generate images of molecules using the Depiction API of the 'Chemistry Development Kit'. | ||
CDK's Depict Api | ||
License: LGPL | ||
LazyData: TRUE | ||
Depends: | ||
rJava (>= 1.0-6), | ||
rJava (>= 1.0-11), | ||
rcdk (>= 3.7), | ||
rcdklibs (>= 2.8) | ||
Imports: | ||
png, | ||
magrittr | ||
RoxygenNote: 7.2.2 | ||
png | ||
RoxygenNote: 7.3.1 | ||
Encoding: UTF-8 | ||
URL: https://cdk-r.github.io/depict/ | ||
Suggests: | ||
knitr, | ||
magrittr, | ||
rmarkdown, | ||
testthat | ||
testthat, | ||
VignetteBuilder: knitr |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,58 +1,54 @@ | ||
#' match_smarts | ||
#' | ||
#' | ||
#' Find matches to a given molecule using a SMARTs pattern. | ||
#' | ||
#' @param smarts a SMARTS string | ||
#' @param mol a CDK IAtomContainer or a java.util.Arraylist of them | ||
#' @param limit limit of the number of matches | ||
#' | ||
#' | ||
#' @seealso \url{https://cdk.github.io/cdk/latest/docs/api/org/openscience/cdk/isomorphism/Mappings.html} | ||
#' @seealso \url{https://cdk.github.io/cdk/latest/docs/api/org/openscience/cdk/smiles/smarts/SmartsPattern.html} | ||
#' | ||
#' | ||
#' @return a hashset of atoms and bonds | ||
#' @export | ||
#' | ||
#' | ||
match_smarts <- function(smarts, mol, limit=10) { | ||
|
||
|
||
hashset <- J("java/util/HashSet") | ||
#' | ||
match_smarts <- function(smarts, mol, limit = 10) { | ||
hashset <- J("java/util/HashSet") | ||
smartspattern <- J("org/openscience/cdk/smiles/smarts/SmartsPattern") | ||
spattern <- smartspattern$create(smarts, NULL) | ||
spattern <- smartspattern$create(smarts, NULL) | ||
|
||
# handle the base case first | ||
if (!.jclass(mol) == "java.util.ArrayList") { | ||
|
||
matches <- spattern$matchAll(mol) | ||
matches <- matches$limit(as.integer(limit)) | ||
# Note: switching below to chemobjects due to reflection access with the atom-bond map | ||
# atombondmap <- matches$uniqueAtoms()$toAtomBondMap() | ||
atombonds <- matches$uniqueAtoms()$toChemObjects() | ||
atombonds <- matches$uniqueAtoms()$toChemObjects() | ||
|
||
# somewhat convoluted code to get all of the matching atoms | ||
highlight <- new(hashset) | ||
|
||
for (l in as.list(atombonds)) { | ||
highlight$add(l) | ||
} | ||
# then handle the array list of atom containers | ||
|
||
# then handle the array list of atom containers | ||
} else { | ||
|
||
# somewhat convoluted code to get all of the matching atoms | ||
highlight <- new(hashset) | ||
|
||
for (atmcont in as.list(mol)) { | ||
matches <- spattern$matchAll(atmcont) | ||
matches <- matches$limit(as.integer(limit)) | ||
# Note: switching below to chemobjects due to reflection access with the atom-bond map | ||
# atombondmap <- matches$uniqueAtoms()$toAtomBondMap() | ||
atombonds <- matches$uniqueAtoms()$toChemObjects() | ||
atombonds <- matches$uniqueAtoms()$toChemObjects() | ||
for (l in as.list(atombonds)) { | ||
highlight$add(l) | ||
} | ||
} | ||
} | ||
|
||
highlight | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.