[CHNOSZ-commits] r829 - in pkg/CHNOSZ: . .github/workflows R inst man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Feb 28 04:06:28 CET 2024


Author: jedick
Date: 2024-02-28 04:06:28 +0100 (Wed, 28 Feb 2024)
New Revision: 829

Modified:
   pkg/CHNOSZ/.github/workflows/R-CMD-check.yaml
   pkg/CHNOSZ/DESCRIPTION
   pkg/CHNOSZ/NAMESPACE
   pkg/CHNOSZ/R/add.protein.R
   pkg/CHNOSZ/inst/NEWS.Rd
   pkg/CHNOSZ/man/add.protein.Rd
Log:
Move aasum() to canprot and adjust GH actions


Modified: pkg/CHNOSZ/.github/workflows/R-CMD-check.yaml
===================================================================
--- pkg/CHNOSZ/.github/workflows/R-CMD-check.yaml	2024-02-28 01:24:53 UTC (rev 828)
+++ pkg/CHNOSZ/.github/workflows/R-CMD-check.yaml	2024-02-28 03:06:28 UTC (rev 829)
@@ -28,4 +28,15 @@
           extra-packages: any::rcmdcheck
           needs: check
 
+      # Install remotes and development version of canprot 20240228
+      # https://stackoverflow.com/questions/76642914/use-a-github-package-for-a-r-github-action
+      
+      - name: Install remotes
+        run: |
+          Rscript -e "install.packages('remotes', repos='https://ftp.belnet.be/mirror/CRAN')"
+
+      - name: Install development version of canprot
+        run: |
+          Rscript -e "remotes::install_github('jedick/canprot')"
+
       - uses: r-lib/actions/check-r-package at v2

Modified: pkg/CHNOSZ/DESCRIPTION
===================================================================
--- pkg/CHNOSZ/DESCRIPTION	2024-02-28 01:24:53 UTC (rev 828)
+++ pkg/CHNOSZ/DESCRIPTION	2024-02-28 03:06:28 UTC (rev 829)
@@ -1,6 +1,6 @@
 Date: 2024-02-28
 Package: CHNOSZ
-Version: 2.1.0-1
+Version: 2.1.0-2
 Title: Thermodynamic Calculations and Diagrams for Geochemistry
 Authors at R: c(
     person("Jeffrey", "Dick", , "j3ffdick at gmail.com", role = c("aut", "cre"),

Modified: pkg/CHNOSZ/NAMESPACE
===================================================================
--- pkg/CHNOSZ/NAMESPACE	2024-02-28 01:24:53 UTC (rev 828)
+++ pkg/CHNOSZ/NAMESPACE	2024-02-28 03:06:28 UTC (rev 829)
@@ -24,7 +24,7 @@
   "getrank", "parent", "sciname", "allparents", "getnodes", "getnames",
   "protein.OBIGT", "which.pmax",
   "equil.boltzmann", "equil.reaction", "find.tp",
-  "ionize.aa", "MP90.cp", "aasum",
+  "ionize.aa", "MP90.cp",
   "ratlab",
   "EOSregress", "EOScoeffs", "EOSplot", "EOSvar",
 # demos

Modified: pkg/CHNOSZ/R/add.protein.R
===================================================================
--- pkg/CHNOSZ/R/add.protein.R	2024-02-28 01:24:53 UTC (rev 828)
+++ pkg/CHNOSZ/R/add.protein.R	2024-02-28 03:06:28 UTC (rev 829)
@@ -36,34 +36,3 @@
   return(ip)
 }
 
-# Combine amino acid counts (sum, average, or weighted sum by abundance)
-aasum <- function(aa, abundance = 1, average = FALSE, protein = NULL, organism = NULL) {
-  # Returns the sum of the amino acid counts in aa,
-  #   multiplied by the abundances of the proteins
-  abundance <- rep(abundance, length.out = nrow(aa))
-  # Drop any NA rows or abundances
-  ina.aa <- is.na(aa$chains)
-  ina.ab <- is.na(abundance)
-  ina <- ina.aa | ina.ab
-  if(any(ina)) {
-    aa <- aa[!ina, ]
-    abundance <- abundance[!ina]
-    message("aasum: dropped ", sum(ina), " proteins with NA composition and/or abundance")
-  }
-  # Multiply
-  aa[, 6:25] <- aa[, 6:25] * abundance
-  # Sum
-  out <- aa[1, ]
-  out[, 5:25] <- colSums(aa[, 5:25])
-  # Average if told to do so
-  if(average) {
-    # Polypeptide chains by number of proteins, residues by frequency
-    out[, 5] <- out[, 5]/nrow(aa)
-    out[, 6:25] <- out[, 6:25]/sum(abundance)
-  }
-  # Add protein and organism names if given
-  if(!is.null(protein)) out$protein <- protein
-  if(!is.null(organism)) out$organism <- organism
-  return(out)
-}
-

Modified: pkg/CHNOSZ/inst/NEWS.Rd
===================================================================
--- pkg/CHNOSZ/inst/NEWS.Rd	2024-02-28 01:24:53 UTC (rev 828)
+++ pkg/CHNOSZ/inst/NEWS.Rd	2024-02-28 03:06:28 UTC (rev 829)
@@ -15,10 +15,10 @@
 \newcommand{\Cp}{\ifelse{latex}{\eqn{C_P}}{\ifelse{html}{\out{<I>C<sub>P</sub></I>}}{Cp}}}
 \newcommand{\DG0}{\ifelse{latex}{\eqn{{\Delta}G^{\circ}}}{\ifelse{html}{\out{Δ<I>G</I>°}}{ΔG°}}}
 
-\section{Changes in CHNOSZ version 2.1.0-1 (2024-02-28)}{
+\section{Changes in CHNOSZ version 2.1.0-2 (2024-02-28)}{
 
     \itemize{
-      \item Move \code{read.fasta()} and \code{count.aa()} to canprot package.
+      \item Move \code{read.fasta()}, \code{count.aa()}, and \code{aasum()} to canprot package.
       \item Remove \code{seq2aa()}.
     }
 

Modified: pkg/CHNOSZ/man/add.protein.Rd
===================================================================
--- pkg/CHNOSZ/man/add.protein.Rd	2024-02-28 01:24:53 UTC (rev 828)
+++ pkg/CHNOSZ/man/add.protein.Rd	2024-02-28 03:06:28 UTC (rev 829)
@@ -1,7 +1,6 @@
 \encoding{UTF-8}
 \name{add.protein}
 \alias{add.protein}
-\alias{aasum}
 \title{Amino Acid Compositions of Proteins}
 \description{
   Functions to get amino acid compositions and add them to protein list for use by other functions.
@@ -9,16 +8,11 @@
 
 \usage{
   add.protein(aa, as.residue = FALSE)
-  aasum(aa, abundance = 1, average = FALSE, protein = NULL, organism = NULL)
 }
 
 \arguments{
   \item{aa}{data frame, amino acid composition in the format of \code{thermo()$protein}}
   \item{as.residue}{logical, normalize by protein length?}
-  \item{protein}{character, name of protein; numeric, indices of proteins (rownumbers of \code{\link{thermo}()$protein})}
-  \item{abundance}{numeric, abundances of proteins}
-  \item{average}{logical, return the weighted average of amino acid counts?}
-  \item{organism}{character, name of organism}
 }
 
 \details{
@@ -31,16 +25,10 @@
 Given a data frame of amino acid compositions in the format of \code{thermo()$protein}, \code{add.protein} adds them to \code{thermo()$protein} for use by other functions in CHNOSZ.
 The amino acid compositions of proteins in \code{aa} with the same name as one in \code{thermo()$protein} are replaced.
 Set \code{as.residue} to TRUE to normalize by protein length; each input amino acid composition is divided by the corresponding number of residues, with the result that the sum of amino acid frequencies for each protein is 1.
-
-\code{aasum} returns a data frame representing the sum of amino acid compositions in the rows of the input \code{aa} data frame.
-The amino acid compositions are multiplied by the indicated \code{abundance}; that argument is recycled to match the number of rows of \code{aa}.
-If \code{average} is TRUE the final sum is divided by the number of input compositions.
-The name used in the output is taken from the first row of \code{aa} or from \code{protein} and \code{organism} if they are specified.
 }
 
 \value{
 For \code{add.protein}, the rownumbers of \code{thermo()$protein} that are added and/or replaced.
-For \code{aasum}, a one-row data frame of amino acid composition and identifying information.
 }
 
 \examples{
@@ -54,9 +42,6 @@
 # Calculate length and elemental formula
 protein.length(iprotein)
 protein.formula(iprotein)
-
-# Sum the amino acid compositions and assign a new protein name
-aasum(aa, protein = "POLG_sum")
 }
 
 \seealso{



More information about the CHNOSZ-commits mailing list