Skip to contents
0.16.6 documentation

Complete canonical API text; task articles explain the workflows. Tutorials

Site guide · find your task

Uses the public Bio.SeqIO.parse(..., "genbank") API in an explicitly selected Python environment with Biopython installed. The R package jsonlite exchanges structured temporary JSON with that process. This function never installs packages, downloads records, or runs during plot building. It reads all selected records into memory and is intended for small to moderate local annotation files, not chromosome-scale streaming.

Usage

Code
read_genbank(
  file = NULL,
  files = NULL,
  feature_types = NULL,
  lengths = NULL,
  python = "python3",
  unsupported = c("error", "report"),
  source_file = FALSE
)

Arguments

file

Optional path vector or glob patterns; read before files.

files

Optional paths or wildcard patterns for several files.

feature_types

Optional feature types to select. NULL retains all.

lengths

Optional named numeric vector of known full sequence lengths, following as_ggchord_seq().

python

Interpreter name or path, default "python3". It must already have the optional Biopython package installed. No environment is modified.

unsupported

"error" or "report" for locations without a safe local interval representation.

source_file

Add .source_file columns to output tables, default FALSE. File provenance is retained in the report regardless.

Value

A list with seq_data, named features$annotation, and report. Tables can be supplied to prepare_ggchord_data(). Feature rows include feature_id, parent_ids, segments, source record/feature indices, qualifiers, source_location, partial_start/partial_end, and location_operator. report$records retains the complete parsed source CDS rows also expose source codon_start, genetic_code, biological partial5/partial3, and translation_exception qualifiers for explicit downstream coding-coordinate models. Missing CDS codon_start uses the INSDC default 1, marked by codon_start_source = "format-default". Bound-only flags remain in bound_partial5/bound_partial3; CDS partial flags also record initial codon offset or terminal coding remainder, with their evidence in partial5_source/partial3_source. They describe the observed coding extent, not proof of a complete biological protein. No per-segment phase values are invented. segment_order preserves the source's declared coding-piece order independently of segment_index. metadata, raw_files retains original text, and unplaced_features identifies every selected feature not placed under "report".

Details

Record IDs, including accession versions, are retained exactly as returned by the source parser. Full parsed record annotations, feature qualifiers, source locations, and original file text are retained in report. Feature IDs use explicit ID, then protein_id for CDS, then locus_tag, then a non-placeholder parser feature ID. Missing IDs remain missing. Shared locus_tag values do not invent gene/CDS parent relationships; explicit Parent qualifiers become parent_ids.

Simple and joined local locations retain one-based inclusive segments in parser order. Before/after fuzzy bounds retain their source descriptors and partial flags; they are displayed at the reported boundary rather than treated as exact biology. Remote locations, missing or unsupported fuzzy positions, zero-width sites, and mixed-strand joined features are never flattened into guessed intervals. unsupported = "error" stops by default; "report" retains these features in report$unplaced_features instead. An absent ORIGIN sequence does not imply an unknown declared length. Truly missing/zero lengths require explicit lengths; feature endpoints are never used to infer full lengths. Protein records require an explicit protein-coordinate workflow instead of this nucleotide reader.

Examples

Code
if (FALSE) { # \dontrun{
# Requires the source checkout or tutorial input bundle and optional Biopython.
imported <- read_genbank("examples/format-inputs/pUC19c-L09137.2.gb")
imported$report
} # }