Skip to content

test_roundtrip fails: test_roundtrip #233

Description

@yurivict
______________________________________________________________________________________ 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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions