batmanrerun: Perform BATMAN with Fixed (Previously Estimated) Multiplet...

Description Usage Arguments Value See Also Examples

View source: R/batmanrerun.R

Description

This performs metabolite and wavelet fitting to input NMR spectra with fixed multiplet position obtained from running batman, and also plots fitting results. The user should modify parameters in the copy file "batmanOptions.txt" in batman output folder to change the rerun settings.

Usage

1
2
3
 batmanrerun(BM, figBatmanFit = TRUE, listMeta = FALSE, 
             figRelCon = FALSE, figMetaFit = FALSE, showPlot)
 

Arguments

BM

batman output data frame.

figBatmanFit

Plot metabolites and wavelets fit if set TRUE. The default is TRUE.

listMeta

Individual metabolite fit will also be shown in the plot if set TRUE. The default is FALSE.

figRelCon

Plot posterior samples of the relative concentration for listed metabolites with 95% credible interval if set TRUE. The default is FALSE.

figMetaFit

If set TRUE, plot the posterior mean of the metabolites fit with 95% credible interval. The default is FALSE.

showPlot

If set FALSE, no plot will be shown on display, the pdf file(s) for the figure plot(s) will be created in output folder. If missing from input, for windows and osx operating systems, it will be set to TRUE, for the rest operating systems, it will be set to FALSE automatically.

Value

When batmanrerun is called with multiplet ppm shifts fixed from the batman results, the following objects are added to the batman result:

sFitRerun

A matrix t \times 5n of BATMAN rerun fit results (down sampled). For 1 spectrum, it is a matrix with 5 columns:

[ppm, original spectrum, metabolites fit, wavelets fit, overall fit].

n is the number of spectra, and t is the number of data points in each spectrum.

sFitRerunHR

A matrix t \times 3n of BATMAN rerun fit results in the original resolution (without down sample). For 1 spectrum, it is a matrix with 3 columns:

[ppm, original spectrum, metabolites fit].

n is the number of spectra, and t is the number of data points (without down sample) in each spectrum.

betaRerun

For batman rerun, a matrix (m \times n) containing the posterior means of relative concentrations for m fitted metabolites and n spectra.

betaSamRerun

For batman rerun, a matrix (m \times (s*n)) containing (for the first spectrum) s posterior samples of the relative concentrations in its rows. m is the number of fitted metabolites. n is the number of spectra analyzed. The subsequent columns contain the same data format for the rest n-1 spectra.

betaCIRerun

For batman rerun, a matrix (m \times 2n) containing the 95% credible interval of the relative concentrations for m fitted metabolites. Every pair of columns is for one spectrum.

metaTempRerun

For batman rerun, a matrix (t \times (m*n)) containing the posterior means of m fitted metabolite templates in its columns (down sampled). n is the number of spectra analyzed and t is the number of data points in each spectrum.

metaTempRerunHR

For batman rerun, a matrix (t \times (m*n)) containing the posterior means of m fitted metabolite templates in its columns (without down sample). n is the number of spectra analyzed and t is the number of data points (without down sample) in each spectrum.

metaFitSamRerun

For batman rerun, a matrix (t \times (s*n)) containing s posterior samples of total metabolites fit in its columns. n is the number of spectra analyzed and t is the number of data points in each spectrum. The remaining n-1 spectra metabolites fit results are saved in the same sequence in subsequent columns.

metaIndFitSamRerun

For batman rerun, a matrix (t \times (m*s*n)) containing s posterior samples of m individual metabolites fit in its columns. n is the number of spectra analyzed and t is the number of data points in each spectrum. The remaining n-1 spectra results are saved in the same sequence in subsequent columns.

thetaSamRerun

For batman rerun, a matrix (t \times (s*n)) containing s samples of wavelet fit in its columns. n is the number of spectra analyzed. The remaining n-1 spectra wavelet fit results are saved in the same sequence in subsequent columns.

outputDir

The directory of output folder with all the output result files.

See Also

batman, readBatmanOutput

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
library(batman)
## Run batman
if(interactive()) 
{
bm<-batman()
## then call batmanrerun
bm<-batmanrerun(bm)
}
#######################################################################
## The following is an example of what will be displayed in R 
## and what value the user could input:
#######################################################################
## Rerunning batman for  500  iterations.
## percentage completed...                                                                          
##   |                                                                  |   0%
## Size of each spectrum is 382.
## Size of metabolite list is 22.
## Constructing chain data structure...
## time used is 1 seconds.
## Running MCMC...                                                                      
##   |==================================================================| 100%
## time used is 65 seconds.
## saving posteriors...
## 
## For rerun, time elapsed 
##  65.96 seconds.
## Reading in saved data in folder
## .../user_specified_dir/runBATMAN/BatmanOutput/07_Dec_17_35_53
## Completed.
########################################################################
## Alternatively if more than 1 spectrum are included without using fixed  
## effect, user will be asked to input whether to parallelize the analysis 
## between spectra.
########################################################################
## How many parallel processes (multicores) do you want to run the 
## multi-spectra analysis?
## (Enter 1 for running them sequentially.)
##
## Parallel processing of multi spectra currently cannot display 
## the progress bar (or any words), if you input is > 1, please be patient 
## for the results :)
##
## 1: 2  ## user input
##
## For rerun, time elapsed 
##   64.4 
## Reading in saved data in folder
## .../user_specified_dir/runBATMAN/BatmanOutput/07_Dec_17_35_53
## Completed.
#######################################################################

Example output



batman documentation built on May 2, 2019, 6:13 p.m.