Class ReadsBundle<T extends IOPath>

java.lang.Object
htsjdk.beta.io.bundle.Bundle
htsjdk.beta.plugin.reads.ReadsBundle<T>
Type Parameters:
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.
All Implemented Interfaces:
Serializable, Iterable<BundleResource>

public class ReadsBundle<T extends IOPath> extends Bundle implements Serializable
A 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.
See Also:
  • Constructor Details

  • Method Details

    • getReads

      public BundleResource getReads()
      Returns:
      the BundleResourceType.ALIGNED_READS BundleResource for this ReadsBundle
    • getIndex

      public Optional<BundleResource> getIndex()
      Get the optional BundleResourceType.READS_INDEX resource for this ReadsBundle.
      Returns:
      the optional BundleResourceType.READS_INDEX resrouce for this ReadsBundle, or Optional.empty if no index resource is present in the bundle.
    • getReadsBundleFromPath

      public static ReadsBundle<IOPath> getReadsBundleFromPath(IOPath jsonPath)
      Create a ReadsBundle from a JSON string contained in jsonPath.
      Parameters:
      jsonPath - the path to a file that contains Bundle serialized to JSON. The bundle must contain a resource with content type READS.
      Returns:
      a ReadsBundle created from jsonPath
    • getReadsBundleFromString

      public static ReadsBundle<IOPath> getReadsBundleFromString(String jsonString)
      Create a ReadsBundle from a JSON string.
      Parameters:
      jsonString - the jsonString to use to create the ReadsBundle
      Returns:
      a ReadsBundle
    • getReadsBundleFromString

      public static <T extends IOPath> ReadsBundle<T> getReadsBundleFromString(String jsonString, Function<String,T> ioPathConstructor)
      Create a ReadsBundle from a JSON string with all IOPathResources using an IOPath-derived class of type T.
      Type Parameters:
      T - the type of
      Parameters:
      jsonString - the string to use to create the ReadsBundle
      ioPathConstructor - a function that takes a string and returns an IOPath-derived class of type T
      Returns:
      a newly created ReadsBundle
    • resolveIndex

      public 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.
      Parameters:
      reads - the reads source to use
      Returns:
      a ReadsBundle containing reads and companion index, if it can be found
    • resolveIndex

      public static <T extends IOPath> ReadsBundle<T> resolveIndex(T reads, Function<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. 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.
      Type Parameters:
      T - the IOPath-derived type of the IOPathResources in the new bundle
      Parameters:
      reads - the reads source to use
      ioPathConstructor - a function that takes a string and returns an IOPath-derived class of type
      Returns:
      a ReadsBundle containing reads and companion index, if it can be found
    • looksLikeAReadsBundle

      public static boolean looksLikeAReadsBundle(IOPath rawReadPath)