daler / gffutils

GFF and GTF file manipulation and interconversion
http://daler.github.io/gffutils
MIT License
289 stars 78 forks source link

test_roundtrip fails: test_roundtrip #233

Open yurivict opened 5 months ago

yurivict commented 5 months ago
______________________________________________________________________________________ test_roundtrip _______________________________________________________________________________________

    def test_roundtrip():
        """
        Feature -> SeqFeature -> Feature should be invariant.
        """
        db_fname = gffutils.example_filename("gff_example1.gff3")
        db = gffutils.create_db(db_fname, ":memory:")
        feature = db["ENSMUSG00000033845"]
        feature.keep_order = True
        dialect = feature.dialect
>       s = bp.to_seqfeature(feature)

gffutils/test/test_biopython_integration.py:15: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

feature = <Feature gene (chr1:4763287-4775820[-]) at 0xbc359633390>

    def to_seqfeature(feature):
        """
        Converts a gffutils.Feature object to a Bio.SeqFeature object.

        The GFF fields `source`, `score`, `seqid`, and `frame` are stored as
        qualifiers.  GFF `attributes` are also stored as qualifiers.

        Parameters
        ----------
        feature : Feature object, or string
            If string, assume it is a GFF or GTF-format line; otherwise just use
            the provided feature directly.
        """
        if isinstance(feature, str):
            feature = feature_from_line(feature)

        qualifiers = {
            "source": [feature.source],
            "score": [feature.score],
            "seqid": [feature.seqid],
            "frame": [feature.frame],
        }
        qualifiers.update(feature.attributes)
>       return SeqFeature(
            # Convert from GFF 1-based to standard Python 0-based indexing used by
            # BioPython
            FeatureLocation(
                feature.start - 1, feature.stop, strand=_biopython_strand[feature.strand]
            ),
            id=feature.id,
            type=feature.featuretype,
            qualifiers=qualifiers,
        )
E       NameError: name 'SeqFeature' is not defined

gffutils/biopython_integration.py:46: NameError

Version: 0.13 Python-3.11 FreeBSD 14.1

mschubert commented 4 months ago

I can confirm for gffutils=0.13, python=3.12 on Gentoo