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
Classes in the data module are instantiated with a single parameter: fname for the name of the file containing the data. This seemed like a good idea at first, since most of the classes in the data module were just reading data instead of writing it.
But we're starting to get to the point where we're writing a lot of files now. Unfortunately, the current design of requiring only an fname to instantiate means that, when a function requires a Data instance as input, the function can't really be confident that the data in that object has been loaded.
Proposal
I propose a simple redesign where instead of requiring fname as a parameter to Data.__init__(), we require the data property, itself, as input. Then, we make fname a parameter of the read() and write() methods. The read() method would become a class method and it would return an instance, itself.
Since this would be a breaking change, we should probably implement it sooner rather than later.
Challenges
How would we pass the log instance to the read() function if the read() function became a class method? It would probably have to be a parameter.
The text was updated successfully, but these errors were encountered:
I'm gonna close this for now. I liked the idea initially, but I'm not sure it would make sense for the GenotypesPLINK class, which has read_samples() and read_variants() methods that only partially load the data in the class
Background
Classes in the data module are instantiated with a single parameter:
fname
for the name of the file containing the data. This seemed like a good idea at first, since most of the classes in the data module were just reading data instead of writing it.But we're starting to get to the point where we're writing a lot of files now. Unfortunately, the current design of requiring only an
fname
to instantiate means that, when a function requires a Data instance as input, the function can't really be confident that the data in that object has been loaded.Proposal
I propose a simple redesign where instead of requiring
fname
as a parameter toData.__init__()
, we require thedata
property, itself, as input. Then, we makefname
a parameter of theread()
andwrite()
methods. Theread()
method would become a class method and it would return an instance, itself.Since this would be a breaking change, we should probably implement it sooner rather than later.
Challenges
How would we pass the log instance to the
read()
function if theread()
function became a class method? It would probably have to be a parameter.The text was updated successfully, but these errors were encountered: