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
Could I get some information on why trying to instantiate a VariantRecord like v = VariantRecord() results in TypeError: this class cannot be instantiated from Python? Is this a design choice or something inherently unavoidable?
I'm asking because I'm working on a suite of tools to generate fake data for testing bioinformatics functions/packages/tools - scaling up something I've been doing for individual projects - and it would be really useful to be able to generate VariantRecord objects for this purpose. At the moment, if I am to test a function in this way, I have write the fuction such that any call unwraps the data I require from the VariantRecord object rather than using the object directly. This isn't hugely convenient for a variety of reasons. I can do hacky workarounds via creating temp files and so on, but again, not ideal. Perhaps I've missed something obvious though.
As always, thanks for your work on pysam
The text was updated successfully, but these errors were encountered:
blex-max
changed the title
Request for information on VariantRecord instatiation
Request for information on VariantRecord instantiation
Oct 14, 2024
I have found that the best way to get a VariantRecord object is by first creating a VariantHeader and then using header.new_record(...).
The source code indicates that this method is liable to changes but I have found it stable and reliable so far. (Albeit you have to dig a bit to work out how to do some things occasionally)
@awgymer thanks, this is a good start, I appreciate the help. However, it's not immediately obvious to me how having generated a new record I then access that record as a VariantRecord object. Could you point me in the right direction? Figured it out, you assign the result of .new_record() - I assumed it was an in place operation. I'm still keen to get more insight on this from the devs!
Hello,
Could I get some information on why trying to instantiate a VariantRecord like
v = VariantRecord()
results inTypeError: this class cannot be instantiated from Python
? Is this a design choice or something inherently unavoidable?I'm asking because I'm working on a suite of tools to generate fake data for testing bioinformatics functions/packages/tools - scaling up something I've been doing for individual projects - and it would be really useful to be able to generate VariantRecord objects for this purpose. At the moment, if I am to test a function in this way, I have write the fuction such that any call unwraps the data I require from the VariantRecord object rather than using the object directly. This isn't hugely convenient for a variety of reasons. I can do hacky workarounds via creating temp files and so on, but again, not ideal. Perhaps I've missed something obvious though.
As always, thanks for your work on pysam
The text was updated successfully, but these errors were encountered: