Convert FAIRe metadata sheets (NOAA format) to NCBI BioSample and SRA submission templates with automated configuration management.
FAIRe2NCBI is a comprehensive toolkit for converting FAIRe (FAIR evironmental) metadata to NCBI submission formats. It provides two main conversion modes:
- BioSample Mode: Convert FAIRe sample metadata to NCBI BioSample format
- SRA Mode: Convert FAIRe experimental run metadata to NCBI SRA submission format
- Input as one workbook (
--FAIReMetadata) or three sheet files (--projectMetadata,--sampleMetadata,--experimentRunMetadata) - Bioproject accession handling (single value or expedition-based grouping)
- Mandatory field validation and filling
- Numerical column unit detection and assignment
- Duplicate row detection and resolution
- Sample title generation from metadata fields
- Optional experimentRunMetadata associatedSequences filtering (
all/blank_only)
- Input as one workbook (
--FAIReMetadata) or three sheet files (--projectMetadata,--sampleMetadata,--experimentRunMetadata) - lib_id selection workflow (all or selected values from user-selected columns)
- Optional experimentRunMetadata associatedSequences filtering (
all/blank_only) - Optional fastq quality filter with
--filter-fastq(detect empty/corrupted fastq and remove matching SRA rows) - Optional split output by BioProject (
--split_by_BioProject) with one SRA output file per BioProject - Absolute fastq symlink creation in split-specific subfolders (under
--fastq_folderor--filter-fastq) - Platform/instrument/model determination from metadata with interactive fallback prompts
- Clone the repository:
git clone https://github.com/aomlomics/FAIRe2NCBI.git
cd FAIRe2NCBI- Create a conda environment:
conda create --name FAIRe2NCBI python=3.13
conda activate FAIRe2NCBI- Install required packages:
conda install pandas pyyaml openpyxl rapidfuzz# Main help
python scripts/FAIRe2NCBI.py -h
# BioSample mode help
python scripts/FAIRe2NCBI.py BioSample -h
# SRA mode help
python scripts/FAIRe2NCBI.py SRA -hConvert FAIRe sample metadata to NCBI BioSample format.
# Option 1: single workbook
python scripts/FAIRe2NCBI.py BioSample \
--FAIReMetadata your_FAIRe_Metadata.xlsx \
--BioSample_Metadata your_output_biosample.tsv \
[--BioSample_Template custom_template.tsv] \
[--bioproject_accession PRJNA123456] \
[--config_file config.yaml] \
[--force]
# Option 2: three individual sheet files
python scripts/FAIRe2NCBI.py BioSample \
--projectMetadata your_projectMetadata.tsv \
--sampleMetadata your_sampleMetadata.tsv \
--experimentRunMetadata your_experimentRunMetadata.tsv \
--BioSample_Metadata your_output_biosample.tsv \
[--BioSample_Template custom_template.tsv] \
[--bioproject_accession PRJNA123456] \
[--config_file config.yaml] \
[--force]Convert FAIRe experimental run metadata to NCBI SRA submission format.
# Option 1: single workbook
python scripts/FAIRe2NCBI.py SRA \
--FAIReMetadata your_FAIRe_Metadata.xlsx \
--SRA_Metadata your_output_sra.tsv \
[--SRA_Template custom_sra_template.xlsx] \
[--config_file config.yaml] \
[--NCBI_accession_number biosample_or_bioproject_table.tsv] \
[--filter-fastq /path/to/fastq_folder] \
[--split_by_BioProject [split_table.tsv]] \
[--fastq_folder /path/to/fastq_folder] \
[--force]
# Option 2: three individual sheet files
python scripts/FAIRe2NCBI.py SRA \
--projectMetadata your_projectMetadata.tsv \
--sampleMetadata your_sampleMetadata.tsv \
--experimentRunMetadata your_experimentRunMetadata.tsv \
--SRA_Metadata your_output_sra.tsv \
[--SRA_Template custom_sra_template.xlsx] \
[--config_file config.yaml] \
[--NCBI_accession_number biosample_or_bioproject_table.tsv] \
[--filter-fastq /path/to/fastq_folder] \
[--split_by_BioProject [split_table.tsv]] \
[--fastq_folder /path/to/fastq_folder] \
[--force]--BioSample_Metadata: Output TSV file for BioSample metadata [BioSample mode only]--SRA_Metadata: Output TSV file for SRA metadata [SRA mode only]- FAIRe input (both modes): use either
--FAIReMetadata(single workbook), or- all three sheet files:
--projectMetadata,--sampleMetadata,--experimentRunMetadata
--BioSample_Template: Path to MIMARKS template file (.tsv). Defaults to bundleddocs/NCBI_BioSample_Metadata_Template.tsv[BioSample mode only]--SRA_Template: Path to SRA template file (.xlsx). Defaults to bundleddocs/NCBI_SRA_Metadata_Template.xlsx[SRA mode only]--bioproject_accession: Bioproject accession to use for all samples [BioSample mode only]--NCBI_accession_number: Table with BioSample and/or BioProject accessions [SRA mode only]--filter-fastq: Fastq folder to scan for empty/corrupted files and remove matching SRA rows (filename,filename2,filename3,filename4) [SRA mode only]--split_by_BioProject: Split SRA output by BioProject using a provided table; if used as a flag without a path,--NCBI_accession_numberis used [SRA mode only]--fastq_folder: Fastq root folder for split-mode symlink subfolders; required with--split_by_BioProjectunless--filter-fastqis provided [SRA mode only]--config_file: Path to YAML configuration file for automated responses--force: Overwrite output files without prompting
When --split_by_BioProject is enabled:
- One SRA metadata file is written per BioProject value.
- A fastq subfolder is created for each BioProject under:
--fastq_folderif provided, else--filter-fastq
- Subfolder names use
<split_column>_<BioProject_value>(sanitized). - The script creates absolute symlinks (not hard copies) for fastq files referenced in
filename/filename2/filename3/filename4.
Bundled NCBI templates are resolved from the repo docs/ folder automatically, so you can run the script from any working directory without passing --BioSample_Template or --SRA_Template.
- First prompt:
Do you want to use a config file from a previous run? [y/N]:- y: provide a path to an existing config file
- N (default): load
docs/config template as a base, answer interactively, and write a new config next to the output file (template is never modified)
- Generate Config: Script creates/updates a config file based on your output filename
- Reuse Config: Use the generated config file later for automated processing
Numerical fields without a paired *_unit column ask whether to use the MIxS Preferred_unit from docs/mixs.yaml ([Y/n], Y default); otherwise you can enter a custom unit.
-
BioSample:
docs/BioSample_config_file_template.yaml -
SRA:
docs/SRA_config_file_template.yaml -
✅ Templates are never modified - they remain clean for reuse
-
✅ New config files are created based on your output filename
-
✅ Generated configs are fully reusable for automated workflows
This project is developed and maintained by NOAA Omics Group, including Clement Coclet, Luke Thompson, and Katherine Silliman. For questions or contributions, please open an issue.
When using FAIRe2NCBI in your research, please cite this repository.
