Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Make metadata RE reluctant (stop on first = not last) #51

Merged
merged 1 commit into from

2 participants

@lennax

Thanks to @dzerbino for many fixes. The metadata hash added here: d928de1#L2R170
fixed mis-parsing contigs with internal =, but a UnifiedGenotyper metadata line isn't wrapped in angle brackets and is thus still parsed improperly.

This is a very simple tweak to the RE:

(.+)=(.+) will put everything up to the very last = in the first group because + is greedy by default.

(.+?)=(.+) makes the + reluctant, so only the first group of characters that are not =, aka the key, will be in the first group.

@jamescasbon jamescasbon merged commit 9e075dd into jamescasbon:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jun 16, 2012
  1. @lennax
This page is out of date. Refresh to see the latest.
Showing with 1 addition and 1 deletion.
  1. +1 −1  vcf/parser.py
View
2  vcf/parser.py
@@ -159,7 +159,7 @@ def __init__(self):
Type=(?P<type>.+),
Description="(?P<desc>.*)"
>''', re.VERBOSE)
- self.meta_pattern = re.compile(r'''##(?P<key>.+)=(?P<val>.+)''')
+ self.meta_pattern = re.compile(r'''##(?P<key>.+?)=(?P<val>.+)''')
def vcf_field_count(self, num_str):
if num_str == '.':
Something went wrong with that request. Please try again.