T - The type to use when creating a ReadsBundle new IOPathResources for a ReadsBundle.
Note that resources that are put into a ReadsBundle using the {ReadsBundle(Collection)}
constructor may have tIOPathResources that do not conform to this type.public class ReadsBundle<T extends IOPath> extends Bundle implements java.io.Serializable
Bundle specifically for reads and reads-related resources. A ReadsBundle has a
primary resource with content type BundleResourceType.ALIGNED_READS; and an optional index
resource. ReadsBundles can also contain other resources.
ReadsBundle is primarily a convenience layer for the common case where a Bundle
contains reads and related resources backed by IOPathResources. It provides convenient
constructors, and validation for JSON interconversions. For reads sources that are backed by streams or
other BundleResource types, the Bundle and BundleBuilder classes can be used
directly.| Modifier | Constructor and Description |
|---|---|
protected |
ReadsBundle(java.util.Collection<BundleResource> resources)
Create a
ReadsBundle using the resources in an existing bundle. |
|
ReadsBundle(T reads)
Create a
ReadsBundle containing only a reads resource. |
|
ReadsBundle(T reads,
T index)
Create a
ReadsBundle containing only reads and an index. |
| Modifier and Type | Method and Description |
|---|---|
java.util.Optional<BundleResource> |
getIndex()
Get the optional
BundleResourceType.READS_INDEX resource for this ReadsBundle. |
BundleResource |
getReads()
|
static ReadsBundle<IOPath> |
getReadsBundleFromPath(IOPath jsonPath)
Create a
ReadsBundle from a JSON string contained in jsonPath. |
static ReadsBundle<IOPath> |
getReadsBundleFromString(java.lang.String jsonString)
Create a
ReadsBundle from a JSON string. |
static <T extends IOPath> |
getReadsBundleFromString(java.lang.String jsonString,
java.util.function.Function<java.lang.String,T> ioPathConstructor)
Create a
ReadsBundle from a JSON string with all IOPathResources using an IOPath-derived
class of type T. |
static boolean |
looksLikeAReadsBundle(IOPath rawReadPath) |
static ReadsBundle<IOPath> |
resolveIndex(IOPath reads)
Find the companion index for a reads source, and create a new
ReadsBundle containing the
reads and the companion index, if one can be found. |
static <T extends IOPath> |
resolveIndex(T reads,
java.util.function.Function<java.lang.String,T> ioPathConstructor)
Find the companion index for a reads source, and create a new
ReadsBundle containing the
reads and the companion index, if one can be found. |
equals, get, getOrThrow, getPrimaryContentType, getPrimaryResource, getResources, hashCode, iterator, toStringpublic ReadsBundle(T reads)
ReadsBundle containing only a reads resource.reads - An IOPath-derived object that represents a source of reads.public ReadsBundle(T reads, T index)
ReadsBundle containing only reads and an index.reads - An IOPath-derived object that represents a source of reads.protected ReadsBundle(java.util.Collection<BundleResource> resources)
ReadsBundle using the resources in an existing bundle. A resource with content type
BundleResourceType.ALIGNED_READS must be present in the resources, or this constructor will throw.
Note that this constructor allows existing IOPathResources that do not conform to the type
T to be included in the resulting ReadsBundle.resources - collection of BundleResource. the collection must include a resource with
content type BundleResourceType.ALIGNED_READS.java.lang.IllegalArgumentException - if no resource with content type BundleResourceType.ALIGNED_READS is
included in the input BundleResource collectionpublic BundleResource getReads()
BundleResourceType.ALIGNED_READS BundleResource for this ReadsBundlepublic java.util.Optional<BundleResource> getIndex()
BundleResourceType.READS_INDEX resource for this ReadsBundle.BundleResourceType.READS_INDEX resrouce for this ReadsBundle,
or Optional.empty if no index resource is present in the bundle.public static ReadsBundle<IOPath> getReadsBundleFromPath(IOPath jsonPath)
ReadsBundle from a JSON string contained in jsonPath.jsonPath - the path to a file that contains Bundle serialized to JSON. The bundle
must contain a resource with content type READS.ReadsBundle created from jsonPathpublic static ReadsBundle<IOPath> getReadsBundleFromString(java.lang.String jsonString)
ReadsBundle from a JSON string.jsonString - the jsonString to use to create the ReadsBundleReadsBundlepublic static <T extends IOPath> ReadsBundle<T> getReadsBundleFromString(java.lang.String jsonString, java.util.function.Function<java.lang.String,T> ioPathConstructor)
ReadsBundle from a JSON string with all IOPathResources using an IOPath-derived
class of type T.T - the type ofjsonString - the string to use to create the ReadsBundleioPathConstructor - a function that takes a string and returns an IOPath-derived class of type TReadsBundlepublic static ReadsBundle<IOPath> resolveIndex(IOPath reads)
ReadsBundle containing the
reads and the companion index, if one can be found.reads - the reads source to useReadsBundle containing reads and companion index, if it can be foundpublic static <T extends IOPath> ReadsBundle<T> resolveIndex(T reads, java.util.function.Function<java.lang.String,T> ioPathConstructor)
ReadsBundle containing the
reads and the companion index, if one can be found.
An index can only be resolved for an IOPath that represents on a file system for which an NIO
provider is installed. Remote paths that use a protocol scheme for which no NIO file system is
available will (silently) not be resolved.T - the IOPath-derived type of the IOPathResources in the new bundlereads - the reads source to useioPathConstructor - a function that takes a string and returns an IOPath-derived class of type ReadsBundle containing reads and companion index, if it can be foundpublic static boolean looksLikeAReadsBundle(IOPath rawReadPath)