GFF parsing with initial sequence fails #75

Closed
benjiec opened this Issue Sep 17, 2013 · 2 comments

Projects

None yet

2 participants

@benjiec

Hi Brad,

I tried to use the GFF parser with initial sequence. I followed the example from the Wiki, and essentially had something like

  def import_sequence_and_gff(self, fasta_fn, gff_fn):
    in_seq_file = fasta_fn
    in_seq_handle = open(fasta_fn)
    seq_dict = SeqIO.to_dict(SeqIO.parse(in_seq_handle, "fasta"))
    in_seq_handle.close()

    in_file = gff_fn
    in_handle = open(in_file)
    for rec in GFF.parse(in_handle, base_dict=seq_dict):
      print rec
      in_handle.close()

But I get this error message

ValueError: Only CompoundLocation gets an operator ('join')

Looking through the stack, it looks like GFF created a SeqFeature with a SeqLocation, and tried to use the 'join' operator, and BioPython only allows CompoundLocation to have operators.

I am not familiar with the details of BioPython and GFF parser, is this a known problem? Is there a work-around?

Thanks,
Benjie

@chapmanb chapmanb added a commit that closed this issue Sep 18, 2013
@chapmanb Provide basic support for new Biopython 1.62 handling of CompoundFeat…
…ures. Still uses deprecated sub_features until sorting out a reasonable place to put GFF attributes. Fixes #75
ddd08a8
@chapmanb chapmanb closed this in ddd08a8 Sep 18, 2013
@chapmanb
Owner

Benjie;
Thanks for the problem report. I hadn't fixed the feature location handling in the GFF parser to handle the new CompoundLocations in 1.62. For now I updated a solution that will handle both 1.62 and previous versions, so if you upgrade the GFF parser to 0.3 it should work cleanly. Please let me know if you run into any more issues and thanks again.

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