Skip to content

Commit

Permalink
More review comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
cmnbroad committed Jun 11, 2024
1 parent 4bf7ddf commit 2c9878f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 15 deletions.
7 changes: 3 additions & 4 deletions src/main/java/htsjdk/beta/io/bundle/BundleResourceType.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
import htsjdk.beta.plugin.variants.VariantsFormats;

/**
* Constants for specifying tandard primary content types, secondary content types, and (optional) formats
* for resources contained in a {@link Bundle}.
* Constants for specifying standard content types and formats for resources contained in a {@link Bundle}.
*
* Bundles generally contain one primary resource, plus one or more secondary resources such as an index or md5 file.
* Each resource has an associated content type, and optionally a format. The bundle itself has a primary content
Expand All @@ -17,8 +16,8 @@
* correspond to one of the enum values in {@link htsjdk.beta.plugin.HtsContentType}, since each of these has a
* corresponding {@link htsjdk.beta.plugin.HtsCodec} that handles that type of resource, such as reads or variants.
*
* Secondary resources can also be any string, but the standard secondary content types are defined here, i.e., for
* primary content type "READS", a secondary content type might be "READS_INDEX".
* Secondary resource content types can also be any string, but the standard secondary content types are defined
* here, i.e., for primary content type "READS", a secondary content type might be "READS_INDEX".
*
* Finally, each resource in a bundle can have an optional format, which is a string that corresponds to the format
* for that resource. For example, a primary content type of "READS" might have a format of "BAM".
Expand Down
14 changes: 3 additions & 11 deletions src/main/java/htsjdk/beta/plugin/reads/ReadsBundle.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,7 @@ public class ReadsBundle<T extends IOPath> extends Bundle implements Serializabl
* @param reads An {@link IOPath}-derived object that represents a source of reads.
*/
public ReadsBundle(final T reads) {
this(Arrays.asList(toInputResource(
BundleResourceType.CT_ALIGNED_READS,
ValidationUtils.nonNull(reads, BundleResourceType.CT_ALIGNED_READS))));
this(Arrays.asList(toInputResource(BundleResourceType.CT_ALIGNED_READS, reads)));
}

/**
Expand All @@ -59,10 +57,8 @@ public ReadsBundle(final T reads) {
*/
public ReadsBundle(final T reads, final T index) {
this(Arrays.asList(
toInputResource(BundleResourceType.CT_ALIGNED_READS, ValidationUtils.nonNull(reads, BundleResourceType.CT_ALIGNED_READS)),
toInputResource(
BundleResourceType.CT_READS_INDEX,
ValidationUtils.nonNull(index, BundleResourceType.CT_READS_INDEX))));
toInputResource(BundleResourceType.CT_ALIGNED_READS, reads),
toInputResource(BundleResourceType.CT_READS_INDEX, index)));
}

/**
Expand Down Expand Up @@ -174,10 +170,6 @@ public static <T extends IOPath> ReadsBundle<T> resolveIndex(
return new ReadsBundle<>(reads);
}

public static boolean looksLikeAReadsBundle(final IOPath rawReadPath) {
return rawReadPath.getURI().getPath().endsWith(BundleJSON.BUNDLE_EXTENSION);
}

private static <T extends IOPath> IOPathResource toInputResource(final String providedContentType, final T ioPath) {
ValidationUtils.nonNull(ioPath, "ioPath");
final Optional<Tuple<String, String>> typePair = getInferredContentTypes(ioPath);
Expand Down

0 comments on commit 2c9878f

Please sign in to comment.