Skip to content

Commit

Permalink
Merge pull request #949 from broadinstitute/ct-featuretable-solo-qual…
Browse files Browse the repository at this point in the history
…ifier-key

handle feature qualifiers that consist of only a key
  • Loading branch information
tomkinsc committed May 10, 2019
2 parents 0a5c737 + 95a824e commit a36a3d9
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions util/feature_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@ def __init__(self, qualifier_key, qualifier_value):
self.qualifier_value = qualifier_value

def __str__(self):
return "\t\t\t{k}\t{v}".format(k=self.qualifier_key,v=self.qualifier_value)
if self.qualifier_value:
return "\t\t\t{k}\t{v}".format(k=self.qualifier_key,v=self.qualifier_value)
else:
return "\t\t\t{k}".format(k=self.qualifier_key)

class SeqLocation(object):
def __init__(self, start_pos, end_pos, feature_type=None):
Expand Down Expand Up @@ -143,7 +146,7 @@ def __init__(self, filepath=None, valid_feature_types=None):
"feature_first_location_line" : re.compile(r"^(?P<location_operator_start>[<>])?(?P<start>\d+)\t(?P<location_operator_end>[<>])?(?P<end>\d+)\t(?P<feature_type>" + "|".join(self.valid_feature_types) + ")$"),
"feature_subsequent_location_line" : re.compile(r"^(?P<location_operator_start>[<>])?(?P<start>\d+)\t(?P<location_operator_end>[<>])?(?P<end>\d+)\t*$"),
"offset_line" : re.compile(r"^(?:\[offset=(?P<offset>-?\d+)\])$"),
"feature_qualifier_line" : re.compile(r"^\t{3}(?P<qualifier_key>.*)\t(?P<qualifier_value>[^\t]*)$")
"feature_qualifier_line" : re.compile(r"^\t{3}(?P<qualifier_key>[^\t]*)(?:\t(?P<qualifier_value>[^\t]*))?$")
}

if filepath:
Expand Down

0 comments on commit a36a3d9

Please sign in to comment.