protViz / deisotoper

Implementation, development, and evaluation of algorithms for the detection and extraction of isotope pattern of a mass spectrometric measurement.
https://CRAN.R-project.org/package=deisotoper
GNU General Public License v3.0
0 stars 1 forks source link

R code usage example #55

Open wolski opened 6 years ago

wolski commented 6 years ago

R - low-level interface

CP, Please review and assign to LS

Input data: mZ and intensity are obligatory the other attributes are not

x1 <- list(mZ = c(642.572, 643.054, 643.569, 644.062, 644.557),
               intensity = c(17000, 25000, 12000, 9000, 4000),
               title = "A MS from a heavy labeld peptide in water
background.",
               rtinseconds = 1.01,
               charge = 2,
               scan = 1,
               id = 1,
               pepmass = 700.01)

x2 <- x1

Construct Deisotoper

With default parameters

dtoper <- deisotoper()

With parameter list

dtoper <- deisotoper("Param1"=3, "Param3" = 2, "F3" = 3, "F4" = 0.5)

The dtoper is an R class based on an R list.

> class(dtoper)
"deisotoperFGCZ" 

> names(dtoper)
"javaObjectRef"

> dtoper$javaObjectRef
java@mamboJambo

Run and retrieve information about its state.

config <- getConfig(dtoper)

x1d <- deisotope(dtoper , x1) # same as x1 but deisotoped
xa1d <- getAnnotatedSpectrum(dtoper) # peaklist with charge, isotopeSet id etc.

dotgraphs <- getDotGraphs(dtoper)
.plotDot(dotgraphs[1]) # only as R helper function

s1 <- summary(dtoper) # nr of isotopicSets, isotopic clusters per set, nr of peaks, etc 
sc1 <- scores(dtoper) # returns the dataframe with the peak scores

Deisope a different spectrum with the same deisotoper.

x2<- deisotope(dtoper,  x2 )
dotgraphs <- getDotGraphs(dtoper)

Create a second deisotoper with different settings and deisotope x1

config2 <- list("Param1"=6, "Param3" = 9, "F3" = 3, "F4" = 0.5)
dtoper2 <- deisotoper(config2)
x1d2 <- deisotope(dtoper2 , x1)
s12 <- summary(dtoper2)

Compare results of deisotoping with 2 different deisotopers.

plot(x1d2, x1d)
LucasSchmidt97 commented 6 years ago

R Interface needed functions:

getMZ doublearray getIntensity doublearray getDOTGraph string getSummary string ...

For Java Implementation example see issue #65

LucasSchmidt97 commented 6 years ago

Remove R methods and finish java then R interface

LucasSchmidt97 commented 6 years ago

Works like described. See https://github.com/protViz/deisotoper/blob/51d12fce8463f716a9c6c7707964777218694dc5/R/deisotoper.R#L1