Skip to content

Commit

Permalink
update with new paper
Browse files Browse the repository at this point in the history
  • Loading branch information
yufree committed Nov 6, 2020
1 parent e0fd026 commit b305d58
Show file tree
Hide file tree
Showing 108 changed files with 690 additions and 571 deletions.
6 changes: 5 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
# pmd 0.2.0

- add option to skip sda in GlobalStd algorithm
- add option to skip sda in GlobalStd algorithm and set default to F
- organize the R files
- add vignette for reactomics analysis
- add correlation directed analysis function
- modified getcorcluster function to find independent peaks
- add vignette section for reduced independent peaks selection in GlobalStd algorithm
- fix the issue for getchain with multiple masses
- fix the correlation issue in pos/neg linkage function
- Output within RT clusters high frequencies PMD(s) as message for user to check
- Change default ng to NULL in getpared function for automately generate parameter based on data
- update with citation of cc paper

# pmd 0.1.9

Expand Down
17 changes: 9 additions & 8 deletions R/globalstd.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#' Filter ions/peaks based on retention time hierarchical clustering, paired mass distances(PMD) and PMD frequency analysis.
#' @param list a list with mzrt profile
#' @param rtcutoff cutoff of the distances in retention time hierarchical clustering analysis, default 10
#' @param ng cutoff of global PMD's retention time group numbers, default 10. If ng = NULL, 20 percent of RT cluster will be used as ng.
#' @param ng cutoff of global PMD's retention time group numbers, If ng = NULL, 20 percent of RT cluster will be used as ng, default NULL.
#' @param digits mass or mass to charge ratio accuracy for pmd, default 2
#' @param accuracy measured mass or mass to charge ratio in digits, default 4
#' @return list with tentative isotope, multi-chargers, adducts, and neutral loss peaks' index, retention time clusters.
Expand All @@ -13,7 +13,7 @@
getpaired <-
function(list,
rtcutoff = 10,
ng = 10,
ng = NULL,
digits = 2,
accuracy = 4) {
# paired mass diff analysis
Expand Down Expand Up @@ -235,7 +235,7 @@ getpaired <-
),
c(list$paired$rtg, list$paired$rtg))
}
# get the data index by rt groups with high frequences
# get the data index by rt groups with high frequencies
# PMD
list$diffindex <-
paste(round(list$mz, accuracy), list$rtcluster) %in%
Expand Down Expand Up @@ -287,6 +287,7 @@ getpaired <-
"unique within RT clusters high frequency PMD(s) used for further investigation."
)
)
message(paste(c("The unique within RT clusters high frequency PMD(s) is(are) ", unique(list$paired$diff2)), collapse=" "), '.')
message(paste(
sum(list$isoindex),
"isotopologue(s) related paired mass found."
Expand Down Expand Up @@ -650,12 +651,12 @@ getstd <-
#' GlobalStd algorithm with structure/reaction directed analysis
#' @param list a peaks list with mass to charge, retention time and intensity data
#' @param rtcutoff cutoff of the distances in cluster, default 10
#' @param ng cutoff of global PMD's retention time group numbers, default 10. If ng = NULL, 20 percent of RT cluster will be used as ng.
#' @param ng cutoff of global PMD's retention time group numbers, If ng = NULL, 20 percent of RT cluster will be used as ng, default NULL.
#' @param corcutoff cutoff of the correlation coefficient, default NULL
#' @param digits mass or mass to charge ratio accuracy for pmd, default 2
#' @param accuracy measured mass or mass to charge ratio in digits, default 4
#' @param freqcutoff pmd freqency cutoff for structures or reactions, default NULL. This cutoff will be found by PMD network analysis when it is NULL.
#' @param sda logical, option to perform structure/reaction directed analysis, default T.
#' @param sda logical, option to perform structure/reaction directed analysis, default FALSE.
#' @return list with GlobalStd algorithm processed data.
#' @examples
#' data(spmeinvivo)
Expand All @@ -664,12 +665,12 @@ getstd <-
#' @export
globalstd <- function(list,
rtcutoff = 10,
ng = 10,
ng = NULL,
corcutoff = NULL,
digits = 2,
accuracy = 4,
freqcutoff = NULL,
sda = T) {
sda = FALSE) {
list <-
getpaired(
list,
Expand Down Expand Up @@ -840,7 +841,7 @@ getcluster <- function(list,
msdata <- NULL
} else{
data <- list$data
if (is.matrix(data)) {
if (is.matrix(data)|is.data.frame(data)) {
msdata <- apply(data, 1, sum)
} else {
msdata <-sum(data)
Expand Down
4 changes: 2 additions & 2 deletions R/pmdda.R
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ getposneg <- function(pos,neg, pmd = 2.02, digits = 2){
if(sum(round((pos$mz[i]-neg$mz),digits) %in% pmd) != 0){
index <- round((pos$mz[i]-neg$mz),digits) %in% pmd
if(sum(index)>1){
cor <- apply(neg$data[index,],1,function(x) suppressWarnings(cor(x,pos$data[i,])))
cor <- apply(neg$data[index,],1,function(x) suppressWarnings(cor(as.numeric(x),as.numeric(pos$data[i,]))))
}else{
cor <- suppressWarnings(cor(pos$data[i,],neg$data[index,]))
cor <- suppressWarnings(cor(as.numeric(pos$data[i,]),as.numeric(neg$data[index,])))
}

t <- cbind.data.frame(pos=pos$mz[i],rt = pos$rt[i],neg=neg$mz[index],rt=neg$rt[index],diffmz=pos$mz[i]-neg$mz[index],diffrt=pos$rt[i]-neg$rt[index],cor=cor)
Expand Down
2 changes: 1 addition & 1 deletion R/pmdvis.R
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ plotstdrt <- function(list, rtcluster, ...) {
#' @seealso \code{\link{getstd}}, \code{\link{globalstd}},\code{\link{plotstd}},\code{\link{plotpaired}},\code{\link{plotstdrt}}
#' @examples
#' data(spmeinvivo)
#' re <- globalstd(spmeinvivo)
#' re <- globalstd(spmeinvivo, sda=TRUE)
#' plotstdsda(re)
#' @export
plotstdsda <- function(list, index = NULL, ...) {
Expand Down
16 changes: 12 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ pmd: Paired Mass Distance Analysis for GC/LC-MS Based Non-Targeted Analysis and

[![CRAN status](http://www.r-pkg.org/badges/version/pmd)](https://cran.r-project.org/package=pmd) [![Download counter](http://cranlogs.r-pkg.org/badges/pmd)](https://cran.r-project.org/package=pmd) [![](https://cranlogs.r-pkg.org/badges/grand-total/pmd)](https://cran.r-project.org/package=pmd) [![Project Status: Active - The project has reached a stable, usable state and is being actively developed.](http://www.repostatus.org/badges/latest/active.svg)](http://www.repostatus.org/#active) [![Build status](https://api.travis-ci.org/yufree/pmd.svg?branch=master)](https://travis-ci.org/yufree/pmd)

Paired mass distance (PMD) analysis proposed in Yu, Olkowicz and Pawliszyn (2018) for gas/liquid chromatography–mass spectrometry (GC/LC-MS) based non-targeted analysis. PMD analysis including GlobalStd algorithm and structure/reaction directed analysis. GlobalStd algorithm could found independent peaks in m/z-retention time profiles based on retention time hierarchical cluster analysis and frequency analysis of paired mass distances within retention time groups. Structure directed analysis could be used to find potential relationship among those independent peaks in different retention time groups based on frequency of paired mass distances. Reactomics analysis could also be performed to build PMD network, assign sources and make biomarker reaction discovery. GUIs for PMD analysis is also included as 'shiny' applications.
Paired mass distance (PMD) analysis proposed in Yu, Olkowicz and Pawliszyn (2018) and PMD based reactomics proposed in Yu and Petrick (2020) for gas/liquid chromatography–mass spectrometry (GC/LC-MS) based non-targeted analysis. PMD analysis including GlobalStd algorithm and structure/reaction directed analysis. GlobalStd algorithm could found independent peaks in m/z-retention time profiles based on retention time hierarchical cluster analysis and frequency analysis of paired mass distances within retention time groups. Structure directed analysis could be used to find potential relationship among those independent peaks in different retention time groups based on frequency of paired mass distances. Reactomics analysis could also be performed to build PMD network, assign sources and make biomarker reaction discovery. GUIs for PMD analysis is also included as 'shiny' applications.


Installation
Expand All @@ -28,17 +28,19 @@ Usage

- [Reactomics Analysis Tutorial](https://yufree.github.io/pmd/articles/reactomics.html)

- [Slides](http://yufree.github.io/presentation/reactomics/pres-asms.html). This is the slides for ASMS 2020 Reboot and here is the [video](https://youtu.be/-mT3HcVygHE) of presentation. Press "P" and you will see the notes for each slide with details. Another full version of reactomics presentation for one hour presentation could be found [here](http://yufree.github.io/presentation/reactomics/pres). I will not update the conference presentation while I will add new contents for the full version of reactomics presentation whenever I have new results.
- [PMD analysis paper](https://www.sciencedirect.com/science/article/abs/pii/S0003267018313047). This paper proposed structure/reaction directed analysis with PMD.

- [Reactomics paper](https://www.nature.com/articles/s42004-020-00403-z). This paper contained the concepts of PMD based reactomics, applications and data mining of reaction database and compounds database.

- [Reactomics Preprint on BioRxiv](https://www.biorxiv.org/content/10.1101/855148v3). This preprint contain the same contents as shown in the presentation. I will update the manuscript later in this week for some changes.
- [Slides](http://yufree.github.io/presentation/reactomics/pres-asms.html). This is the slides for ASMS 2020 Reboot and here is the [video](https://youtu.be/-mT3HcVygHE) of presentation. Press "P" and you will see the notes for each slide with details. Another full version of reactomics presentation for one hour presentation could be found [here](http://yufree.github.io/presentation/reactomics/pres). I will not update the conference presentation while I will add new contents for the full version of reactomics presentation whenever I have new results.


To perform GlobalStd algorithem, use the following code:

``` {r}
library(pmd)
data("spmeinvivo")
pmd <- getpaired(spmeinvivo, rtcutoff = 10, ng = 10)
pmd <- getpaired(spmeinvivo)
std <- getstd(pmd)
```
To perform structure/reaction directed analysis, use the following code:
Expand Down Expand Up @@ -79,3 +81,9 @@ To check the HMDB pmd database:
data("hmdb")
View(hmdb)
```

To cite related papers:

```{r}
citation('pmd')
```
2 changes: 1 addition & 1 deletion docs/404.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit b305d58

Please sign in to comment.