Importing and formatting OBITools and associated files (i.e. an obitab output file, an ngsfilter file and table of sample characteristics respectively) to create a metabarlist object (see Boyer et al. 2016).

obifiles_to_metabarlist(file_obitab, file_ngsfilter, file_samples, ...)

Arguments

file_obitab

path for the obitab output file. Rows of the table correspond to MOTUs, and columns correspond to MOTU characteristics and counts across PCRs. Mandatory fields: `sequence`; should be included when using obitab.

file_ngsfilter

path for the ngsfilter file. Rows of the table correspond to PCRs, and the columns to their characteristics. Mandatory fields in the additional information: (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.

file_samples

path for the sample characteristics table. The first column of this table should contain the sample names.

...

other arguments to be pasted from read.table

Value

a metabarlist object

Details

This function imports OBITools outputs and related files into R to create a metabarlist object. The three files required are imported in R, included into a list of class metabarlist with the metabarlist_generator function, before congruencies between all tables are tested with the check_metabarlist function.

References

Boyer, F., Mercier, C., Bonin, A., Le Bras, Y., Taberlet, P., & Coissac, E. (2016). obitools: a unix-inspired software package for DNA metabarcoding. Molecular Ecology Resources, 16(1), 176-182.

Author

Lucie Zinger

Examples


# \donttest{

dir <- tempdir()
url = "https://raw.githubusercontent.com/metabaRfactory/metabaR_external_data/master/"

obitab_file = "litiere_euk_cl97_agg_filt_tax.tab"
obitab_url = paste(url, obitab_file, sep="")
obitab_path <- file.path(dir, obitab_file)
download.file(obitab_url, obitab_path)

ngsfilter_file = "ngsfilter_GWM-768.new_2.txt"
ngsfilter_url = paste(url, ngsfilter_file, sep="")
ngsfilter_path <- file.path(dir, "ngsfilter_GWM-768.new_2.txt")
download.file(ngsfilter_url, ngsfilter_path)

samples_file = "Litiere_sample_list_2.txt"
samples_url = paste(url, samples_file, sep="")
samples_path <- file.path(dir, samples_file)
download.file(samples_url, samples_path)

soil_euk <- obifiles_to_metabarlist(
  file_obitab = obitab_path,
  file_ngsfilter = ngsfilter_path,
  file_samples = samples_path,
  sep = "\t"
)
#> Warning: Some PCRs in out have a number of reads of zero in table `reads`!

# }