You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I got the following failure when I read this GFF file:
File "gffpandas/gffpandas.py", line 133, in
lambda attributes: dict([key_value_pair.split('=') for
ValueError: dictionary update sequence element #6 has length 1; 2 is required
This lambda is one of three in gffpandas. In my opinion, all 3 should be
refactored into map() or stand-alone functions. Lambdas are hard to read
and even harder to make defensive.
This failure is because a handful of features in this file end with a ";". Yes, this is a somewhat rare thing, but I also see it on some NCBI gffs. Like many ugly things in GFF-land, I don't know if it's strictly valid, but plenty of GFFs that pass GFF validators (e.g. the one in genometools) have them. There's an additional (even more rare) problem that somebody can put an equal sign into the feature string.
Here's a function that can be substituted for the lambda expression that fixes the problem:
def _split_atts(atts):
"""Split a feature string into attributes."""
splits_list = [a.split("=") for a in atts.split(";") if "=" in a]
return {l[0]:"=".join(l[1:]) for l in splits_list}
The text was updated successfully, but these errors were encountered:
Description
I got the following failure when I read
this GFF file:
This lambda is one of three in gffpandas. In my opinion, all 3 should be
refactored into map() or stand-alone functions. Lambdas are hard to read
and even harder to make defensive.
This failure is because a handful of features in this file end with a ";". Yes, this is a somewhat rare thing, but I also see it on some NCBI gffs. Like many ugly things in GFF-land, I don't know if it's strictly valid, but plenty of GFFs that pass GFF validators (e.g. the one in genometools) have them. There's an additional (even more rare) problem that somebody can put an equal sign into the feature string.
Here's a function that can be substituted for the lambda expression that fixes the problem:
The text was updated successfully, but these errors were encountered: