Commit f83e9d97 authored by Andreas Tille's avatar Andreas Tille

Update upstream source from tag 'upstream/1.28.0+dfsg'

Update to upstream version '1.28.0+dfsg'
with Debian dir a9d2c4a3a022214d41b8a2d027e8c67618c1ace2
parents ecc4c9d7 30996592
Package: phyloseq
Version: 1.26.1
Date: 2018-07-15
Version: 1.28.0
Date: 2019-04-23
Title: Handling and analysis of high-throughput microbiome census data
Description: phyloseq provides a set of classes and tools
to facilitate the import, storage, analysis, and
......@@ -18,8 +18,8 @@ Imports: ade4 (>= 1.7.4), ape (>= 5.0), Biobase (>= 2.36.2),
1.4.1), scales (>= 0.4.0), vegan (>= 2.5)
Depends: R (>= 3.3.0)
Suggests: BiocStyle (>= 2.4), DESeq2 (>= 1.16.1), genefilter (>= 1.58),
knitr (>= 1.16), metagenomeSeq (>= 1.14), rmarkdown (>= 1.6),
testthat (>= 1.0.2)
knitr (>= 1.16), magrittr (>= 1.5), metagenomeSeq (>= 1.14),
rmarkdown (>= 1.6), testthat (>= 1.0.2)
VignetteBuilder: knitr
Enhances: doParallel (>= 1.0.10)
biocViews: ImmunoOncology, Sequencing, Microbiome, Metagenomics,
......@@ -37,11 +37,11 @@ Collate: 'allClasses.R' 'allPackage.R' 'allData.R' 'as-methods.R'
'network-methods.R' 'distance-methods.R'
'deprecated_functions.R' 'extend_DESeq2.R' 'phylo-class.R'
'extend_metagenomeSeq.R'
RoxygenNote: 6.0.1
RoxygenNote: 6.1.1
git_url: https://git.bioconductor.org/packages/phyloseq
git_branch: RELEASE_3_8
git_last_commit: a084072
git_last_commit_date: 2019-01-04
Date/Publication: 2019-01-04
git_branch: RELEASE_3_9
git_last_commit: a86ed1e
git_last_commit_date: 2019-05-02
Date/Publication: 2019-05-02
NeedsCompilation: no
Packaged: 2019-01-05 00:36:54 UTC; biocbuild
Packaged: 2019-05-03 00:24:42 UTC; biocbuild
......@@ -63,7 +63,7 @@
#' # Filter samples that don't have Enterotype
#' x <- subset_samples(enterotype, !is.na(Enterotype))
#' # (the taxa are at the genera level in this dataset)
#' res = mt(x, "Enterotype", method=c("fdr", "bonferroni"), test="f", B=300)
#' res = mt(x, "Enterotype", method="fdr", test="f", B=300)
#' head(res, 10)
#' ## # Not surprisingly, Prevotella and Bacteroides top the list.
#' ## # Different test, multiple-adjusted t-test, whether samples are ent-2 or not.
......
......@@ -159,8 +159,8 @@ rarefy_even_depth <- function(physeq, sample.size=min(sample_sums(physeq)),
message(length(rmsamples), " samples removed",
"because they contained fewer reads than `sample.size`.")
message("Up to first five removed samples are: \n")
message(rmsamples[1:min(5, length(rmsamples))], sep="\t")
message("...")
message(paste(rmsamples[1:min(5, length(rmsamples))], sep="\t"))
message("...")
}
# Now done with notifying user of pruning, actually prune.
physeq = prune_samples(setdiff(sample_names(physeq), rmsamples), physeq)
......
......@@ -4,6 +4,20 @@
[![Travis-CI Build Status](https://travis-ci.org/joey711/phyloseq.svg?branch=master)](https://travis-ci.org/joey711/phyloseq)
## Quick Install
In R terminal:
```
if(!requireNamespace("BiocManager")){
install.packages("BiocManager")
}
BiocManager::install("phyloseq")
```
See [the phyloseq installation page](http://joey711.github.io/phyloseq/install.html)
for further details, examples.
## Article on Improved Microbiome Analysis
McMurdie and Holmes (2014)
......
No preview for this file type
......@@ -544,19 +544,48 @@ A Google search for "phyloseq differential abundance"
will also likely turn up a number of useful, related resources.
# - I need help analyzing my data. It has the following study design...
I am currently a biostatistician at Second Genome, Inc.,
which offers complete
[end-to-end microbiome experiment solutions](http://www.secondgenome.com/solutions)
## Please be more specific
The biggest problem is often scope.
Your correspondence to open-source package authors
should be very specific features, bugs, or contributions;
where the answer will benefit other users who can later
find the post in a search or benefit from the new feature/bugfix.
## Please respect my time (and other package authors)
Package authors have finite time available to help.
There is an unavoidable trade-off of time
between package features/maintenance
and answering user correspondence.
My full-time efforts are in understanding the role of the microbiome
in human health and disease
as Senior Staff Data Scientist at a biotech startup in San Francisco
(a full-time job).
Meanwhile, there are thousands of monthly-downloads of phyloseq.
**It is a mathematical fact that I do not have time to help you analyze your specific dataset.**
What you post on the issue tracker might be answered by others,
but if it is sufficiently of the "help me analyze my data for me" variety of questions,
I will eventually close the issue.
## Pay for Help (not me)
I believe there are now competing options to help you with your analysis
as a fee-for-service.
I was previously a biostatistician and developer at one such company,
Second Genome, Inc.
which offered complete
end-to-end microbiome experiment solutions
as a fee-for-service.
In some cases Second Genome clients already have their microbiome data
and want to make use of our team of trained microbiome analysts
to get the most information from their expeirment.
and want to make use of their team of trained microbiome analysts
to get the most information from their experiment.
I recommend contacting one of the sales associates at the link above.
My day-to-day efforts are in understanding the role of the microbiome
in human health and disease.
If you're looking for a collaboration on your microbiome
data collection or data analysis,
please contact [Second Genome Solutions](http://www.secondgenome.com/solutions).
please contact [Second Genome's capable team](https://www.secondgenome.com/platform/microbiome-technologies/16s-sequencing-community-analysis).
......@@ -8,8 +8,8 @@
\usage{
UniFrac(physeq, weighted=FALSE, normalized=TRUE, parallel=FALSE, fast=TRUE)
\S4method{UniFrac}{phyloseq}(physeq, weighted = FALSE, normalized = TRUE,
parallel = FALSE, fast = TRUE)
\S4method{UniFrac}{phyloseq}(physeq, weighted = FALSE,
normalized = TRUE, parallel = FALSE, fast = TRUE)
}
\arguments{
\item{physeq}{(Required). \code{\link{phyloseq-class}}, containing at minimum
......
......@@ -9,8 +9,8 @@
\usage{
capscale.phyloseq(physeq, formula, distance, ...)
\S4method{capscale.phyloseq}{phyloseq,formula,dist}(physeq, formula, distance,
...)
\S4method{capscale.phyloseq}{phyloseq,formula,dist}(physeq, formula,
distance, ...)
\S4method{capscale.phyloseq}{phyloseq,formula,character}(physeq, formula,
distance, ...)
......
......@@ -12,10 +12,11 @@ distance(physeq, method, type = "samples", ...)
\S4method{distance}{phyloseq,ANY}(physeq, method)
\S4method{distance}{otu_table,character}(physeq, method, type = "samples",
...)
\S4method{distance}{otu_table,character}(physeq, method,
type = "samples", ...)
\S4method{distance}{phyloseq,character}(physeq, method, type = "samples", ...)
\S4method{distance}{phyloseq,character}(physeq, method, type = "samples",
...)
}
\arguments{
\item{physeq}{(Required). A \code{\link{phyloseq-class}} or
......
......@@ -4,8 +4,9 @@
\alias{gapstat_ord}
\title{Estimate the gap statistic on an ordination result}
\usage{
gapstat_ord(ord, axes = c(1:2), type = "sites", FUNcluster = function(x,
k) { list(cluster = pam(x, k, cluster.only = TRUE)) }, K.max = 8, ...)
gapstat_ord(ord, axes = c(1:2), type = "sites",
FUNcluster = function(x, k) { list(cluster = pam(x, k, cluster.only
= TRUE)) }, K.max = 8, ...)
}
\arguments{
\item{ord}{(Required). An ordination object. The precise class can vary.
......
......@@ -6,7 +6,8 @@
\usage{
import_mothur(mothur_list_file = NULL, mothur_group_file = NULL,
mothur_tree_file = NULL, cutoff = NULL, mothur_shared_file = NULL,
mothur_constaxonomy_file = NULL, parseFunction = parse_taxonomy_default)
mothur_constaxonomy_file = NULL,
parseFunction = parse_taxonomy_default)
}
\arguments{
\item{mothur_list_file}{(Optional). The list file name / location produced by \emph{mothur}.}
......
......@@ -4,10 +4,10 @@
\alias{import_qiime}
\title{Import function to read the now legacy-format QIIME OTU table.}
\usage{
import_qiime(otufilename = NULL, mapfilename = NULL, treefilename = NULL,
refseqfilename = NULL, refseqFunction = readDNAStringSet,
refseqArgs = NULL, parseFunction = parse_taxonomy_qiime, verbose = TRUE,
...)
import_qiime(otufilename = NULL, mapfilename = NULL,
treefilename = NULL, refseqfilename = NULL,
refseqFunction = readDNAStringSet, refseqArgs = NULL,
parseFunction = parse_taxonomy_qiime, verbose = TRUE, ...)
}
\arguments{
\item{otufilename}{(Optional). A character string indicating
......
......@@ -4,8 +4,8 @@
\alias{import_usearch_uc}
\title{Import usearch table format (\code{.uc}) to OTU table}
\usage{
import_usearch_uc(ucfile, colRead = 9, colOTU = 10, readDelimiter = "_",
verbose = TRUE)
import_usearch_uc(ucfile, colRead = 9, colOTU = 10,
readDelimiter = "_", verbose = TRUE)
}
\arguments{
\item{ucfile}{(Required). A file location character string
......
......@@ -4,8 +4,8 @@
\alias{microbio_me_qiime}
\title{Import microbio.me/qiime (QIIME-DB) data package}
\usage{
microbio_me_qiime(zipftp, ext = ".zip", parsef = parse_taxonomy_greengenes,
...)
microbio_me_qiime(zipftp, ext = ".zip",
parsef = parse_taxonomy_greengenes, ...)
}
\arguments{
\item{zipftp}{(Required). A character string that is the full URL
......
......@@ -77,7 +77,7 @@ data(enterotype)
# Filter samples that don't have Enterotype
x <- subset_samples(enterotype, !is.na(Enterotype))
# (the taxa are at the genera level in this dataset)
res = mt(x, "Enterotype", method=c("fdr", "bonferroni"), test="f", B=300)
res = mt(x, "Enterotype", method="fdr", test="f", B=300)
head(res, 10)
## # Not surprisingly, Prevotella and Bacteroides top the list.
## # Different test, multiple-adjusted t-test, whether samples are ent-2 or not.
......
......@@ -4,7 +4,8 @@
\alias{ordinate}
\title{Perform an ordination on phyloseq data}
\usage{
ordinate(physeq, method = "DCA", distance = "bray", formula = NULL, ...)
ordinate(physeq, method = "DCA", distance = "bray", formula = NULL,
...)
}
\arguments{
\item{physeq}{(Required). Phylogenetic sequencing data
......
......@@ -3,9 +3,7 @@
\name{parse_taxonomy_default}
\alias{parse_taxonomy_default}
\alias{parse_taxonomy_greengenes}
\alias{parse_taxonomy_default}
\alias{parse_taxonomy_qiime}
\alias{parse_taxonomy_default}
\title{Parse elements of a taxonomy vector}
\usage{
parse_taxonomy_default(char.vec)
......
......@@ -7,8 +7,8 @@
plot_heatmap(physeq, method = "NMDS", distance = "bray",
sample.label = NULL, taxa.label = NULL, low = "#000033",
high = "#66CCFF", na.value = "black", trans = log_trans(4),
max.label = 250, title = NULL, sample.order = NULL, taxa.order = NULL,
first.sample = NULL, first.taxa = NULL, ...)
max.label = 250, title = NULL, sample.order = NULL,
taxa.order = NULL, first.sample = NULL, first.taxa = NULL, ...)
}
\arguments{
\item{physeq}{(Required). The data, in the form of an instance of the
......
......@@ -6,8 +6,8 @@
\usage{
plot_net(physeq, distance = "bray", type = "samples", maxdist = 0.7,
laymeth = "fruchterman.reingold", color = NULL, shape = NULL,
rescale = FALSE, point_size = 5, point_alpha = 1, point_label = NULL,
hjust = 1.35, title = NULL)
rescale = FALSE, point_size = 5, point_alpha = 1,
point_label = NULL, hjust = 1.35, title = NULL)
}
\arguments{
\item{physeq}{(Required).
......
......@@ -4,11 +4,11 @@
\alias{plot_tree}
\title{Plot a phylogenetic tree with optional annotations}
\usage{
plot_tree(physeq, method = "sampledodge", nodelabf = NULL, color = NULL,
shape = NULL, size = NULL, min.abundance = Inf, label.tips = NULL,
text.size = NULL, sizebase = 5, base.spacing = 0.02,
ladderize = FALSE, plot.margin = 0.2, title = NULL, treetheme = NULL,
justify = "jagged")
plot_tree(physeq, method = "sampledodge", nodelabf = NULL,
color = NULL, shape = NULL, size = NULL, min.abundance = Inf,
label.tips = NULL, text.size = NULL, sizebase = 5,
base.spacing = 0.02, ladderize = FALSE, plot.margin = 0.2,
title = NULL, treetheme = NULL, justify = "jagged")
}
\arguments{
\item{physeq}{(Required). The data about which you want to
......
......@@ -41,7 +41,7 @@ the class of \code{physeq}.
}
\description{
This method merges species that have the same taxonomy at a certain
taxaonomic rank.
taxonomic rank.
Its approach is analogous to \code{\link{tip_glom}}, but uses categorical data
instead of a tree. In principal, other categorical data known for all taxa
could also be used in place of taxonomy,
......
......@@ -4,7 +4,6 @@
\name{transform_sample_counts}
\alias{transform_sample_counts}
\alias{transformSampleCounts}
\alias{transformSampleCounts}
\title{Transform abundance data in an \code{otu_table}, sample-by-sample.}
\usage{
transform_sample_counts(physeq, fun, ...)
......
......@@ -90,36 +90,38 @@ rs_file <- system.file("extdata", "qiime500-refseq.fasta", package="phyloseq")
t0 <- import_qiime(otufile, mapfile, trefile, rs_file, verbose=FALSE)
test_that("Class of import result is phyloseq-class", {
expect_that(t0, is_a("phyloseq"))
expect_is(t0, "phyloseq")
})
test_that("Classes of components are as expected", {
expect_that(otu_table(t0), is_a("otu_table"))
expect_that(tax_table(t0), is_a("taxonomyTable"))
expect_that(sample_data(t0), is_a("sample_data"))
expect_that(phy_tree(t0), is_a("phylo"))
expect_that(refseq(t0), is_a("DNAStringSet"))
expect_is(otu_table(t0), ("otu_table"))
expect_is(tax_table(t0), ("taxonomyTable"))
expect_is(sample_data(t0), ("sample_data"))
expect_is(phy_tree(t0), ("phylo"))
expect_is(refseq(t0), ("DNAStringSet"))
})
test_that("Features of the abundance data are consistent, match known values", {
expect_that(sum(taxa_sums(t0)), equals(1269671L))
expect_that(sum(taxa_sums(t0)==0), equals(5L))
expect_that(sum(taxa_sums(t0)>=100), equals(183L))
expect_that(sum(taxa_sums(t0)), equals(sum(sample_sums(t0))))
expect_that(sum(sample_sums(t0) > 10000L), equals(20L))
expect_that(nsamples(t0), equals(26L))
expect_that(ntaxa(t0), equals(500L))
expect_that(length(rank_names(t0)), equals(7L))
expect_equal(sum(taxa_sums(t0)), (1269671L))
expect_equal(sum(taxa_sums(t0)==0), (5L))
expect_equal(sum(taxa_sums(t0)>=100), (183L))
expect_equal(sum(taxa_sums(t0)), (sum(sample_sums(t0))))
expect_equal(sum(sample_sums(t0) > 10000L), (20L))
expect_equal(nsamples(t0), (26L))
expect_equal(ntaxa(t0), (500L))
expect_equal(length(rank_names(t0)), (7L))
})
test_that("Features of the taxonomy table match expected values", {
expect_that(length(rank_names(t0)), equals(7L))
expect_equal(length(rank_names(t0)), (7L))
expect_equal(rank_names(t0),
c("Kingdom", "Phylum", "Class", "Order", "Family", "Genus", "Species"))
tax53 = as(tax_table(t0), "matrix")[53, ]
expect_that(tax53, is_equivalent_to(c("Bacteria", "Proteobacteria", "Deltaproteobacteria",
"Desulfovibrionales", "Desulfomicrobiaceae",
"Desulfomicrobium", "Desulfomicrobiumorale")))
expect_equivalent(
tax53,
c("Bacteria", "Proteobacteria", "Deltaproteobacteria",
"Desulfovibrionales", "Desulfomicrobiaceae",
"Desulfomicrobium", "Desulfomicrobiumorale"))
})
################################################################################
# parse function tests - note, these are also used by import_biom
......@@ -188,119 +190,119 @@ refseqfilename = system.file("extdata", "biom-refseq.fasta", package="phyloseq"
test_that("Importing biom files yield phyloseq objects", {
library("biomformat")
rdbiom = read_biom(rich_sparse_biom)
rdbiom = read_biom(rich_dense_biom)
rsbiom = read_biom(rich_sparse_biom)
rich_dense = import_biom(rdbiom)
rich_sparse = import_biom(rsbiom)
expect_that(rich_dense, is_a("phyloseq"))
expect_that(rich_sparse, is_a("phyloseq"))
expect_is(rich_dense, ("phyloseq"))
expect_is(rich_sparse, ("phyloseq"))
expect_that(ntaxa(rich_dense), equals(5L))
expect_that(ntaxa(rich_sparse), equals(5L))
expect_equal(ntaxa(rich_dense), (5L))
expect_equal(ntaxa(rich_sparse), (5L))
# # Component classes
# sample_data
expect_that(access(rich_dense, "sam_data"), is_a("sample_data"))
expect_that(access(rich_sparse, "sam_data"), is_a("sample_data"))
expect_is(access(rich_dense, "sam_data"), ("sample_data"))
expect_is(access(rich_sparse, "sam_data"), ("sample_data"))
# taxonomyTable
expect_that(access(rich_dense, "tax_table"), is_a("taxonomyTable"))
expect_that(access(rich_sparse, "tax_table"), is_a("taxonomyTable"))
expect_is(access(rich_dense, "tax_table"), ("taxonomyTable"))
expect_is(access(rich_sparse, "tax_table"), ("taxonomyTable"))
# otu_table
expect_that(access(rich_dense, "otu_table"), is_a("otu_table"))
expect_that(access(rich_sparse, "otu_table"), is_a("otu_table"))
expect_is(access(rich_dense, "otu_table"), ("otu_table"))
expect_is(access(rich_sparse, "otu_table"), ("otu_table"))
})
test_that("The different types of biom files yield phyloseq objects",{
test_that("The different types of biom files yield phyloseq objects", {
rich_dense = import_biom(rich_dense_biom, treefilename, refseqfilename, parseFunction=parse_taxonomy_greengenes)
rich_sparse = import_biom(rich_sparse_biom, treefilename, refseqfilename, parseFunction=parse_taxonomy_greengenes)
min_dense = import_biom(min_dense_biom, treefilename, refseqfilename, parseFunction=parse_taxonomy_greengenes)
min_sparse = import_biom(min_sparse_biom, treefilename, refseqfilename, parseFunction=parse_taxonomy_greengenes)
expect_that(rich_dense, is_a("phyloseq"))
expect_that(rich_sparse, is_a("phyloseq"))
expect_that(min_dense, is_a("phyloseq"))
expect_that(min_sparse, is_a("phyloseq"))
expect_is(rich_dense, ("phyloseq"))
expect_is(rich_sparse, ("phyloseq"))
expect_is(min_dense, ("phyloseq"))
expect_is(min_sparse, ("phyloseq"))
expect_that(ntaxa(rich_dense), equals(5L))
expect_that(ntaxa(rich_sparse), equals(5L))
expect_that(ntaxa(min_dense), equals(5L))
expect_that(ntaxa(min_sparse), equals(5L))
expect_equal(ntaxa(rich_dense), (5L))
expect_equal(ntaxa(rich_sparse), (5L))
expect_equal(ntaxa(min_dense), (5L))
expect_equal(ntaxa(min_sparse), (5L))
# # Component classes
# sample_data
expect_that(access(rich_dense, "sam_data"), is_a("sample_data"))
expect_that(access(rich_sparse, "sam_data"), is_a("sample_data"))
expect_that(access(min_dense, "sam_data"), is_a("NULL"))
expect_that(access(min_sparse, "sam_data"), is_a("NULL"))
expect_is(access(rich_dense, "sam_data"), ("sample_data"))
expect_is(access(rich_sparse, "sam_data"), ("sample_data"))
expect_is(access(min_dense, "sam_data"), ("NULL"))
expect_is(access(min_sparse, "sam_data"), ("NULL"))
# taxonomyTable
expect_that(access(rich_dense, "tax_table"), is_a("taxonomyTable"))
expect_that(access(rich_sparse, "tax_table"), is_a("taxonomyTable"))
expect_that(access(min_dense, "tax_table"), is_a("NULL"))
expect_that(access(min_sparse, "tax_table"), is_a("NULL"))
expect_is(access(rich_dense, "tax_table"), ("taxonomyTable"))
expect_is(access(rich_sparse, "tax_table"), ("taxonomyTable"))
expect_is(access(min_dense, "tax_table"), ("NULL"))
expect_is(access(min_sparse, "tax_table"), ("NULL"))
# phylo tree
expect_that(access(rich_dense, "phy_tree"), is_a("phylo"))
expect_that(access(rich_sparse, "phy_tree"), is_a("phylo"))
expect_that(access(min_dense, "phy_tree"), is_a("phylo"))
expect_that(access(min_sparse, "phy_tree"), is_a("phylo"))
expect_is(access(rich_dense, "phy_tree"), ("phylo"))
expect_is(access(rich_sparse, "phy_tree"), ("phylo"))
expect_is(access(min_dense, "phy_tree"), ("phylo"))
expect_is(access(min_sparse, "phy_tree"), ("phylo"))
# reference sequences
expect_that(inherits(access(rich_dense, "refseq"), "XStringSet"), is_true())
expect_that(inherits(access(rich_sparse, "refseq"), "XStringSet"), is_true())
expect_that(inherits(access(min_dense, "refseq"), "XStringSet"), is_true())
expect_that(inherits(access(min_sparse, "refseq"), "XStringSet"), is_true())
expect_that(access(rich_dense, "refseq"), is_a("DNAStringSet"))
expect_that(access(rich_sparse, "refseq"), is_a("DNAStringSet"))
expect_that(access(min_dense, "refseq"), is_a("DNAStringSet"))
expect_that(access(min_sparse, "refseq"), is_a("DNAStringSet"))
expect_true(inherits(access(rich_dense, "refseq"), "XStringSet"))
expect_true(inherits(access(rich_sparse, "refseq"), "XStringSet"))
expect_true(inherits(access(min_dense, "refseq"), "XStringSet"))
expect_true(inherits(access(min_sparse, "refseq"), "XStringSet"))
expect_is(access(rich_dense, "refseq"), ("DNAStringSet"))
expect_is(access(rich_sparse, "refseq"), ("DNAStringSet"))
expect_is(access(min_dense, "refseq"), ("DNAStringSet"))
expect_is(access(min_sparse, "refseq"), ("DNAStringSet"))
# otu_table
expect_that(access(rich_dense, "otu_table"), is_a("otu_table"))
expect_that(access(rich_sparse, "otu_table"), is_a("otu_table"))
expect_that(access(min_dense, "otu_table"), is_a("otu_table"))
expect_that(access(min_sparse, "otu_table"), is_a("otu_table"))
expect_is(access(rich_dense, "otu_table"), ("otu_table"))
expect_is(access(rich_sparse, "otu_table"), ("otu_table"))
expect_is(access(min_dense, "otu_table"), ("otu_table"))
expect_is(access(min_sparse, "otu_table"), ("otu_table"))
# Compare values in the otu_table. For some reason the otu_tables are not identical
# one position is plus-two, another is minus-two
combrich <- c(access(rich_dense, "otu_table"), access(rich_sparse, "otu_table"))
expect_that(sum(diff(combrich, length(access(rich_dense, "otu_table")))), is_equivalent_to(0))
expect_that(max(diff(combrich, length(access(rich_dense, "otu_table")))), is_equivalent_to(2))
expect_that(min(diff(combrich, length(access(rich_dense, "otu_table")))), is_equivalent_to(-2))
expect_equivalent(sum(diff(combrich, length(access(rich_dense, "otu_table")))), (0))
expect_equivalent(max(diff(combrich, length(access(rich_dense, "otu_table")))), (2))
expect_equivalent(min(diff(combrich, length(access(rich_dense, "otu_table")))), (-2))
combmin <- c(access(min_dense, "otu_table"), access(min_sparse, "otu_table"))
expect_that(sum(diff(combmin, length(access(min_dense, "otu_table")))), is_equivalent_to(0))
expect_that(max(diff(combmin, length(access(min_dense, "otu_table")))), is_equivalent_to(2))
expect_that(min(diff(combmin, length(access(min_dense, "otu_table")))), is_equivalent_to(-2))
expect_equivalent(sum(diff(combmin, length(access(min_dense, "otu_table")))), (0))
expect_equivalent(max(diff(combmin, length(access(min_dense, "otu_table")))), (2))
expect_equivalent(min(diff(combmin, length(access(min_dense, "otu_table")))), (-2))
expect_that(access(min_dense, "otu_table"), is_equivalent_to(access(rich_dense, "otu_table")))
expect_that(access(min_sparse, "otu_table"), is_equivalent_to(access(rich_sparse, "otu_table")))
expect_equivalent(access(min_dense, "otu_table"), (access(rich_dense, "otu_table")))
expect_equivalent(access(min_sparse, "otu_table"), (access(rich_sparse, "otu_table")))
# Compare values in the sample_data
expect_that(access(rich_dense, "sam_data"), is_equivalent_to(access(rich_sparse, "sam_data")))
expect_equivalent(access(rich_dense, "sam_data"), (access(rich_sparse, "sam_data")))
# Compare values in the taxonomyTable
expect_that(access(rich_dense, "tax_table"), is_equivalent_to(access(rich_sparse, "tax_table")))
expect_equivalent(access(rich_dense, "tax_table"), (access(rich_sparse, "tax_table")))
})
test_that("the import_biom and import(\"biom\", ) syntax give same result", {
x1 <- import_biom(rich_dense_biom, parseFunction=parse_taxonomy_greengenes)
x2 <- import("biom", BIOMfilename=rich_dense_biom, parseFunction=parse_taxonomy_greengenes)
expect_that(x1, is_equivalent_to(x2))
expect_equivalent(x1, x2)
})
################################################################################
# read_tree tests
test_that("The read_tree function works as expected:", {
GPNewick <- read_tree(system.file("extdata", "GP_tree_rand_short.newick.gz", package="phyloseq"))
expect_that(GPNewick, is_a("phylo"))
expect_that(ntaxa(GPNewick), equals(length(GPNewick$tip.label)))
expect_that(ntaxa(GPNewick), equals(500))
expect_that(GPNewick$Nnode, equals(499))
expect_that(taxa_names(GPNewick), is_equivalent_to(GPNewick$tip.label))
expect_equal(ntaxa(GPNewick), length(GPNewick$tip.label))
expect_equal(ntaxa(GPNewick), 500L)
expect_equal(GPNewick$Nnode, 499L)
expect_equivalent(taxa_names(GPNewick), GPNewick$tip.label)
# Now read a nexus tree...
# Some error-handling expectations
expect_that(read_tree("alskflsakjsfskfhas.akshfaksj"), gives_warning()) # file not exist
......
......@@ -13,28 +13,30 @@ GP <- GlobalPatterns
mGP <- merge_samples(GlobalPatterns, "SampleType")
test_that("Classes of merged phyloseq objects are as expected", {
expect_that(merge_samples(otu_table(GP), get_variable(GP, "SampleType")), is_a("otu_table"))
expect_that(merge_samples(sample_data(GP), "SampleType"), is_a("sample_data"))
expect_that(mGP, is_a("phyloseq"))
expect_is(merge_samples(otu_table(GP), get_variable(GP, "SampleType")), ("otu_table"))
expect_is(merge_samples(sample_data(GP), "SampleType"), ("sample_data"))
expect_is(mGP, ("phyloseq"))
})
test_that("Same sam_data result for separate and combined merge in merge_samples", {
expect_that(
expect_identical(
merge_samples(sample_data(GP), "SampleType"),
is_identical_to(sample_data(mGP))
(sample_data(mGP))
)
})
test_that("Same otu_table result for separate and combined merge in merge_samples", {
expect_that(
expect_identical(
merge_samples(otu_table(GP), get_variable(GP, "SampleType")),
is_identical_to(otu_table(mGP))
(otu_table(mGP))
)
})
test_that("Sample Names of merged object now same set as merging factor levels", {
sampleTypes = levels(data.frame(sample_data(GP))$SampleType)
expect_that(setdiff(sampleTypes, sample_names(mGP)), is_identical_to(character()))
expect_identical(
setdiff(sampleTypes, sample_names(mGP)),
(character()))
})
test_that("Counts from merged-samples are summed...", {
......@@ -44,7 +46,7 @@ test_that("Counts from merged-samples are summed...", {
# Loop to check the correct summation has occured for all OTUs.
for( i in OTUnames10 ){
isum = as(tapply(get_sample(GP10, i), get_variable(GP10, "SampleType"), sum), "numeric")
expect_that(isum, is_equivalent_to(get_sample(mGP10, i)))
expect_equivalent(isum, (get_sample(mGP10, i)))
}
})
......@@ -61,8 +63,8 @@ test_that("merge_phyloseq: Break apart GP based on human-association,
# The species order is fixed to the tree,
# so should be the same between the original and merged
expect_that(taxa_names(GP), is_identical_to(taxa_names(GP1)))
expect_that(phy_tree(h1), is_identical_to(phy_tree(h0)))
expect_identical(taxa_names(GP), (taxa_names(GP1)))
expect_identical(phy_tree(h1), (phy_tree(h0)))
# However, the sample order has been shuffled by the split/merge.
# Fix the sample order by re-ordering the otu_table, and reassigning
......@@ -94,9 +96,9 @@ test_that("merge_phyloseq: Break apart GP based on human-association,
# Should be fixed now. Full object and components now identical
expect_equal(GP1, GP)
expect_identical(GP1, GP)
expect_that(otu_table(GP1), is_identical_to(otu_table(GP)))
expect_that(tax_table(GP1), is_identical_to(tax_table(GP)))
expect_that(phy_tree(GP1), is_identical_to(phy_tree(GP)))
expect_identical(otu_table(GP1), (otu_table(GP)))
expect_identical(tax_table(GP1), (tax_table(GP)))
expect_identical(phy_tree(GP1), (phy_tree(GP)))
## Check factor levels
# The set
......@@ -128,23 +130,23 @@ test_that("merge_phyloseq: Break apart GP based on human-association,
data("GlobalPatterns")
GP.chl = subset_taxa(GlobalPatterns, Phylum == "Chlamydiae")
test_that("the tax_table slot is identical whether tax_glom()ed by itself or as component", {
expect_that(tax_glom(tax_table(GP.chl), "Family"), is_a("taxonomyTable"))
expect_that(n1<-tax_glom(GP.chl, "Family"), is_a("phyloseq"))
expect_that(ntaxa(n1), equals(4L))
expect_that(
expect_is(tax_glom(tax_table(GP.chl), "Family"), ("taxonomyTable"))
expect_is(n1<-tax_glom(GP.chl, "Family"), ("phyloseq"))
expect_equal(ntaxa(n1), (4L))
expect_equivalent(
tax_glom(tax_table(GP.chl), taxrank="Family"),
is_equivalent_to(tax_table(tax_glom(GP.chl, taxrank="Family")))
tax_table(tax_glom(GP.chl, taxrank="Family"))
)
n1 = as(tax_glom(tax_table(GP.chl), taxrank="Family", NArm=FALSE), "matrix")[, "Family"]
n2 = tax_glom(GP.chl, taxrank="Family", NArm=FALSE)
expect_true(setequal(n1, as(tax_table(n2), "matrix")[, "Family"]))
expect_that(ntaxa(n2), equals(5L))
expect_equal(ntaxa(n2), (5L))
})
test_that("tax_glom() handles clearly agglomeration to one taxa", {
expect_that(n1 <- tax_glom(GP.chl, "Phylum"), gives_warning())
expect_that(n1, is_a("phyloseq"))
expect_that(ntaxa(n1), equals(1L))
expect_that(access(n1, "phy_tree"), is_a("NULL"))
expect_warning(n1 <- tax_glom(GP.chl, "Phylum"))