Skip to content

Commit

Permalink
Merge branch 'master' into HEAD
Browse files Browse the repository at this point in the history
* master: (171 commits)
  updating version number for vignette changes
  adding required library
  fixing method definitions
  revised workflow for annotating a MRexperiment
  using demoMgDb instead of greengenes13.5MgDb
  adding usage and value documentation
  remove cyclic dependency with greengenes13.5MgDb, added demoMgDb
  using travis script to install bioconductor packages
  adding environment
  adding appveyor for checking windows build
  adding examples for data documentation files
  adding shortread to import for mgQuery data
  adding ShortRead dependency for mgQuery
  removing import due to import conflicts with combine and %>%
  removing import due to import conflicts with combine and %>%
  excluding regression tests for travis-ci build
  removing greengenes13.5MgDb depdencency for submission
  removing greengenes13.5MgDb depdencency for submission
  uncommented regression tests
  revisions based on BiocCheck run
  ...

Conflicts:
	.Rbuildignore
	.gitignore
	DESCRIPTION
	R/demoMgDb.R
	R/metagenomeAnnotation-class.R
	R/mgDb-class.R
	README.md
	man/annotate-MgDb-method.Rd
	man/get_demoMgDb.Rd
	man/select-MgDb-method.Rd
	vignettes/Example_16S_Annotation_Workflow.Rmd
	vignettes/Exploring_a_MgDb.Rmd

From: nate-d-olson <nolson@nist.gov>

git-svn-id: file:///home/git/hedgehog.fhcrc.org/bioconductor/trunk/madman/Rpacks/metagenomeFeatures@109500 bc3139a8-67e5-0310-9ffc-ced21a209358
  • Loading branch information
Nathan D. Olson committed Oct 11, 2015
1 parent 50c87f3 commit f6767a0
Show file tree
Hide file tree
Showing 19 changed files with 14,866 additions and 160 deletions.
3 changes: 3 additions & 0 deletions .Rbuildignore
Expand Up @@ -2,3 +2,6 @@
^\.Rproj\.user$
^packrat/
^\.Rprofile$
^data-raw$
^\.travis\.yml$
^appveyor\.yml$
2 changes: 2 additions & 0 deletions .gitignore
Expand Up @@ -2,3 +2,5 @@
.Rhistory
.RData
packrat/lib*/
inst/doc
scratch.R
41 changes: 41 additions & 0 deletions .travis.yml
@@ -0,0 +1,41 @@
# Sample .travis.yml for R projects
language: c

sudo: required
before_install:
- curl -OL http://raw.github.com/lcolladotor/r-travis/master/scripts/travis-tool.sh
- chmod 755 ./travis-tool.sh
- ./travis-tool.sh bootstrap

install:
- ./travis-tool.sh install_bioc ShortRead
- ./travis-tool.sh install_r testthat
- ./travis-tool.sh install_r knitr
- ./travis-tool.sh install_r rmarkdown
- ./travis-tool.sh install_r dplyr
- ./travis-tool.sh install_r stringr
- ./travis-tool.sh install_r lazyeval
- ./travis-tool.sh install_r RSQLite
- ./travis-tool.sh install_r magrittr
- ./travis-tool.sh install_r covr
- ./travis-tool.sh install_bioc_deps

script: ./travis-tool.sh run_tests

on_failure:
- ./travis-tool.sh dump_logs

after_script:
- ./travis-tool.sh dump_logs_by_extension "timings"
- ./travis-tool.sh dump_sysinfo

after_success:
- Rscript -e 'covr::codecov()'

env:
global:
- R_BUILD_ARGS="--no-build-vignettes --no-manual --no-resave-data"
- R_CHECK_ARGS=" --no-build-vignettes --no-manual --timings"
- R_CHECK_TIME="TRUE"
- R_CHECK_TESTS="TRUE"
- _R_CHECK_FORCE_SUGGESTS_="FALSE"
4 changes: 2 additions & 2 deletions DESCRIPTION
@@ -1,6 +1,6 @@
Package: metagenomeFeatures
Title: Exploration of marker-gene sequence taxonomic annotations
Version: 0.99.3
Version: 0.99.4
Author: Nathan D. Olson, Joseph Nathaniel Paulson, Hector Corrada Bravo
Maintainer: Nathan D. Olson <nolson@umiacs.umd.edu>
Description: metagenomeFeatures was developed for use in exploring the
Expand All @@ -23,4 +23,4 @@ URL: https://github.com/HCBravoLab/metagenomeFeatures
BugReports: https://github.com/HCBravoLab/metagenomeFeatures/issues
biocViews: Microbiome, Metagenomics, Annotation, Infrastructure,
Sequencing, Software
NeedsCompilation: no
NeedsCompilation: no
2 changes: 1 addition & 1 deletion R/demoMgDb.R
@@ -1,7 +1,7 @@
#' Example MgDb-class object
#'
#' Example \link[=MgDb]{MgDb-class} object with 249 entries from the Greengenes 13.5 database.
#' @return MgDb-class
#' @return MgDb-class object
#' @export
#' @examples
#' get_demoMgDb()
Expand Down
3 changes: 3 additions & 0 deletions R/metagenomeAnnotation-class.R
Expand Up @@ -100,4 +100,7 @@ setMethod("split_by", "metagenomeAnnotation",
}
)
# mgTree - generates a tree from annotated dataframe
<<<<<<< HEAD

=======
>>>>>>> master
115 changes: 1 addition & 114 deletions R/mgDb-class.R
Expand Up @@ -43,7 +43,6 @@ MgDb <- setRefClass("MgDb",
metadata <<- metadata
}))

<<<<<<< HEAD
## MgDb Validity ---------------------------------------------------------------
setValidity("MgDb", function(object) {
msg <- NULL
Expand All @@ -56,26 +55,10 @@ setValidity("MgDb", function(object) {
"'taxa' slot must contain a tbl_sqlite object",
sep = "\n")
if(!("metadata" %in% ls(object)) || !is(object$metadata, "list"))
=======
### Metadata - Need to change namespace to not export - Not exported.
# DB_TYPE_NAME <- "Db type"
# DB_TYPE_VALUE <- "MgDb" # same as the name of the class
# DB_SCHEMA_VERSION <- "1.0"

## MgDb Validity ---------------------------------------------------------------
setValidity("MgDb", function(object) {
msg <- NULL
if(!("seq" %in% ls(object)) || !is(object@seq, "ShortRead"))
msg <- paste(msg, "'seq' slot must contain a ShortRead object with sequence data", sep = "\n")
if(!("taxa" %in% ls(object)) || !is(object@taxa, "tbl_sqlite"))
msg <- paste(msg, "'taxa' slot must contain a tbl_sqlite object with taxonomy data", sep = "\n")
if(!("metadata" %in% ls(object)) || !is(object@metadata, "list"))
>>>>>>> initial commit
msg <- paste(msg, "'metadata' slot must contain a list", sep = "\n")
if (is.null(msg)) TRUE else msg
})

<<<<<<< HEAD
################################################################################
################################################################################
##
Expand Down Expand Up @@ -105,26 +88,10 @@ setMethod("show", "MgDb",
print("Sequence Data:")
print(object$seq)
print("Taxonomy Data:")
=======
## MgDb Methods ----------------------------------------------------------------
## General Methods
setMethod("show", "MgDb",
function(object){
cat(class(object), "object:\n")
print("Metadata\n")
metadata <-object$metadata
for(i in names(metadata)){
cat("|", i, ": ", metadata[[i]], "\n", sep = "")
}
print("Sequence Data:\n")
print(object$seq)
print("Taxonomy Data:\n")
>>>>>>> initial commit
print(object$taxa)
}
)

<<<<<<< HEAD
### ============================================================================
##
## MgDb select method
Expand All @@ -143,40 +110,6 @@ setMethod("show", "MgDb",
if(keytype != "Keys"){
level_id <- rep(tolower(stringr::str_sub(string = keytype,
start = 1,end = 1)), length(keys))
=======
##
##
## Methods to generate metagenomeAnnotation object %%TODO%% modify features to
## include additional information about metagenomeAnnotation class, specifically
## filter command and other approriate metadata, e.g. method used for mapping
MgDb$methods(annotate = function(object, ...){
filtered_db <- select(object, type = "both", ...)
MgDb$new(taxa = filtered_db[[1]],
seq = filtered_db[[2]],
features = object$metadata)
}
)

## select methods --------------------------------------------------------------
## use ShortRead Object filters
.select.seq <- function(x, ...){
return
}

#' Function for querying the marker gene taxonomy database.
#' @param ids sequence ids to select
#' @param columns quoted vector of table columns returned, all returned by default
#' @param sqlite database connection, see src_sqlite in dplyr
#' @param dbtable database table name, defaults to tree.
#' @return generates database, function does not return anything
.select.taxa<- function(keys, keytype,
columns="all"){

# selecting desired rows
if(keytype != "Keys"){
level_id <- tolower(stringr::str_sub(string = keytype,
start = 1,end = 1))
>>>>>>> initial commit
keys <- stringr::str_c(level_id,keys,sep = "__")
}
if(length(keys) == 1){
Expand All @@ -197,7 +130,6 @@ MgDb$methods(annotate = function(object, ...){
return(select_tbl %>% dplyr::collect())
}

<<<<<<< HEAD
## either select by ids for taxa information
.select <- function(mgdb, type, keys, keytype, columns){
if(!(type %in% c("seq","taxa", "both"))){
Expand Down Expand Up @@ -360,7 +292,7 @@ setMethod("select", "MgDb",
#' "user provided", use for documenting methods used to perfom the taxonomic
#' assignment.
#' @param ... additional arguments passed to select function
#' @return metagenomeAnnotation class object
#' @return metagenomeAnnotation-class object
#' @note Must include either db_keys or query_df as argument.
#' @rdname annotate-MgDb-method
setGeneric("annotate", signature = "mgdb",
Expand All @@ -378,49 +310,4 @@ setMethod("annotate", "MgDb",
query_seq = NULL, mapping = "user provided ids"){
.mgDb_annotate(mgdb, db_keys,
query_df, query_seq, mapping)}
=======
#' select function returns a filtered set of sequences or taxa based on defined
# input ' use type = "seq" returns a ShortRead object and type = "taxa" returns a
# filtered database not sure if we want to make the select method only generate a
MgDb$methods(select = function(object, type, ...){
if(!(type %in% c("seq","taxa", "both"))){
stop("type must be either 'seq' or 'taxa'")
}
if(type == "seq" || type == "both"){
seq_obj <- .select.seq(object$seq, ...)
if(type != "both"){
return(seq_obj)
}
}
if(type == "taxa"|| type == "both"){
taxa_df <- .select.taxa(object$taxa, ...)
if(type != "both"){
return(taxa_obj)
}
}else{
taxa_df <- object$taxa
}
return(list(taxa_df, seq_df))
}
)

## MgDb Taxa function ----------------------------------------------------------

# Select function revisions
MgDb$methods(taxa_keys = function(object, keytype){
dplyr::select_(object$taxa, keytype) %>% dplyr::collect()
}
)

#' List of database columns.
MgDb$methods(taxa_columns = function(object){
colnames(object$taxa)
}
)

#' Field to potentially use to query database.
MgDb$methods(taxa_keytypes = function(object){
colnames(object$taxa)
}
>>>>>>> initial commit
)
46 changes: 46 additions & 0 deletions appveyor.yml
@@ -0,0 +1,46 @@
# DO NOT CHANGE the "init" and "install" sections below

# Download script file from GitHub
init:
ps: |
$ErrorActionPreference = "Stop"
Invoke-WebRequest http://raw.github.com/krlmlr/r-appveyor/master/scripts/appveyor-tool.ps1 -OutFile "..\appveyor-tool.ps1"
Import-Module '..\appveyor-tool.ps1'
install:
ps: Bootstrap

# Adapt as necessary starting from here

build_script:
- travis-tool.sh install_bioc msd16s Biostrings ShortRead
- travis-tool.sh install_deps

test_script:
- travis-tool.sh run_tests

on_failure:
- travis-tool.sh dump_logs

environment:
WARNINGS_ARE_ERRORS: 1
_R_CHECK_FORCE_SUGGESTS_: 0

artifacts:
- path: '*.Rcheck\**\*.log'
name: Logs

- path: '*.Rcheck\**\*.out'
name: Logs

- path: '*.Rcheck\**\*.fail'
name: Logs

- path: '*.Rcheck\**\*.Rout'
name: Logs

- path: '\*_*.tar.gz'
name: Bits

- path: '\*_*.zip'
name: Bits
Binary file added inst/extdata/msd16s_MgDb_seq.fasta.gz
Binary file not shown.
Binary file added inst/extdata/msd16s_MgDb_taxa.sqlite
Binary file not shown.

0 comments on commit f6767a0

Please sign in to comment.