-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
119 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
Date: 2024-03-02 | ||
Date: 2024-03-03 | ||
Package: canprot | ||
Version: 1.1.2-28 | ||
Version: 1.1.2-29 | ||
Title: Chemical Analysis of Proteins | ||
Authors@R: c( | ||
person("Jeffrey", "Dick", email = "[email protected]", role = c("aut", "cre"), | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# canprot/human.aa.R | ||
# Get amino acid compositions for human proteins from UniProt IDs | ||
# 20160705 jmd | ||
|
||
human.aa <- function(uniprot = NULL, aa_file = NULL, stop.if.missing = FALSE, warn.if.duplicated = FALSE) { | ||
# Get amino acid compositions of human proteins | ||
aa <- get("human_aa", canprot) | ||
# Add amino acid compositions from external file if specified | ||
if(!is.null(aa_file)) { | ||
aa_dat <- read.csv(aa_file, as.is=TRUE) | ||
print(paste("human.aa: adding", nrow(aa_dat), "proteins from", aa_file)) | ||
aa <- rbind(aa_dat, aa) | ||
} | ||
if(is.null(uniprot)) { | ||
stop("'uniprot' is NULL") | ||
} else { | ||
# Find the proteins listed in 'uniprot' - first look at the ID after the | separator | ||
alluni <- sapply(strsplit(aa$protein, "|", fixed = TRUE), "[", 2) | ||
# If that is NA (i.e. no | separator is present) use the entire string | ||
ina <- is.na(alluni) | ||
alluni[ina] <- aa$protein[ina] | ||
iuni <- match(uniprot, alluni) | ||
if(stop.if.missing) { | ||
# Stop with error if any IDs are not found | ||
if(any(is.na(iuni))) stop(paste("uniprot IDs not found:", paste(uniprot[is.na(iuni)], collapse = " "))) | ||
} | ||
if(warn.if.duplicated) { | ||
# Warn if any IDs are duplicated | ||
if(any(duplicated(iuni))) warning(paste("some uniprot IDs are duplicated:", | ||
paste(uniprot[duplicated(iuni)], collapse=" ")), immediate. = TRUE) | ||
} | ||
aa <- aa[iuni, ] | ||
} | ||
# Return amino acid compositions | ||
aa | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
\encoding{UTF-8} | ||
\name{human.aa} | ||
\alias{human.aa} | ||
\title{Get Amino Acid Compositions of Human Proteins} | ||
\description{ | ||
Get amino acid compositions of human proteins from their UniProt IDs. | ||
} | ||
|
||
\usage{ | ||
human.aa(uniprot = NULL, aa_file = NULL, | ||
stop.if.missing = FALSE, warn.if.duplicated = FALSE) | ||
} | ||
|
||
\arguments{ | ||
\item{uniprot}{character, UniProt IDs of proteins} | ||
\item{aa_file}{character, file name} | ||
\item{stop.if.missing}{logical, stop with an error if there are UniProt IDs that can't be found?} | ||
\item{warn.if.duplicated}{logical, emit a warning if duplicate UniProt IDs are detected?} | ||
} | ||
\details{ | ||
This function retrieves the amino acid compositions of one or more proteins specified by \code{uniprot}. | ||
This function depends on the amino acid compositions of human proteins, which are stored in the \code{\link{canprot}} environment when the package is attached. | ||
If \code{aa_file} is specified, additional amino acid compositions are read from this file. | ||
This file should be in the same format as \code{\link{human_extra}.csv} in the installation directory of the package. | ||
} | ||
\value{ | ||
The function returns a data frame with amino acid compositions of proteins. | ||
} | ||
\examples{ | ||
human.aa("P24298") | ||
} | ||
\concept{Amino acid composition} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters