R/tabfiles_to_metabarlist.R
tabfiles_to_metabarlist.Rd
Importing and formatting four files (corresponding to MOTU abundances, MOTU characteristics, PCR characteristics and sample characteristics respectively) to create a metabarlist
object.
tabfiles_to_metabarlist(
file_reads,
file_motus,
file_pcrs,
file_samples,
files_sep = "\t"
)
path for the MOTU abundance table. Rows of the table should correspond to PCRs, and columns should correspond to MOTUs. The first column of this table should correspond to the names of the pcrs; the first line to the names of MOTUs.
path for the MOTU characteristics table (e.g. taxonomy, sequence, etc.). Rows of the table should correspond to MOTUs, and the columns to their characteristics. The first column of this table should contain MOTU names. Mandatory fields: `sequence`, i.e. the most abundant sequence of the MOTU.
path for the PCR characteristics table (e.g. tags, primers, plate wells, etc.). Mandatory fields: (i) `sample_id`, i.e. the name of each sample. (ii) `type`, i.e. the type of pcr; can be `sample` or `control`. (iii) `control_type`, i.e. the type of control if applicable. Should be: `NA` for samples, `extraction` for extraction negative controls, `pcr` for PCR negative controls, `sequencing` for sequencing negative controls (e.g. unused tag combinations), and `positive` for positive controls. The first column of this table should correspond to the names of the PCRs.
path for the sample characteristics table. The first column of this table should contain the sample names.
separator used to read the different tables. Should be the same in all tables. Default is tabulation.
a metabarlist
object
This function imports tabular data into R to create a metabarlist
object. The four files required are imported into R, included in a list of class metabarlist
with the metabarlist_generator
function, and congruencies between all tables are tested with the check_metabarlist
function.
# \donttest{
dir <- tempdir()
url = "https://raw.githubusercontent.com/metabaRfactory/metabaR_external_data/master/"
litiere_euk_reads_file = "litiere_euk_reads.txt"
litiere_euk_reads_url = paste(url, litiere_euk_reads_file, sep="")
litiere_euk_reads_path <- file.path(dir, litiere_euk_reads_file)
download.file(litiere_euk_reads_url, litiere_euk_reads_path)
litiere_euk_motus_file = "litiere_euk_motus.txt"
litiere_euk_motus_url = paste(url, litiere_euk_motus_file, sep="")
litiere_euk_motus_path <- file.path(dir, litiere_euk_motus_file)
download.file(litiere_euk_motus_url, litiere_euk_motus_path)
litiere_euk_pcrs_file = "litiere_euk_pcrs.txt"
litiere_euk_pcrs_url = paste(url, litiere_euk_pcrs_file, sep="")
litiere_euk_pcrs_path = file.path(dir, litiere_euk_pcrs_file)
download.file(litiere_euk_pcrs_url, litiere_euk_pcrs_path)
litiere_euk_samples_file = "litiere_euk_samples.txt"
litiere_euk_samples_url = paste(url, litiere_euk_samples_file, sep="")
litiere_euk_samples_path = file.path(dir, litiere_euk_samples_file)
download.file(litiere_euk_samples_url, litiere_euk_samples_path)
soil_euk <- tabfiles_to_metabarlist(
file_reads = litiere_euk_reads_path,
file_motus = litiere_euk_motus_path,
file_pcrs = litiere_euk_pcrs_path,
file_samples = litiere_euk_samples_path
)
#> Warning: Some PCRs in out have a number of reads of zero in table `reads`!
# }