Modifications to have Writer output match Reader input #55

Merged
merged 1 commit into from Jun 26, 2012

Projects

None yet

3 participants

cmclean commented Jun 25, 2012

The following are small changes to make vcf Writer output more consistent with common VCF input files.

Modify Writer to output FILTER field properly:

  • Writes as ";"-delimited string rather than the Python list representation
  • Writes non-existent or "PASS" filters as "PASS" rather than "."

Modify Writer to output INFO field properly:

  • Writes Flag outputs just as present, not using the X=Y format
  • E.g. the DB flag to indicate presence in dbSNP will be written as "DB", rather than as "DB=True"

Modify Writer to allow different line terminator to be used:

  • Default remains "\r\n" for backward compatibility
@cmclean cmclean Modify Writer to output FILTER field properly for multiple filters:
  * Writes as ";"-delimited string rather than the Python list representation
  * Writes non-existent or "PASS" filters as "PASS" rather than "."

Modify Writer to output INFO field properly:
  * Writes Flag outputs just as present, not using the X=Y format
  * E.g. the DB flag to indicate presence in dbSNP will be written as "DB", rather than as "DB=True"

Modify Writer to allow different line terminator to be used:
  * Default remains "\r\n" for backward compatibility
a23c749
lennax commented Jun 26, 2012

Great to see fixes for things I've noticed!

@lennax lennax commented on the diff Jun 26, 2012
vcf/parser.py
return str(x) if x is not None else none
+ def _stringify_pair(self, x, y, none='.', delim=','):
+ if isinstance(y, bool):
lennax
lennax Jun 26, 2012

A manually constructed object with, for example, DB=False, would have unexpected output. Adding "if y" would avoid that.

Owner

Thanks! @lennax Can you submit that fix as a PR?

lennax commented Jun 26, 2012

This PR would have to be merged for me to submit that fix.

@jamescasbon jamescasbon reopened this Jun 26, 2012
@jamescasbon jamescasbon merged commit 6416532 into jamescasbon:master Jun 26, 2012
Owner

@lennax Oops! I hit close PR instead of merge. Should be done now.

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