Skip to main content

Data Preparation

The pipeline accepts genomic data from three primary sources: GISAID EpiFlu, NCBI Virus, and custom laboratory collections. This page documents the required file formats, metadata schemas, and acquisition workflows for each source.

Overview: Supported Data Sources


Source 1: GISAID EpiFlu

GISAID is the primary recommended source for Influenza A/B sequences due to its comprehensive coverage and standardised metadata.

Downloading from GISAID

  1. Log in at https://gisaid.org → Select EpiFlu™ Database.
  2. Apply filters:
    • Type: A (Influenza A) or B (Influenza B)
    • Segment: Select the target segment (e.g., MP for M segment)
    • Host: Human
    • Location: Your target region
  3. Select all results → Click Download → Choose Sequences (XLS/CSV) + Metadata.
  4. Download format: EpiFlu™ Package — this produces a .xls metadata file paired with a .fasta sequences file.

GISAID Metadata Schema (EpiFlu XLS)

The pipeline’s sanitize_metadata.py reads EpiFlu XLS directly via openpyxl. Key column mapping:

Configuration for GISAID EpiFlu

GISAID Data Access Agreement: All data downloaded from GISAID is subject to the GISAID Data Access Agreement. Do not redistribute raw GISAID sequences or metadata. The pipeline stores processed outputs only; raw GISAID files should be retained locally and not committed to public repositories.

Source 2: NCBI Virus (Web Portal)

NCBI Virus provides open-access sequence data for all pathogens. Download limits are higher than GISAID, but metadata is less standardised for Influenza.

Downloading from NCBI Virus

  1. Navigate to https://www.ncbi.nlm.nih.gov/labs/virus/vssi/.
  2. Search by taxon (e.g., Influenza A virus) and apply filters:
    • Nucleotide completeness: Complete
    • Host: Homo sapiens
    • Geographic Location: Target country
    • Collection Date: Start and end year range
  3. Click Download → Select both:
    • Nucleotide (FASTA format)
    • Current table view result (CSV metadata)
  4. Save both files and note their paths.

NCBI Virus Metadata Schema (CSV)

Configuration for NCBI Virus CSV


Source 3: NCBI Datasets API (Automated)

For large-scale or automated retrieval, use the ncbi-datasets-cli pathway.
The NCBI API pathway is currently marked experimental in the pipeline. The API is evolving and may return inconsistent results for some organism queries. For production surveillance runs, use database: local with manually downloaded files.
The pipeline will call ncbi-datasets-cli to download sequences and auto-convert metadata. Prerequisite: Set your NCBI API key for higher rate limits:

Sequence File Requirements (FASTA)

Regardless of source, the input FASTA must meet these requirements:

FASTA Header Alignment with Metadata

The strain field in metadata must exactly match the FASTA sequence header (after the > character). Mismatches cause sequences to be silently dropped during metadata enrichment.

Combining Multiple Downloads

When combining multiple GISAID or NCBI downloads:
The pipeline’s MD5 deduplication in M02 will handle any exact-duplicate sequences that slip through the combination step.

Reference Files

The pipeline requires two reference files per target segment: Reference files are stored in config/references/. To add a new pathogen:
  1. Download the reference GenBank record: efetch -db nuccore -id NC_002016.1 -format gb > config/references/flu_a_mp_reference.gb
  2. Convert to GFF3 using bp_seqfeature_load.pl or manually create from the GenBank CDS annotations.
  3. Update config.references.genome and config.references.annotation to point to the new files.
  4. Update config.references.reference_id to the accession number (e.g., NC_002016.1).

Dataset Sizing Recommendations

For HyPhy selection analysis (M05), independently cap the input via hyphy.subsample.max_sequences: 300 regardless of the total dataset size.