Skip to content

Commit

Permalink
Support reference bundles.
Browse files Browse the repository at this point in the history
  • Loading branch information
cmnbroad committed Aug 13, 2024
1 parent 59e8dae commit 27599cd
Show file tree
Hide file tree
Showing 7 changed files with 221 additions and 90 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ private StandardArgumentDefinitions(){}
public static final String INTERVALS_SHORT_NAME = "L";
public static final String COMPARISON_SHORT_NAME = "comp";
public static final String READ_INDEX_SHORT_NAME = READ_INDEX_LONG_NAME;
public static final String PRIMARY_INPUT_LONG_NAME = "primary";
public static final String PRIMARY_INPUT_SHORT_NAME = "PI";
public static final String SECONDARY_INPUT_LONG_NAME = "secondaryI";
public static final String SECONDARY_INPUT_SHORT_NAME = "SI";
public static final String PRIMARY_RESOURCE_LONG_NAME = "primary-resource";
public static final String PRIMARY_RESOURCE_SHORT_NAME = "PR";
public static final String SECONDARY_RESOURCE_LONG_NAME = "secondary-resource";
public static final String SECONDARY_RESOURCE_SHORT_NAME = "SR";
public static final String LENIENT_SHORT_NAME = "LE";
public static final String READ_VALIDATION_STRINGENCY_SHORT_NAME = "VS";
public static final String SAMPLE_ALIAS_SHORT_NAME = "ALIAS";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ public final class FeatureInput<T extends Feature> extends GATKPath implements S
private transient Class<FeatureCodec<T, ?>> featureCodecClass;

/**
* retain any containing bundle in case we need to extract other resources from it
* retain the parent (enclosing) bundle from which this feature input is derived, in case we need to extract
* other resources from it
*/
private Bundle parentBundle;

Expand Down Expand Up @@ -148,7 +149,7 @@ public FeatureInput(
final Bundle featureBundle,
final String name) {
super(primaryResourcePath);
// retain the containing bundle for later so we can interrogate it for other resources, like the index
// retain the enclosing bundle for later, so we can interrogate it for other resources such as the index
this.parentBundle = featureBundle;
if (name != null) {
if (primaryResourcePath.getTag() != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,17 @@ protected void initializeDrivingVariants() {
final List<Bundle> bundles = BundleJSON.toBundleList(IOUtils.getStringFromPath(gatkPath), GATKPath::new);
for (final Bundle bundle : bundles) {
if (bundle.getPrimaryContentType().equals(BundleResourceType.CT_VARIANT_CONTEXTS)) {
// use the bundle primary resource as the FeatureInput URI, and tear off and attach the
// individual bundle the bundle to the FI as the parent bundle so downstream code can
// extract other resources from it on demand
// note that if the original value from the user has a tag, we can't use it unless there
// is only one input, since FIs have to be unique
// use the bundle primary resource as the FeatureInput URI, and tear off and attach
// the enclosing bundle as the parent bundle for the FI so downstream code can extract
// other resources from it on demand. note that if the original value from the user has
// a tag, we can't propagate it unless there is only one input, since FIs have to be
// unique
final FeatureInput<VariantContext> bundleFI = new FeatureInput<>(
new GATKPath(bundle.getPrimaryResource().getIOPath().get().getURIString()),
bundle,
bundles.size() > 1 ? gatkPath.getTag() : "drivingVariants"
bundles.size() > 1 ?
gatkPath.getTag() :
"drivingVariants"
);
if (drivingVariantsFeatureInputs.contains(bundleFI)) {
throw new UserException.BadInput("Feature inputs must be unique: " + gatkPath);
Expand Down
Loading

0 comments on commit 27599cd

Please sign in to comment.