Le Gymnètre épée (Gymnetrus gladius), Acarie Baron del., Sebin sc. Cuvier, Le Règne Animal, Poissons pl. 69.
Viral genome annotation utilities from the Quantitative Virology and Evolution Unit.
Give an NCBI accession for a viral genome (e.g. NC_001612.1) or a polyprotein (e.g. NP_041277.1). The script downloads the genome's GFF3 from NCBI, finds each mature protein region (mature_protein_region_of_CDS / mat_peptide), maps it onto its parent polyprotein CDS, and writes the protein sequence of each region. Only the standard library is needed.
python polyprotein_peptides.py NC_001612.1 -o out/genome # every polyprotein in the genome
python polyprotein_peptides.py NP_041277.1 -o out/pp # just that polyprotein
python polyprotein_peptides.py NC_045512.2 # protein FASTA to stdout
python polyprotein_peptides.py NC_045512.2 --dna # nucleotide FASTA to stdout
Outputs:
out/X.faa: one record per mature protein,>polyprotein_id|product|aaStart-aaEnd mature_id=... region=seqid:start..end(strand).out/X.tsv:polyprotein_id, product, mature_protein_id, aa_start, aa_end, length, genomic_region, sequence.out/X.fna: the nucleotide sequence of each region, with the same headers asX.faa. Regions are read strand-aware from the genome, with join segments concatenated in order, so a frameshifted region is its coding sequence. The genome comes from--genome-fastaor NCBI. With--gff3and no--genome-fasta, no.fnais written.
Genomic coordinates are mapped through the spliced CDS, so ribosomal frameshifts (e.g. coronavirus pp1ab/nsp12) map correctly. A mature protein shared by pp1a and pp1ab is listed under each. Polyprotein sequences come from NCBI's protein records. Offline, use --gff3 file.gff3 with either --protein-fasta polyproteins.faa (headers = CDS protein_id) or --genome-fasta genome.fasta, which translates the CDS instead. --keep-gff3 saves the downloaded GFF3. Set NCBI_API_KEY for higher rate limits.
Test: python tests/test_polyprotein_peptides.py
index.html (with its scripts, styles and icons in docs/) is a static site that runs the same steps in the browser. Enter an accession, or upload a GFF3 plus a protein or genome FASTA. It draws a map of each polyprotein and shows a table of mature proteins, with protein FASTA, DNA FASTA, TSV and GFF3 downloads. The DNA FASTA downloads the genome from NCBI on first use, unless you uploaded a genome FASTA. ?acc=NC_045512.2 in the URL runs that accession directly.
Publishing is done by .github/workflows/static.yml on pushes to main. In the repo's Settings → Pages, set Source: GitHub Actions, and allow main under Settings → Environments → github-pages → Deployment branches. Because index.html is at the top level, Deploy from a branch (main, / (root)) also works. To try it locally, open index.html in a browser.
The parsing and mapping logic in docs/polyprotein.js mirrors polyprotein_peptides.py. The test checks that both give identical output (needs node).