-
Notifications
You must be signed in to change notification settings - Fork 594
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Now non-locatable data sources can create funcotations again. #5774
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -135,6 +135,12 @@ public String getVersion() { | |
return version; | ||
} | ||
|
||
/** | ||
* @return {@code True} if this {@link DataSourceFuncotationFactory} requires features to create {@link Funcotation}s. {@code False} otherwise. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Any features? Or specific types? Please update docs. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes - any features. If the DataSourceFuncotationFactory relies on feature matching that the GATK engine provides, then this should be true. Things that don't require features (like gene name matching data sources) don't require any features to be present to create a funcotation. |
||
*/ | ||
@VisibleForTesting | ||
public boolean requiresFeatures() { return true; } | ||
|
||
/** | ||
* @return An ordered {@link LinkedHashSet} of the names of annotations that this Data Source supports. | ||
*/ | ||
|
@@ -169,10 +175,20 @@ public List<Funcotation> createFuncotations(final VariantContext variant, final | |
Utils.nonNull(referenceContext); | ||
Utils.nonNull(featureContext); | ||
|
||
final List<Funcotation> outputFuncotations; | ||
|
||
// Query this funcotation factory to get the list of overlapping features. | ||
final List<Feature> featureList = queryFeaturesFromFeatureContext(featureContext); | ||
// NOTE: This will only get features that are LOCATABLE! | ||
// This corresponds to requiresFeatures() returning `True`. | ||
final List<Feature> featureList; | ||
|
||
final List<Funcotation> outputFuncotations; | ||
// Only get features if we need them: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you collapse to one line? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure. |
||
if ( requiresFeatures() ) { | ||
featureList = queryFeaturesFromFeatureContext(featureContext); | ||
} | ||
else { | ||
featureList = Collections.emptyList(); | ||
} | ||
|
||
// If our featureList is compatible with this DataSourceFuncotationFactory, then we make our funcotations: | ||
if ( isFeatureListCompatible(featureList) ) { | ||
|
@@ -203,12 +219,22 @@ public List<Funcotation> createFuncotations(final VariantContext variant, final | |
* Checks to see if the given featureList is compatible with this {@link DataSourceFuncotationFactory}. | ||
* Cues off of the feature type in the feature list and whether the given list contains any non-null features. | ||
* This method acts as a sanity-check before attempting to do any annotations on features. | ||
* If this {@link DataSourceFuncotationFactory} does not require features as per {@link #requiresFeatures()}, then | ||
* this method will always return {@code True}. | ||
* @param featureList {@link List} of {@link Feature} that might be applicable to this {@link DataSourceFuncotationFactory} for annotation. | ||
* @return {@code true} if the given {@code featureList} contains at least one non-null feature of type {@link #getAnnotationFeatureClass()}; {@code false} otherwise. | ||
*/ | ||
private boolean isFeatureListCompatible(final List<Feature> featureList) { | ||
// Make sure these features can be annotated by this DataSourceFuncotationFactory: | ||
// Make sure these features can be annotated by this DataSourceFuncotationFactory. | ||
// NOTE: We only check the first non-null element of the list for feature type: | ||
|
||
// The feature list is compatible if we found a compatible feature | ||
// OR | ||
// if this DataSourceFuncotationFactory does not require features. | ||
if ( !requiresFeatures() ) { | ||
return true; | ||
} | ||
|
||
boolean foundCompatibleFeature = false; | ||
for ( final Feature f : featureList ) { | ||
if (f != null) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure why this is needed. What is this stuff?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left over from testing. I'll remove.