Skip to content

Commit a00a58a

Browse files
committed
add download_rfam_cm
1 parent fb3dd0d commit a00a58a

File tree

4 files changed

+55
-1
lines changed

4 files changed

+55
-1
lines changed

NAMESPACE

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ export(cm_5_8S)
44
export(cmalign)
55
export(cmbuild)
66
export(cmsearch)
7+
export(download_rfam_cm)
78
export(read_stockholm_msa)
89
export(sample_rRNA_5_8S)
910
export(sample_rRNA_fasta)

NEWS.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
* If `read_stockholm_msa()` is given an open connection, it does not close it
1515
when done. (But if given a filename or an unopened connection, it opens and
1616
then closes.)
17-
* `cmsearch()` correctly handles fields with spaces (e.g., description)
17+
* `cmsearch()` correctly handles fields with spaces (e.g., description)
18+
* Add `download_rfam_cm()` to easily download RFAM covariance models.
1819

1920
# Changes in version 0.99.4
2021

R/download_rfam_cm.R

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#' Download a covariance model from RFAM
2+
#'
3+
#' @param cm (\code{character} string) the name of the CM to download. Typically
4+
#' this is in the format \code{"RFxxxxx"} where the \code{"x"}'s represent
5+
#' decimal digits.
6+
#' @param filename (\code{character} string) file to save the CM in. The
7+
#' default is to save the CM in the current working directory in a file
8+
#' named \code{"RFxxxxx.cm"}.
9+
#' @param ... additional arguments passed on to
10+
#' \code{\link[utils]{download.file}}.
11+
#'
12+
#' @return The name of the downloaded file, invisibly.
13+
#' @export
14+
#'
15+
download_rfam_cm <- function(cm, filename = paste0(cm, ".cm"), ...) {
16+
assertthat::assert_that(
17+
assertthat::is.string(cm),
18+
assertthat::is.string(filename)
19+
)
20+
utils::download.file(
21+
paste0("https://rfam.xfam.org/family/", cm, "/cm"),
22+
destfile = filename,
23+
...
24+
)
25+
invisible(filename)
26+
}

man/download_rfam_cm.Rd

+26
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)