Skip to content

Commit

Permalink
Merge pull request #24 from jasenfinch/devel
Browse files Browse the repository at this point in the history
v1.7.3
  • Loading branch information
Jasen Finch authored Feb 17, 2021
2 parents b75f330 + a44cb50 commit 2a57a8a
Show file tree
Hide file tree
Showing 114 changed files with 8,860 additions and 97 deletions.
3 changes: 3 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,6 @@ README*
^codecov\.yml$
LICENSE
^\.github$
^_pkgdown\.yml$
^docs$
^pkgdown$
9 changes: 9 additions & 0 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,13 @@ jobs:
key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }}
restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-

- name: Install Windows system dependencies
if: runner.os == 'Windows'
run: |
download.file('https://github.com/girke-lab/ChemmineOB/releases/download/3.0.0/openbabel3-build.zip','D:/a/openbabel3-build.zip')
untar('D:/a/openbabel3-build.zip',exdir = 'D:/a/openbabel3-build')
shell: Rscript {0}

- name: Install Linux system dependencies
if: runner.os == 'Linux'
run: |
Expand All @@ -77,6 +84,8 @@ jobs:
- name: Check
env:
_R_CHECK_CRAN_INCOMING_REMOTE_: false
OPEN_BABEL_SRC: D:/a/openbabel3-build/src
OPEN_BABEL_BIN: D:/a/openbabel3-build/bin
run: rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = "warning", check_dir = "check")
shell: Rscript {0}

Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ Read-and-delete-me
mfGen.o
RcppExports.o
mzAnnotation.dll
mzAnnotation.so
mzAnnotation.so
docs
9 changes: 6 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
Package: mzAnnotation
Title: Signal Annotation Tools for High Resolution Metabolomics
Version: 1.7.2
Version: 1.7.3
Authors@R:
person(given = "Jasen",
family = "Finch",
role = c("aut", "cre"),
email = "[email protected]")
Description: Tools for the putative annotation of high resolution metabolomics m/z.
data.
URL: https://github.com/jasenfinch/mzAnnotation
biocViews: MassSpectrometry, Metabolomics
URL: https://jasenfinch.github.io/pdi/
BugReports: https://github.com/jasenfinch/mzAnnotation/issues
Depends: R (>= 3.5)
Imports:
Rcpp,
Expand All @@ -26,7 +28,8 @@ Encoding: UTF-8
RoxygenNote: 7.1.1
LazyData: true
Suggests: testthat,
covr
covr,
zlibbioc
LinkingTo: Rcpp
Collate: allGenerics.R
allClasses.R
Expand Down
5 changes: 5 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# mzAnnotation 1.7.3

* Added a `NEWS.md` file to track changes to the package.

* Added a `pkgdown` site available at https://jasenfinch.github.io/mzAnnotation/.
2 changes: 1 addition & 1 deletion R/PIPsearch.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#' Putative Ionisation Product searching
#' Putative ionisation product search
#' @rdname PIPsearch
#' @param db object of class \code{MetaboliteDatabase}.
#' @param mz the accurate m/z to search.
Expand Down
8 changes: 4 additions & 4 deletions R/RcppExports.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ cnvrt <- function(input, inputType, outputType) {
.Call('_mzAnnotation_cnvrt', PACKAGE = 'mzAnnotation', input, inputType, outputType)
}

#' smileToMF
#' Convert SMILES to molecular formula
#' @description convert a smile to a molecular formula
#' @param smile a valid SMILE
#' @examples
Expand All @@ -19,7 +19,7 @@ smileToMF <- function(smile) {
.Call('_mzAnnotation_smileToMF', PACKAGE = 'mzAnnotation', smile)
}

#' smileToAccurateMass
#' Convert SMILES to accurate mass
#' @description convert a smile to an accurate mass
#' @param smile a valid SMILE
#' @examples
Expand All @@ -29,7 +29,7 @@ smileToAccurateMass <- function(smile) {
.Call('_mzAnnotation_smileToAccurateMass', PACKAGE = 'mzAnnotation', smile)
}

#' smartsSearch
#' SMARTS substructure search
#' @description SMARTS substructure searching for SMILES.
#' @param smile a valid SMILE
#' @param smart a valid SMARTS symbol
Expand All @@ -44,7 +44,7 @@ descriptor <- function(smile, desc) {
.Call('_mzAnnotation_descriptor', PACKAGE = 'mzAnnotation', smile, desc)
}

#' ppmRange
#' Calculate a PPM error range
#' @description Calculate the upper and lower ppm boundaries for a given m/z
#' @param mz the m/z for which to calculate the range
#' @param ppm the ppm
Expand Down
2 changes: 1 addition & 1 deletion R/adductTransfromMF.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#' adductTransformMF
#' Molecular formula adduct transformation
#' @description adduct transform a molecular formula.
#' @param MF molecular formula to transform.
#' @param adduct adduct to use for transformation.
Expand Down
2 changes: 1 addition & 1 deletion R/allClasses.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# setOldClass('tbl_dbi')
# setClassUnion('metabolite_table',c('tbl_df','tbl_dbi'))

#' MetaboliteDatabase
#' Metabolite database class
#' @export

setClass('MetaboliteDatabase',
Expand Down
2 changes: 1 addition & 1 deletion R/aminoAcids.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#' aminoAcids
#' Example amino acids
#' @description Chemical structures of the essential amino acids
#' @format a tibble containing 20 rows and 6 columns
#' \describe{
Expand Down
2 changes: 1 addition & 1 deletion R/calcAccurateMass.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#' calcAccurateMass
#' Calculate molecular formula accurate mass
#' @description calculate the accurate mass of a given molecular formula
#' @param MF molecular formula for which to calculate the accrate mass
#' @param charge charge of the given molecular formula
Expand Down
2 changes: 1 addition & 1 deletion R/calcAdducts.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#' calcAdducts
#' Calculate adducts
#' @rdname calcAdducts
#' @description Calculate ionisation products for given database accession.
#' @param db object of class \code{MetaboliteDatabase}
Expand Down
2 changes: 1 addition & 1 deletion R/calcM.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#' calcM
#' Calculate the mass of an m/z
#' @description calculate M for a given m/z, adduct, isotope and transformation
#' @param mz m/z for which to calculate M
#' @param adduct adduct to apply
Expand Down
2 changes: 1 addition & 1 deletion R/calcMZ.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#' calcM
#' Calculate the m/z of a mass
#' @description calculate an m/z for a given M, adduct, isotope and transformation
#' @param M M for which to calculate an m/z
#' @param adduct adduct to apply
Expand Down
2 changes: 1 addition & 1 deletion R/convert.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#' convert
#' Convert chemical notation
#' @description convert between SMILES and Inchi and to InchiKey
#' @param input a valid SMILE or Inchi
#' @param inputType either "smiles" or "inchi", denoting the input type
Expand Down
8 changes: 4 additions & 4 deletions R/data.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#' adducts
#' Adduct formation rules
#' @description Formation rules for electrospray ionisation adducts
#' @format A tibble containing 58 rows and 6 columns
#' \describe{
Expand All @@ -19,7 +19,7 @@ adducts <- function(){
return(Adducts)
}

#' elements
#' Elemental information
#' @description Elemental information
#' @format A tibble containing 31 rows and 5 columns.
#' @export
Expand All @@ -28,7 +28,7 @@ elements <- function(){
return(Elements)
}

#' isotopes
#' Isotopic rules
#' @description Isotope rules
#' @format A tibble containing 8 rows and 3 columns.
#' \describe{
Expand All @@ -42,7 +42,7 @@ isotopes <- function(){
return(Isotopes)
}

#' transformations
#' Transformation rules
#' @description Transformation rules
#' @format A tibble containing 12 rows and 9 columns.
#' \describe{
Expand Down
3 changes: 1 addition & 2 deletions R/descriptors.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#' convert SMILES to a series of molecular descriptors
#'
#' Molecular descriptors
#' @param SMILES a character vector of valid SMILES
#' @importFrom dplyr mutate
#' @importFrom parallel makeCluster parLapply stopCluster
Expand Down
10 changes: 5 additions & 5 deletions R/filter-methods.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#' filterMR
#' Filter a mass range
#' @rdname filterMR
#' @description Filter a MetaboliteDatabase for a given mass range.
#' @param db S4 object of class MetaboliteDatabase
Expand All @@ -23,7 +23,7 @@ setMethod('filterMR',signature = 'MetaboliteDatabase',
}
)

#' filterER
#' Filter using an elemental rule
#' @rdname filterER
#' @description Filter a MetaboliteDatabase based on an elemental rule.
#' @param db S4 object of class MetaboliteDatabase
Expand All @@ -50,7 +50,7 @@ setMethod('filterER',signature = 'MetaboliteDatabase',
}
)

#' filterIP
#' Filter using an ionisation rule
#' @rdname filterIP
#' @description Filter MetaboliteDatabase based on an ionisation rule
#' @param db S4 object of class MetaboliteDatabase
Expand All @@ -75,7 +75,7 @@ setMethod('filterIP',signature = 'MetaboliteDatabase',
}
)

#' filterACCESSIONS
#' Filter accessions
#' @rdname filterACCESSIONS
#' @description Filter a MetaboliteDatabase based on given accession IDs.
#' @param db S4 object of class MetaboliteDatabase
Expand All @@ -97,7 +97,7 @@ setMethod('filterACCESSIONS',signature = 'MetaboliteDatabase',
}
)

#' filterMF
#' Filter a molecular formula
#' @rdname filterMF
#' @description Filter a MetaboliteDatabase based on given molecular formulas
#' @param db S4 object of class MetaboliteDatabase
Expand Down
2 changes: 1 addition & 1 deletion R/generateMF.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#' generateMF
#' Molecular formula generation
#' @description Molecular formula generation
#' @param mass accurate mass
#' @param ppm ppm tolerance
Expand Down
4 changes: 2 additions & 2 deletions R/get-methods.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#' getAccessions-MetaboliteDatabase
#' Retrieve accessions
#' @rdname getAccessions
#' @description return accession data table from MetaboliteDatabase object
#' @param db MetaboliteDatabase
Expand All @@ -10,7 +10,7 @@ setMethod('getAccessions',signature = 'MetaboliteDatabase',
}
)

#' getDescriptors-MetaboliteDatabase
#' Retrieve descriptors
#' @rdname getDescriptors
#' @description return descriptor data table from MetaboliteDatabase object
#' @param db MetaboliteDatabase
Expand Down
2 changes: 1 addition & 1 deletion R/ionisationProducts.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#' Ionisation Products
#' Ionisation products
#' @description Calculate ionisation products for a given SMILES.
#' @param SMILES a valid SMILES string
#' @param adductTable table of adduct rules. Defaults to adducts()
Expand Down
2 changes: 1 addition & 1 deletion R/isotopeDistribution.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#' Isotopic Distribution Calculator
#' Isotopic distribution calculator
#' @param MF the molecular formular to generate the isotope distribution
#' @param charge the charge of the molecular formula
#' @param limit the relative abundance threshold
Expand Down
2 changes: 1 addition & 1 deletion R/metaboliteDB.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#' metaboliteDB
#' Create a metabolite database
#' @description Build a metabolite database ready for use.
#' @param accessions tibble containing accession information. If \code{type = 'remote'} this should be the name of the table containing the accession information within the SQL database.
#' @param descriptors tibble containing descriptor information as returned by \code{descriptors()}. If \code{type = 'remote'} this should be the name of the table containing the descriptor information within the SQL database.
Expand Down
2 changes: 0 additions & 2 deletions R/mzAnnotation.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#' mzAnnotation
#' @name mzAnnotation
#' @useDynLib mzAnnotation
#' @importFrom Rcpp evalCpp

Expand Down
2 changes: 1 addition & 1 deletion R/ppmError.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#' ppmError
#' Calculate PPM error
#' @description Calculate ppmError between a measured and theoretical m/z
#' @param measured measured m/z
#' @param theoretical theoretical m/z
Expand Down
2 changes: 1 addition & 1 deletion R/transformMF.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#' transformMF
#' Transform a molecular formula
#' @description transform a molecular formula
#' @param MF molecular formula to transform
#' @param transformation transformation to apply
Expand Down
5 changes: 5 additions & 0 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ An R package containing tools for putative annotation of accurate m/z from elect
### Installation

To install run:

```R
devtools::install_github('jasenfinch/mzAnnotation')
```
Expand All @@ -29,13 +30,15 @@ library(mzAnnotation)
```

* Adduct, isotope and biotransfromation relationship prediction

```{r}
res <- relationshipCalculator(c(132.03023,168.00691))
res
```

* Molecular formula generation

```{r}
res <- generateMF(342.11621,
element_max = c(C = 12,H = 22,N = 0,
Expand All @@ -44,12 +47,14 @@ res
```

* Isotope distribution calculation

```{r}
res <- isotopeDistribution(MF = 'C4H5O5',charge = -1)
res
```

* Putative ionisation product searches

```{r}
db <- metaboliteDB(aminoAcids,descriptors(aminoAcids$SMILES))
res <- PIPsearch(db = db,
Expand Down
16 changes: 4 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ devtools::install_github('jasenfinch/mzAnnotation')

Available tools include:

- Adduct, isotope and biotransfromation relationship prediction

<!-- end list -->
- Adduct, isotope and biotransfromation relationship prediction

``` r
res <- relationshipCalculator(c(132.03023,168.00691))
Expand All @@ -36,9 +34,7 @@ res
#> # … with 2 more variables: Transformation2 <lgl>, Error <dbl>
```

- Molecular formula generation

<!-- end list -->
- Molecular formula generation

``` r
res <- generateMF(342.11621,
Expand All @@ -51,9 +47,7 @@ res
#> 1 C12H22O11 342. 0
```

- Isotope distribution calculation

<!-- end list -->
- Isotope distribution calculation

``` r
res <- isotopeDistribution(MF = 'C4H5O5',charge = -1)
Expand All @@ -71,9 +65,7 @@ res
#> 8 13C 1; 17O 1 135. 0.0000900 0.0000850
```

- Putative ionisation product searches

<!-- end list -->
- Putative ionisation product searches

``` r
db <- metaboliteDB(aminoAcids,descriptors(aminoAcids$SMILES))
Expand Down
1 change: 1 addition & 0 deletions _pkgdown.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
url: https://jasenfinch.github.io/mzAnnotation/
Loading

0 comments on commit 2a57a8a

Please sign in to comment.