Skip to content

Commit

Permalink
Merge pull request #48 from Meredith-Lab/temperature
Browse files Browse the repository at this point in the history
Fix inconsistent value for temperature
  • Loading branch information
Aariq authored Jul 6, 2023
2 parents 075a79e + 14bc537 commit e3c5ccc
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 13 deletions.
2 changes: 1 addition & 1 deletion CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ message: 'To cite package "volcalc" in publications use:'
type: software
license: MIT
title: 'volcalc: Calculate Volatility of Chemical Compounds'
version: 1.0.0
version: 1.0.1
abstract: Use this package to calculate estimated volatility values for individual
compounds of interest or for all compounds in a pathway. Calculation uses the SIMPOL
method (Prankow and Asher, 2008), and is only currently applicable to compounds
Expand Down
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: volcalc
Title: Calculate Volatility of Chemical Compounds
Version: 1.0.0.9000
Version: 1.0.1
Authors@R: c(
person("Kristina", "Riemer", , "[email protected]", role = c("aut", "cre", "cph"),
comment = c(ORCID = "0000-0003-3802-3331")),
Expand Down
4 changes: 3 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# volcalc (development version)
# volcalc 1.0.1

* Minor change in calculation in `calc_vol()`---use 293.15K for temperature (instead of 293K) to match the temperature used in Pankow & Asher (2008)

# volcalc 1.0.0

Expand Down
2 changes: 1 addition & 1 deletion R/calc_vol.R
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ calc_vol <-
# mass is converted from grams to micrograms
# 0.0000821 is universal gas constant
# 293 is temperature in Kelvins
dplyr::mutate(log_alpha = log((1000000*mass)/(0.0000821*293), base = 10),
dplyr::mutate(log_alpha = log((1000000*mass)/(0.0000821*293.15), base = 10),
# multiplier for each functional group is volatility contribution
log_Sum =
(-0.438 * carbons) %+%
Expand Down
2 changes: 1 addition & 1 deletion README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ pak::pkg_install('volcalc')
You can install the 'legacy' version used in our in-prep publication with

``` r
pak::pkg_install("Meredith-Lab/[email protected].0")
pak::pkg_install("Meredith-Lab/[email protected].1")
```

Installation of `volcalc` requires the system libraries [OpenBabel](https://openbabel.org/) and Eigen3 (requirements of the `ChemmineOB` package, which `volcalc` depends on). `pak` will take care of the installation of these libraries for you on some systems, but you may need to install them manually.
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ You can install the ‘legacy’ version used in our in-prep publication
with

``` r
pak::pkg_install("Meredith-Lab/[email protected].0")
pak::pkg_install("Meredith-Lab/[email protected].1")
```

Installation of `volcalc` requires the system libraries
Expand Down Expand Up @@ -123,7 +123,7 @@ calc_vol(compound_id = "C16181", path = out_path)
#> pathway compound formula name
#> CMP1 NA C16181 C6H7Cl5O beta-2,3,4,5,6-Pentachlorocyclohexanol
#> volatility category
#> CMP1 6.975571 high
#> CMP1 6.975349 high
```

This returns a dataframe with columns specifying general info about the
Expand Down Expand Up @@ -161,7 +161,7 @@ example_compound_vol <-
fx_groups_df = example_compound_fx_groups,
path = out_path)
print(example_compound_vol$volatility)
#> [1] 6.975571
#> [1] 6.975349
```

This example compound has a volatility around 7. It is in the high
Expand All @@ -179,7 +179,7 @@ pathway can be returned as below.
example_pathway_vol <- calc_pathway_vol("map00361", path = out_path)
print(example_pathway_vol[1,])
#> pathway compound formula name volatility category
#> CMP1 map00361 C00011 CO2 CO2; 7.914336 high
#> CMP1 map00361 C00011 CO2 CO2; 7.914113 high
```

## Dataframe columns
Expand Down
2 changes: 1 addition & 1 deletion inst/CITATION
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ c(
title = "volcalc: Calculate Volatility of Chemical Compounds",
author = person("Kristina", "Riemer", comment = c(ORCID = "0000-0003-3802-3331")),
year = "2023",
note = "R package version 1.0.0",
note = "R package version 1.0.1",
doi = "10.5281/zenodo.8015155",
header = "To cite volcalc in publications please use:"
),
Expand Down
6 changes: 3 additions & 3 deletions tests/testthat/test-calc_vol.R
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
test_that("volatility estimate is correct for example compound for entire workflow", {
ex_vol_df <- calc_vol(compound_id = "C16181", path = "data", redownload = FALSE)
expect_equal(round(ex_vol_df$volatility, 6), 6.975571)
expect_equal(round(ex_vol_df$volatility, 6), 6.975349)
})

test_that("volatility estimate is correct for example compound with pathway for entire workflow", {
ex_vol_df <- calc_vol(compound_id = "C16181", pathway_id = "map00361",
path = "data", redownload = FALSE)
expect_equal(round(ex_vol_df$volatility, 6), 6.975571)
expect_equal(round(ex_vol_df$volatility, 6), 6.975349)
})

test_that("volatility estimate is correct for example compound from functional groups dataframe", {
Expand All @@ -15,7 +15,7 @@ test_that("volatility estimate is correct for example compound from functional g
ex_vol_df <- calc_vol(compound_id = "C16181", pathway_id = "map00361",
path = "data", redownload = FALSE,
get_groups = FALSE, fx_groups_df = ex_fx_df)
expect_equal(round(ex_vol_df$volatility, 6), 6.975571)
expect_equal(round(ex_vol_df$volatility, 6), 6.975349)
})

test_that("returns error if no functional groups dataframe and no saving file and getting functional groups dataframe", {
Expand Down

0 comments on commit e3c5ccc

Please sign in to comment.