cpanse / uvpd

Ultra HRMS in combination with UVPD fragmentation for enhanced structural identification of organic micropollutants
https://doi.org/10.3390/molecules25184189
0 stars 0 forks source link

compare MS_Ready_SMILES and SMILES #6

Open cpanse opened 6 years ago

cpanse commented 6 years ago
#R
library(rcdk)
library(fingerprint)

NORMAN <- read.csv('inst/extdata/SusDat_SMILES_Selected.txt',
  sep='\t', header = TRUE)

n <- 100
set.seed(123)

NORMAN <- NORMAN[smp <- sample(nrow(NORMAN), n),]
(smp)

mols.MS_Ready_SMILES <- parse.smiles(as.character(NORMAN$MS_Ready_SMILES))
mols.SMILES <- parse.smiles(as.character(NORMAN$SMILES))

for (i in mols.MS_Ready_SMILES) {
  try(do.aromaticity(i))
  try(do.typing(i))
  try(do.isotopes(i))
}

fps.pubchem.mols.MS_Ready_SMILES <- lapply(mols.MS_Ready_SMILES,
  function(x){try(get.fingerprint(x, type='pubchem'))})

fps.pubchem.mols.SMILES <- lapply(mols.SMILES,
  function(x){try(get.fingerprint(x, type='pubchem'))})

fps.extended.mols.MS_Ready_SMILES <- lapply(mols.MS_Ready_SMILES,
  function(x){try(get.fingerprint(x, type='extended'))})

fps.extended.mols.SMILES <- lapply(mols.SMILES,
  function(x){try(get.fingerprint(x, type='extended'))})

table(sapply(fps.pubchem.mols.SMILES, class))
table(sapply(fps.pubchem.mols.MS_Ready_SMILES, class))
table(sapply(fps.extended.mols.SMILES, class))
table(sapply(fps.extended.mols.MS_Ready_SMILES, class))

fp.to.matrix(fps.pubchem.mols.MS_Ready_SMILES[1])

table(sapply(1:nrow(NORMAN),
  function(x){
    all.equal(fp.to.matrix(fps.pubchem.mols.MS_Ready_SMILES[x]),
      fp.to.matrix(fps.pubchem.mols.MS_Ready_SMILES[x]))}))

table(sapply(1:nrow(NORMAN),
  function(x){
    all.equal(fp.to.matrix(fps.extended.mols.MS_Ready_SMILES[x]),
      fp.to.matrix(fps.extended.mols.MS_Ready_SMILES[x]))}))
cpanse commented 6 years ago

no differences

> 
> table(sapply(1:nrow(NORMAN),
+   function(x){
+     all.equal(fp.to.matrix(fps.pubchem.mols.MS_Ready_SMILES[x]),
+       fp.to.matrix(fps.pubchem.mols.MS_Ready_SMILES[x]))}))

TRUE 
 100 
> 
> table(sapply(1:nrow(NORMAN),
+   function(x){
+     all.equal(fp.to.matrix(fps.extended.mols.MS_Ready_SMILES[x]),
+       fp.to.matrix(fps.extended.mols.MS_Ready_SMILES[x]))}))

TRUE 
 100 
>