R: Import microbio.me/qiime (QIIME-DB) data package
microbio_me_qiime
R Documentation
Import microbio.me/qiime (QIIME-DB) data package
Description
Originally, this function was for accessing microbiome datasets from the
microbio.me/qiime
public repository from within R.
As you can see by clicking on the above link,
the QIIME-DB sever is down indefinitely.
However, this function will remain supported here
in case the FTP server goes back up,
and also for phyloseq users that have downloaded
one or more data packages prior to the server going down.
(Required). A character string that is the full URL
path to a zipped file that follows the file naming conventions used by
microbio.me/qiime.
Alternatively, you can simply provide the study number
as a single integer or other single-length vector
that can be coerced to an integer;
this function will complete the remainder of the ftp URL hosted at
microbio.me/qiime.
For example, instead of the full URL string,
"ftp://thebeast.colorado.edu/pub/QIIME_DB_Public_Studies/study_494_split_library_seqs_and_mapping.zip",
you could simply provide 494 or "494"
as the first ('zipftp') argument.
ext
(Optional). A character string of the expected
file extension, which also indicates the compression type,
if zipftp is a study number instead of the full path.
Note that this argument has no effect if zipftp is the full path,
in which case the file extension is read directly from the downloaded file.
parsef
(Optional). The type of taxonomic parsing to use for the
OTU taxonomic classification, in the .biom file, if present.
This is passed on to import_biom, but unlike that function
the default parsing function is parse_taxonomy_greengenes,
rather than parse_taxonomy_default, because we know
ahead of time that most (or all?) of the taxonomic classifications
in the microbio.me/qiime repository will be based on
GreenGenes.
...
(Optional, for advanced users). Additional arguments passed to
download.file. This is mainly for non-standard links to
resources (in this case, a zipped file) that are not being hosted by
microbio.me/qiime.
If you are using a FTP address or study number from their servers,
then you shouldn't need to provide any additional arguments.
Value
A phyloseq-class object if possible, a component if only a
component could be imported, or NULL if nothing could be imported
after unzipping the file. Keep in mind there is a specific naming-convention
that is expected based on the current state of the
microbio.me/qiime
servers. Several helpful messages are catted to standard out
to help let you know the ongoing status of the current
download and import process.
See Also
See download.file and url
for details about URL formats –
including local file addresses – that might work here.
import_biom
import_qiime
Examples
# This should return TRUE on your system if you have internet turned on
# and a standard R installation. Indicates whether this is likely to
# work on your system for a URL or local file, respectively.
capabilities("http/ftp"); capabilities("fifo")
# A working example with a local example file included in phyloseq
zipfile = "study_816_split_library_seqs_and_mapping.zip"
zipfile = system.file("extdata", zipfile, package="phyloseq")
tarfile = "study_816_split_library_seqs_and_mapping.tar.gz"
tarfile = system.file("extdata", tarfile, package="phyloseq")
tarps = microbio_me_qiime(tarfile)
zipps = microbio_me_qiime(zipfile)
identical(tarps, zipps)
tarps; zipps
plot_heatmap(tarps)
# An example that used to work, before the QIIME-DB server was turned off by its host.
# # Smokers dataset
# smokezip = "ftp://thebeast.colorado.edu/pub/QIIME_DB_Public_Studies/study_524_split_library_seqs_and_mapping.zip"
# smokers1 = microbio_me_qiime(smokezip)
# # Alternatively, just use the study number
# smokers2 = microbio_me_qiime(524)
# identical(smokers1, smokers2)
Results
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(phyloseq)
> png(filename="/home/ddbj/snapshot/RGM3/R_BC/result/phyloseq/microbio_me_qiime.Rd_%03d_medium.png", width=480, height=480)
> ### Name: microbio_me_qiime
> ### Title: Import microbio.me/qiime (QIIME-DB) data package
> ### Aliases: microbio_me_qiime
>
> ### ** Examples
>
> # This should return TRUE on your system if you have internet turned on
> # and a standard R installation. Indicates whether this is likely to
> # work on your system for a URL or local file, respectively.
> capabilities("http/ftp"); capabilities("fifo")
http/ftp
TRUE
fifo
TRUE
> # A working example with a local example file included in phyloseq
> zipfile = "study_816_split_library_seqs_and_mapping.zip"
> zipfile = system.file("extdata", zipfile, package="phyloseq")
> tarfile = "study_816_split_library_seqs_and_mapping.tar.gz"
> tarfile = system.file("extdata", tarfile, package="phyloseq")
> tarps = microbio_me_qiime(tarfile)
Found biom-format file, now parsing it...
Done parsing biom...
Importing Sample Metdadata from mapping file...
Merging the imported objects...
Successfully merged, phyloseq-class created.
Returning...
Warning message:
In microbio_me_qiime(tarfile) : NAs introduced by coercion
> zipps = microbio_me_qiime(zipfile)
Found biom-format file, now parsing it...
Done parsing biom...
Importing Sample Metdadata from mapping file...
Merging the imported objects...
Successfully merged, phyloseq-class created.
Returning...
Warning message:
In microbio_me_qiime(zipfile) : NAs introduced by coercion
> identical(tarps, zipps)
[1] TRUE
> tarps; zipps
phyloseq-class experiment-level object
otu_table() OTU Table: [ 50 taxa and 15 samples ]
sample_data() Sample Data: [ 15 samples by 39 sample variables ]
tax_table() Taxonomy Table: [ 50 taxa by 7 taxonomic ranks ]
phyloseq-class experiment-level object
otu_table() OTU Table: [ 50 taxa and 15 samples ]
sample_data() Sample Data: [ 15 samples by 39 sample variables ]
tax_table() Taxonomy Table: [ 50 taxa by 7 taxonomic ranks ]
> plot_heatmap(tarps)
> # An example that used to work, before the QIIME-DB server was turned off by its host.
> # # Smokers dataset
> # smokezip = "ftp://thebeast.colorado.edu/pub/QIIME_DB_Public_Studies/study_524_split_library_seqs_and_mapping.zip"
> # smokers1 = microbio_me_qiime(smokezip)
> # # Alternatively, just use the study number
> # smokers2 = microbio_me_qiime(524)
> # identical(smokers1, smokers2)
>
>
>
>
>
> dev.off()
null device
1
>