Open pnrobinson opened 6 years ago
Hm, what about renaming HpoFrequency
to HpoFrequencyName
and then create an interface hierarchy as below?
HpoNamedFrequency
-- only contains HpoFrequencyName
with the rough classification, functions for obtaining smallest/largest value in classHpoFractionalFrequency
-- adds a float for a describing the percentage/fractionHpoRatioFrequency
-- does not have the float but a numerator/denominatorDo you mean
interface Frequency {
float getLowerBound();
float getUpperBound();
float getFrequency();
}
with the above three classes implementing the interface? One difficulty is that only the enum has upper and lower bounds.
Currently, the function
public int lowerBound()
returns a percentage as an integer (e.g., 30 for 30%). This is not good because downstream code very probably would need to have the corresponding proportion (probability), i.e., 0.3. Also, we have frequency data such as 12/34 (for 12 of 34 patients in some study), and this would naturally be represented as a float or double.The current implementation of
fromPercent
results in an unnecessary loss of information.Therefore, I think that we need to make a new class. Currently,
HpoFrequency
is an enum. I would suggest we introduce a class calledFrequency
that would have something like thisI would also suggest that the
upper_limit
andlower_limit
functions inHpoFrequency
be revised to return floats. I am in the process of writing code for anHpoDisease
class that would parse the phenotype_annotation.tab file and use all of the frequency information, and this would be very useful. Please let me know if anything speaks against this solution. If not, I will implement it and make a PR.