Repository navigation
calculateRatio fails when feature_name = intensity and there is no IS - #3272
Conversation
| const double feature_1 = component_1.getIntensity(); | ||
| ratio = feature_1; | ||
| } | ||
| else if (component_1.metaValueExists(feature_name) && component_2.metaValueExists(feature_name)) |
There was a problem hiding this comment.
these cases are bit difficult to follow.
Does this also cover the case were feature="intensity"? Then I think it would be wrong to request the metaValue("intensity")
There was a problem hiding this comment.
Essentially some feature_names are stored as metaValues and others are given members in the Feature class. Specifically, I am trying to cover the case where one wants to quantify or filter based on peak area (i.e., "intensity") which is accessed via getIntensity() or peak height which is accessed by getMetaValue("peak_apex"int) for both the case where the first and second component exists or where the first component exists but the second does not.
There was a problem hiding this comment.
Ok that's how I understood it. But this will e.g. fail if feature_name = intensity but no native_id meta value exists, right?
Then else if (component_1.metaValueExists(feature_name)) will be called with feature_name = intensity which will result in an error.
I think it would be better to distinguish two cases:
if (feature_name == "intensity")
{ // access member
}
else // feature name refers to meta value
{ // access meta values
}
and put the corresponding code in that parts.
There was a problem hiding this comment.
If there is no metavalue called "native_id" it will fail. I am testing to see if the feature is actually populated with values. Is there a way you would recommend testing to see if the feature has an intensity value? That would avoid the need to test for the "native_id".
There was a problem hiding this comment.
Intensity is initialized to 0. Guess you could error out if this is zero and feature_name = intensity
| double feature_2 = component_2.getMetaValue(feature_name); | ||
| ratio = feature_1/feature_2; | ||
| } | ||
| else if (component_1.metaValueExists(feature_name)) |
There was a problem hiding this comment.
same here... what if feature_name is "intensity"
|
thanks! now it's easier to read |
Fix