jamescasbon/PyVCF — pull request #48 by dzerbino (2012-06-12 18:46:31+00:00)
Title: Alt classes

Hello James,

It occurred to me that the changes I made to your code work well if you are simply parsing/editing/re-printing VCF records, but not very handy for actually generating files.

I have therefore re-cast the _AltRecord as a standalone object (no more subclassing str) and defined a proper tree of subclasses (Substitution, SV, SingleBreakend, PairedBreakend). This is far cleaner code wise, but means that you can no longer compare allele call to a string as in:

alt == "A"

but you would need to use its members, as in:

alt.type == "SNV" and alt.sequence == "A"

which is a bit heavier.

Anyways, this is simply a proposition, let me know what you think.

Regards,

Daniel