Input data — Methodological guides
1. Overview#
The Input data tab imports one or more previously built phyloseq objects into BarCodeR.
It accepts serialized R objects in the following formats:
.rds;.RData;.rda;.rdata.
BarCodeR automatically determines whether the file contains:
- one
phyloseqdataset; - a project containing several
phyloseqdatasets; - several compatible objects from which the user must choose;
- unsupported content, in which case the import is rejected.
This tab does not rebuild a phyloseq object from separate tables. It loads already serialized R objects.
2. Role of Input data in BarCodeR#
Input data is one of the entry points for data in BarCodeR.
| Need | Tab to use |
|---|---|
Load an existing phyloseq object |
Input data |
Load several phyloseq objects stored in an .rds project |
Input data |
| Retrieve a phyloseq generated on the cluster | OpenMetaBar |
| Build or complete a phyloseq from separate tables | Data Edition |
| Rename, duplicate, delete or export a dataset | Datasets |
| Import a complete archive with figures and history | Datasets |
| Reload the internal backup of the current project | Datasets |
2.1. Operations no longer handled here#
The current Input data module no longer directly provides dataset deletion, renaming, duplication, export, or management of named BarCodeR projects. These operations are centralized in Datasets.
3. Current interface#
Input data contains one main panel:
Load a file (.rds / .RData / .rda)
It includes:
- a description of automatic detection;
- one file selector;
- information about the cleaning applied;
- a reminder that dataset management is performed in Datasets.
There are no longer separate selectors for datasets and projects, no manual OTU-table orientation choice, no metadata-transposition option, no taxonomy-correction option and no deletion panel.
The content type is determined after reading the file.
4. File-size limit#
The upload field is a Shiny fileInput. The global BarCodeR limit is currently:
500 MB
A larger file normally cannot be transferred through this field.
4.1. Disk size versus memory size#
An .rds file may be compressed. The in-memory object can therefore be much larger than the file on disk.
A 300 MB file may require substantially more than 300 MB of RAM while it is uploaded, decompressed, read, copied during cleaning and inserted into the dataset registry.
Enough memory must be available for the loaded object, datasets already in memory and temporary copies created during processing.
4.2. BarCodeR running on a remote server#
When BarCodeR runs on another machine, the file is sent to the Shiny server. Loading time depends on file size, network speed, server load and available memory.
Reading and cleaning are synchronous, so the interface may appear temporarily frozen while a large object is imported.
5. Accepted file formats#
5.1. .rds#
An .rds file stores one R object. BarCodeR reads it with readRDS() and classifies the returned object.
The proposed dataset label is derived from the file name without its extension.
metabarcoding_coi.rds
→ metabarcoding_coi
5.2. .RData or .rda#
An .RData file may contain several R objects. BarCodeR:
- loads the file into an isolated temporary environment;
- inspects each object;
- keeps only objects recognized as a dataset or project;
- automatically selects the object if there is only one;
- asks the user to choose when several compatible objects are found.
Unsupported objects in the file are ignored.
5.3. Unsupported extensions#
Input data does not directly import .csv, .tsv, .xlsx, .biom, .qza, .zip, .RDS.gz, FASTA, FASTQ or Newick files.
Separate tables must be handled in the relevant Data Edition modules. Complete BarCodeR .zip project archives must be imported in Datasets.
6. Automatic content detection#
Detection is based on the actual object structure, not only on the file name or extension.
6.1. Single dataset#
An object is recognized as a dataset when it inherits from the phyloseq class.
6.2. Project#
An object is recognized as a project when it is:
- a list containing
datasets; - a historical list containing
ps_registry; - a non-empty list in which every item is a
phyloseqobject.
6.3. Structural detection#
Project recognition does not necessarily depend on a version number, a particular format field, a file name or a dedicated class. It mainly relies on list structure.
This preserves compatibility with several historical save formats, but an unrelated list named datasets can also be interpreted as a project.
7. Dataset versus project#
7.1. Dataset#
A dataset is one phyloseq object. It may contain an otu_table, sample_data, tax_table, phylogenetic tree and reference sequences.
Only the OTU table is strictly required for insertion into the general dataset registry.
7.2. Data-only .rds project#
A project loaded through Input data mainly contains a dataset list, an active-dataset name and optional save metadata.
The Export data only, without figures (.rds) action in Datasets currently produces a structure similar to:
list(
version = 2,
format = "version_ok_project",
saved_at = ...,
datasets = ...,
active_ds = ...
)
7.3. Complete .zip project#
A .zip exported from Datasets may also contain figure history, module files, saved parameters and a project manifest.
Input data does not restore this complete archive. Use Datasets → Import a project (.zip).
7.4. Importing an .rds project does not switch the application project#
Loading a project through Input data does not create a new named project, change the current project, restore figures, restore module histories or restore the complete navigation state.
It only adds or replaces datasets in the memory of the currently open project.
8. Loading a file#
8.1. Selecting the file#
Choose one compatible file. The field accepts only one file at a time.
BarCodeR reads the content immediately after selection to determine the next workflow.
8.2. Read errors#
Import stops if the file is corrupted, is not a valid R serialization, has misleading content, requires an unavailable class/package, or cannot be deserialized because a dependency is missing.
The file selector is reset so that the same file can be selected again after correction.
9. .RData with several compatible objects#
When several compatible objects are detected, BarCodeR displays Choose the object to load.
Each option shows the R object name and the detected type: dataset or project.
ps_coi (dataset)
ps_16s (dataset)
my_project (project)
9.1. Use the selected object#
Use this object continues with the corresponding dataset or project workflow.
9.2. Cancel#
Cancel closes the modal, clears the file selector and removes the temporary pending object.
9.3. Closing with the top cross#
The top-right cross closes the modal visually but does not perform exactly the same cleanup as Cancel in the current implementation.
The same file may then fail to trigger a new event until another file is selected or the field is refreshed. Prefer Cancel when abandoning an import.
10. Loading a single phyloseq dataset#
When a dataset is detected, BarCodeR opens Prepare dataset loading.
This modal is used to choose the dataset label, select add or replace mode and review the automatic cleaning that will be performed.
11. Dataset label#
11.1. Proposed label#
For an .rds, the label is generally derived from the file name. For .RData, the R object name is preferred.
11.2. Label cleaning#
On confirmation, leading/trailing spaces are removed, unsupported characters are replaced by _, leading/trailing underscores are removed, and dataset is used if the result is empty.
The registry mainly preserves alphanumeric characters, _ and -. Exact handling of non-ASCII characters also depends on the R locale.
11.3. Existing label#
In add mode, an existing label is protected by a numerical suffix:
COI
COI_2
COI_3
The existing object is not silently overwritten.
12. Add or replace#
12.1. Add to the current session#
This default mode preserves all current datasets, adds the new object, makes its label unique if needed and sets it as active.
12.2. Replace current in-memory data#
Replace mode removes all datasets currently held in memory, keeps only the new dataset and makes it active.
Warning: source files on disk are not deleted, but unsaved datasets in the current session may be lost. Save the current project in Datasets before replacing.
12.3. Initially empty session#
If no dataset is present, add/replace is not shown. Loading is treated as replacement of an empty list.
13. Cleaning applied to the phyloseq#
The cleaning is targeted. BarCodeR does not rebuild the whole object and does not automatically transpose its tables.
The main operations are:
- identify the sample axis in the OTU table;
- optionally standardize sample names;
- synchronize these names with metadata;
- replace blank metadata cells with
NA; - check consistency of selected identifiers.
14. OTU-table orientation#
BarCodeR preserves the existing OTU-table orientation and uses taxa_are_rows() to identify the sample axis.
14.1. Taxa in rows#
When taxa_are_rows(ps) == TRUE, taxa are rows and samples are columns. Column names are therefore the sample names that may be cleaned.
14.2. Taxa in columns#
When taxa_are_rows(ps) == FALSE, taxa are columns and samples are rows. Row names are therefore the sample names that may be cleaned.
14.3. No transposition#
The application does not force ASVs into rows, samples into columns, or a shared orientation across datasets. It respects each object's taxa_are_rows property.
The former documentation describing an orientation-selection modal is obsolete.
15. Sample-name standardization#
15.1. Applied transformations#
The cleaning function attempts transliteration, trims outer spaces, replaces internal spaces with _, replaces other unsafe characters with _, collapses repeated underscores, removes edge underscores, replaces empty names and adds suffixes for duplicates.
15.2. Examples#
| Before | Possible result |
|---|---|
Station 01 |
Station_01 |
Station-01 |
Station_01 |
Échantillon A |
Echantillon_A |
sample/1 |
sample_1 |
sample |
sample |
| empty name | sample_1 |
two sample names |
sample, sample_1 |
15.3. Why names are cleaned#
Complex identifiers can cause problems in statistical formulas, table joins, R packages, file names, plots, exports and Shiny selectors.
15.4. Cleaning is not always retained#
OTU-table renaming is kept only when metadata can remain correctly aligned.
If BarCodeR cannot safely match OTU sample names to metadata row names, it may roll back OTU-table renaming. Original names are retained, the object stays coherent and the report contains a warning.
Table consistency takes priority over cosmetic cleaning.
16. Metadata processing#
sample_data is optional. A phyloseq without metadata can be imported, but analyses requiring sample variables remain unavailable.
16.1. Row-name alignment#
When metadata exists, BarCodeR tries to align its row names with OTU-table sample names.
If metadata row names match original OTU names, the same transformations are applied to both components.
If direct matching is not demonstrated, BarCodeR tries to clean metadata independently and applies the result only if it remains compatible with the OTU table.
If matching remains uncertain, metadata names are retained, OTU renaming may be rolled back and a warning is reported.
17. Blank metadata cells#
Empty strings and strings containing only spaces are replaced by real NA values.
| Original value | Imported value |
|---|---|
"" |
NA |
" " |
NA |
"0" |
"0" |
"NA" |
"NA" |
real NA |
NA |
The literal string "NA" is not automatically converted to missing data.
17.1. Column-type consequence#
In the current implementation, every metadata column is converted to character before blank values are replaced.
Numeric, integer, logical, factor and date columns can therefore return to sample_data as character columns. Numeric variables may stop behaving as quantitative variables, Date classes may be lost and ordered factors may lose their ordering.
After import, verify column types in Description, Data Edition or R. This is a real data transformation, not only a display change.
18. Phyloseq components not modified#
Input data does not directly change OTU abundances, OTU orientation, taxon/ASV names, taxonomy values or rank names, reference sequences, the phylogenetic tree, zeros, empty taxa, empty samples, negative/decimal values or OTU-table NA values.
The module therefore does not perform a full scientific validation of the object.
19. Integrity check for a single dataset#
After cleaning, a consistency guard is applied.
19.1. Phyloseq class#
The object must be a real phyloseq.
19.2. Required OTU table#
An otu_table must be present.
19.3. Sample identifiers#
If sample_data exists, its row names must match the complete set of sample names. Order may differ, but identifiers must match as a set. Partial metadata is rejected.
19.4. Taxon identifiers#
If tax_table exists, its row names must match OTU-table taxon names. Partial taxonomy is rejected.
19.5. Items not checked by this guard#
The general guard does not directly validate refseq or tree coverage, sequence validity, integer counts, non-negative values, biological taxonomy coherence, taxonomic duplicates or minimum sample depth.
20. Import rejected for inconsistency#
A single-dataset import is rejected when identifiers are not aligned, the OTU table is missing or the object is not a phyloseq.
No dataset is added, and the original file is not modified.
21. Report after importing a dataset#
A successful import displays Dataset loaded and checked.
21.1. General indicators#
The report includes the dataset label, number of samples, number of taxa/ASVs and total number of actions.
Actions are counted from OTU-name changes, metadata-name changes and blank cells replaced. One logical rename can therefore be counted once in each component.
21.2. Loading source#
The report records the file name, R object name for .RData, add/replace mode and the total number of datasets now in memory.
21.3. Rename details#
Before/after tables are shown for OTU sample names and metadata row names. Only the first ten changes are displayed, while the total remains available.
21.4. Blank cells#
The number of metadata blank cells replaced by NA is reported.
21.5. Warnings#
A dedicated warning appears when cleaning could not safely be applied, for example when OTU names could not be standardized without breaking metadata correspondence.
21.6. Notes#
Notes may state that no change was needed, metadata was absent, names were synchronized or some identifiers were intentionally retained.
22. Loading an .rds project#
BarCodeR extracts the phyloseq datasets contained in the project.
22.1. Empty session#
If no dataset is present, the project is loaded directly in replace mode and a restoration report is displayed.
22.2. Existing datasets#
Load a project shows current dataset names, incoming names and the add/replace choice.
23. Adding project datasets#
Add mode keeps current datasets, adds every imported phyloseq, resolves name collisions and updates the active dataset.
23.1. Name collisions#
An incoming COI added to an existing COI becomes COI_2. The report uses the final assigned name.
23.2. Active dataset after adding#
If the project contains a valid active_ds, the matching imported dataset normally becomes active. If its label was changed to avoid a collision, the new label is used. Otherwise, the first imported dataset becomes active.
24. Replacing with project datasets#
Replace mode removes all in-memory datasets, loads the imported list and restores the project's active dataset when valid; otherwise it selects the first imported dataset.
Files on disk are not deleted, but unsaved current datasets may be lost.
25. Project dataset names#
Valid list names are preserved, subject to collision resolution in add mode.
If names are missing, blank or partially absent, generic names are assigned:
dataset_1
dataset_2
dataset_3
In the current implementation, one missing name may cause the whole list to be renamed, not only the missing entry.
26. Non-phyloseq content in a project#
For structures containing datasets or ps_registry, recognition is based on the presence of the list. During loading, only items that actually inherit from phyloseq are retained; other items are ignored.
26.1. Consequence#
The pre-import list may contain names that are not finally loaded. The final report is the source of truth for the number of restored datasets.
26.2. Project without a valid phyloseq#
A structurally recognized project containing no usable phyloseq can produce a zero-dataset report. In replace mode, this can leave the registry empty. Verify the content before confirming replacement.
27. Cleaning project datasets#
Every project phyloseq receives the same general cleaning: OTU sample names, metadata row names and blank metadata cells.
The project report summarizes sample count, taxon count, OTU-name changes, metadata-name changes and blank cells for each dataset. It does not display complete before/after tables for every object.
28. Different validation for datasets and projects#
A single dataset explicitly passes through bcr_guard_ps() before insertion.
Project loading cleans each phyloseq but does not currently call that guard explicitly for every item before inserting the full project.
28.1. Global safety net#
When the active dataset changes, BarCodeR checks its consistency. An inconsistent active object may therefore trigger a warning. Other project datasets are checked when they become active.
28.2. Practical consequence#
After importing a project, select each important dataset and verify the absence of warnings, dimensions, available tables and identifier correspondence in Description.
29. Import and session memory#
Datasets are held in the reactive registry datasets(), while the active name is stored in active_ds().
After import, the registry is modified, the imported/active dataset is selected, downstream tabs see the new content and the current project becomes modified and unsaved.
29.1. Import is not a save operation#
Loading through Input data does not automatically persist the registry. Use Datasets → Save project before closing the application.
30. Active dataset#
The active dataset is used by default by many modules.
A newly imported single dataset becomes active. A replaced project restores its saved active dataset when available, otherwise the first dataset is selected. An added project normally activates its imported active dataset or the first newly added dataset.
The active dataset can later be changed globally, in Datasets, or in synchronized modules.
31. Scientific guarantees not provided by import#
A successful import mainly means the object is readable, is a phyloseq, has an OTU table and passes selected identifier checks.
It does not guarantee raw counts, absence of prior transformation, removal of empty taxa/samples, valid taxonomy, correctly ordered ranks, complete sequence/tree coverage, valid experimental design, sufficient replication, preserved metadata classes or suitability for every statistical analysis.
32. Recommended checks after import#
Open Description and verify:
- sample count, taxon count and total reads;
- available OTU, metadata, taxonomy, tree and reference-sequence components;
- sample and ASV names, automatic renaming and duplicate suffixes;
- metadata column types, missing values, quantitative variables, factors and dates;
- OTU orientation, negative/decimal values,
NA, zero-depth samples and zero-abundance taxa; - taxonomic ranks, column names, unassigned values and ASV correspondence;
- tree/reference-sequence coverage and identifiers.
33. Later dataset management#
Use Datasets to select the active dataset, rename, duplicate, delete, export, save the project, restore an internal backup or switch BarCodeR projects.
34. Troubleshooting#
34.1. File not shown in the selector#
Check that the extension is .rds, .RData, .rda or .rdata and that the file is not additionally compressed.
34.2. File exceeds the limit#
The global limit is 500 MB. Reduce the object, remove unnecessary components, split datasets, export one dataset at a time or change the application limit in a controlled deployment.
34.3. Small file uses a large amount of memory#
The serialized file is compressed and expands in memory. Free RAM and avoid keeping several large copies simultaneously.
34.4. .rds read error#
obj <- readRDS("file.rds")
class(obj)
Check corruption, incomplete transfer, unavailable classes and misleading extensions.
34.5. .RData contains no recognized object#
load("file.RData")
ls()
class(object_name)
The file must contain a phyloseq, a datasets/ps_registry project, or a list consisting only of phyloseq objects.
34.6. Several objects are displayed#
This is expected for a multi-object .RData. Select the intended object.
34.7. An unrelated object is detected as a project#
It probably contains an item named datasets or ps_registry. Save the intended phyloseq directly:
saveRDS(my_phyloseq, "dataset.rds")
34.8. Missing OTU table#
phyloseq::otu_table(ps)
34.9. Inconsistent sample identifiers#
setequal(
phyloseq::sample_names(ps),
rownames(as.data.frame(phyloseq::sample_data(ps)))
)
The expected result is TRUE.
34.10. Inconsistent taxon identifiers#
setequal(
phyloseq::taxa_names(ps),
rownames(as(phyloseq::tax_table(ps), "matrix"))
)
34.11. Partial metadata is rejected#
Complete the missing samples, remove undocumented samples consistently or rebuild the object with aligned tables.
34.12. Sample names changed#
Review the before/after report. Spaces, accents, punctuation and duplicates may have been standardized.
34.13. Names were not cleaned#
BarCodeR probably rolled back OTU renaming because safe metadata alignment could not be established. Align names in the source object and export again.
34.14. Numeric metadata became text#
str(as.data.frame(phyloseq::sample_data(ps)))
metadata$Depth <- as.numeric(metadata$Depth)
Check values before conversion.
34.15. Literal "NA" is not missing#
metadata[metadata == "NA"] <- NA
Use cautiously if "NA" could be a legitimate category.
34.16. Fewer project datasets were loaded#
Some items may not be phyloseq objects or may have been ignored. Use the final report as the authoritative count.
34.17. All project labels became dataset_1, etc.#
At least one list name was missing or blank.
names(project$datasets) <- c("COI", "16S", "ITS")
34.18. A dataset received _2#
An existing label was protected in add mode.
34.19. Previous datasets disappeared#
Replace mode was confirmed. Restore them from a saved project, .rds, .zip or original source files.
34.20. .rds project did not restore figures#
Input data restores data-only projects. Use the complete .zip importer in Datasets for figures and histories.
34.21. Selecting the same file does not trigger import#
The previous modal may have been closed with the cross rather than Cancel. Select another file temporarily, reset the field or reload the tab.
34.22. No metadata#
Import may still succeed, but group/covariate analyses are unavailable.
34.23. No taxonomy#
Import may succeed, but taxonomy-dependent displays and analyses are unavailable.
34.24. No tree#
Tree-dependent methods such as some UniFrac distances are unavailable.
34.25. No reference sequences#
Sequence-dependent analyses are unavailable.
35. Pre-import checklist#
File#
- The file is
.rds,.RDataor.rda. - It is smaller than 500 MB.
- Enough memory is available.
- The file can be read in R.
Phyloseq object#
- An OTU table is present.
- Sample IDs are unique.
- Taxon IDs are unique.
- Metadata covers all samples when present.
- Taxonomy covers all taxa when present.
- Sequences and tree are coherent when present.
Metadata#
- Missing values are identified.
- Numeric columns are known.
- Ordered factors are documented.
- Dates are documented.
- Sample names match the OTU table.
Current session#
- Existing datasets have been saved.
- Add/replace behavior is understood.
- Label collisions are anticipated.
36. Post-import checklist#
- Read the complete cleaning report.
- Review sample renaming.
- Verify sample and taxon counts.
- Verify metadata column types.
- Verify cells changed to
NA. - Open Description.
- Inspect OTU table and taxonomy.
- Check sequences and tree.
- Save the project from Datasets.
37. Current limitations#
- No exhaustive scientific validation.
- Metadata columns may be converted to character.
- No automatic table transposition.
- No taxonomy cleaning.
- Project validation is less strict than single-dataset validation.
- Project recognition is structural.
- Closing a modal with the cross may leave pending state.
- Maximum upload size is 500 MB.
38. Recommended workflow#
- Build and verify the phyloseq in R.
- Save it with
saveRDS(). - Open Input data.
- Select the file.
- Choose add or replace.
- Check the dataset label.
- Confirm import.
- Read the full report.
- Open Description.
- Check dimensions and components.
- Verify metadata types.
- Save the project in Datasets.
39. Preparing a single dataset#
library(phyloseq)
stopifnot(inherits(ps, "phyloseq"))
stopifnot(!is.null(otu_table(ps)))
if (!is.null(sample_data(ps, errorIfNULL = FALSE))) {
stopifnot(setequal(
sample_names(ps),
rownames(as.data.frame(sample_data(ps)))
))
}
if (!is.null(tax_table(ps, errorIfNULL = FALSE))) {
stopifnot(setequal(
taxa_names(ps),
rownames(as(tax_table(ps), "matrix"))
))
}
saveRDS(ps, "dataset_phyloseq.rds")
40. Compatible data-only project#
project <- list(
version = 2,
format = "version_ok_project",
saved_at = Sys.time(),
datasets = list(
COI = ps_coi,
`16S` = ps_16s
),
active_ds = "COI"
)
saveRDS(project, "project_data_only.rds")
This file can be loaded by Input data, but it does not necessarily contain BarCodeR figures or module histories.
41. Traceability principles#
Keep the original source file, avoid overwriting previous exports, record the export date, preserve the original object name, review the cleaning report, document automatic renaming, verify metadata types, save the BarCodeR project and distinguish the source object from the cleaned in-memory object.
The object held in BarCodeR may differ from the source because of sample-name cleaning, metadata synchronization, blank-cell replacement and metadata-column conversion.
Verified internal sources#
This guide was reconstructed from the current BarCodeR code:
modules/data/mod_data_loader_ui.R— current interface, single file selector and accepted extensions.modules/data/mod_data_loader_server.R— pending state, naming, detection, cleaning, modals, insertion and reports.modules/_shared/_dataset_naming.R— safe and unique dataset labels.modules/_shared/_ps_guard.R— phyloseq class, OTU table and identifier checks.modules/datasets/mod_datasets_server.Randmod_datasets_ui.R— data-only and complete project formats.app.R— 500 MB upload limit,datasets()registry, active dataset and unsaved state.