%global srcname snapgene_reader %global pypiname snapgene-reader %global ghname SnapGeneReader Name: python-%{pypiname} Version: 0.1.23 Release: 1%{?dist} Summary: Read SnapGene .dna files into Biopython records or GenBank License: MIT URL: https://github.com/Edinburgh-Genome-Foundry/%{ghname} # GitHub tag archive rather than the PyPI sdist: the sdist ships tests/ without # tests/test_samples/, and both cases assert they found at least one .dna file # there, so from PyPI the suite fails on an empty directory rather than skipping. Source0: %{url}/archive/refs/tags/v%{version}/%{ghname}-%{version}.tar.gz BuildArch: noarch BuildRequires: python3-devel BuildRequires: pyproject-rpm-macros # %%check BuildRequires: python3-pytest %global _description %{expand: SnapGene is a widely used commercial plasmid editor with its own binary .dna format. This reads that format without SnapGene: it parses the file and returns a dict, a JSON document or a Biopython SeqRecord, and can write the record straight out as GenBank. That matters because a great deal of real plasmid data only exists as .dna -- it is what many labs archive and what collaborators send -- while almost every open tool speaks GenBank or FASTA. If you only need a Biopython record, prefer Biopython itself: since well before 1.88 it has read this format natively as SeqIO.parse(path, "snapgene"), and on the same file it produces correct feature locations where this package does not (see %%check). This is packaged because dnacauldron, sequenticon and genedom import it by name, and for its dict and JSON output, which Biopython has no equivalent of.} %description %_description %package -n python3-%{pypiname} Summary: %{summary} %py_provides python3-%{srcname} %description -n python3-%{pypiname} %_description %prep %autosetup -p1 -n %{ghname}-%{version} %generate_buildrequires %pyproject_buildrequires %build %pyproject_wheel %install %pyproject_install %pyproject_save_files -l %{srcname} %check # Upstream's suite, both cases. They read every .dna under tests/test_samples/, # convert it two ways and reparse the result through Biopython, which is why # this is built from the GitHub tag. # # Both cases pass, but the reparse emits two BiopythonParserWarnings: # negative starting position in feature location '0..4' # negative starting position in feature location '0..225' # These come from the GenBank this package just wrote, not from the .dna input. # GenBank coordinates are 1-based, so a feature starting at 0 is invalid; # Biopython reacts by setting that feature's location to None. Features at the # very start of a sequence therefore lose their position on conversion. The # tests do not assert on locations, so they pass regardless. Left as warnings # rather than made fatal: the conversion is still far better than nothing, and # the fix belongs upstream. %pytest -q tests %files -n python3-%{pypiname} -f %{pyproject_files} %doc README.rst %changelog * Sun Sep 27 2026 Morgan Hough - 0.1.23-1 - Initial package: SnapGeneReader 0.1.23. Net-new to Fedora. - Every dependency was already in Fedora: Biopython, xmltodict and html2text. - Packaged to unblock dnacauldron, sequenticon and genedom, which import it by name, and for its dict/JSON output. - Correcting an overstatement made when this was first written: it is not "the only route from SnapGene's binary format into anything open". Biopython 1.88 reads .dna natively as SeqIO format "snapgene", and checked against tests/test_samples/pIB2-SEC13-mEGFP.dna it returns all 12 features with correct locations, including a compound join -- where this package's GenBank output loses them to the 0-based-start bug noted below. For a SeqRecord, Biopython is the better route. - Sourced from the GitHub tag; the sdist omits tests/test_samples/. - Named python-snapgene-reader after the normalised PyPI name, with %%py_provides for python3-snapgene_reader so either spelling resolves. - Upstream bug found by the suite's own warnings, worth reporting: the GenBank this writes uses 0-based feature starts, which GenBank does not allow, so Biopython discards the location of any feature beginning at position 0. Two of the three sample files hit it. See the note in %%check.