Package picard.nio

Class PicardBucketUtils

java.lang.Object
picard.nio.PicardBucketUtils

public class PicardBucketUtils extends Object
Derived from BucketUtils.java in GATK
  • Field Details

  • Method Details

    • getTempFilePath

      public static PicardHtsPath getTempFilePath(String directory, String prefix, String extension)
      Get a temporary file path based on the prefix and extension provided. This file (and possible indexes associated with it) will be scheduled for deletion on shutdown.
      Parameters:
      directory - the directory where the temporary fill will be placed. May be null. For remote paths this should be a valid URI to root the temporary file in (e.g. gs://hellbender/staging/) If the directory is not a GCS or hadoop URL (or if it is null), the resulting temp file will be placed in the local tmp folder.
      prefix - the prefix to prepend before the randomly generated characters. Must have length >= 3 for local temp files.
      extension - an extension for the temporary file path. Must start with a period e.g. ".txt"
      Returns:
      a new temporary path of the form [directory]/[prefix][random chars][.extension]
    • getTempFilePath

      public static PicardHtsPath getTempFilePath(htsjdk.io.IOPath directory, String prefix, String extension)
      This overload of getTempFilePath takes the directory of type PicardHtsPath instead of String.
      See Also:
    • getTempFilePath

      public static PicardHtsPath getTempFilePath(String directory, String extension)
      Calls getTempFilePath with the empty string as the prefix.
      See Also:
    • getLocalTempFilePath

      public static PicardHtsPath getLocalTempFilePath(String prefix, String extension)
      Creates a temporary file in a local directory.
      See Also:
    • getRandomGCSDirectory

      public static PicardHtsPath getRandomGCSDirectory(String relativePath)
      Creates a PicardHtsPath object to a "directory" on a Google Cloud System filesystem with a randomly generated URI. Note that the notion of directories does not exist in GCS. Thus, by "directory," we mean a path object with a randomly generated URI ending in "/", which the caller can use as a root URI/path for other files to be created e.g. via PicardHtsPath::resolve. Note that this method does *not* create an actual directory/file on GCS that one can write to, delete, or otherwise manipulate. See: https://stackoverflow.com/questions/51892343/google-gsutil-create-folder
      Parameters:
      relativePath - The relative location for the new "directory" under the harcoded staging bucket with a TTL set e.g. "test/RevertSam/".
      Returns:
      A PicardHtsPath object to a randomly generated "directory" e.g. "gs://hellbender-test-logs/staging/picard/test/RevertSam/{randomly-generated-string}/"
    • randomRemotePath

      public static Path randomRemotePath(String stagingLocation, String prefix, String suffix)
      Picks a random name, by putting some random letters between "prefix" and "suffix".
      Parameters:
      stagingLocation - The folder where you want the file to be. Must start with "gs://" or "hdfs://"
      prefix - The beginning of the file name
      suffix - The end of the file name, e.g. ".tmp"
    • isGcsUrl

      public static boolean isGcsUrl(htsjdk.io.IOPath pathSpec)
      Return true if this PicardHTSPath represents a gcs URI.
      Parameters:
      pathSpec - specifier to inspect
      Returns:
      true if this PicardHTSPath represents a gcs URI.
    • isEligibleForPrefetching

      public static boolean isEligibleForPrefetching(htsjdk.io.IOPath pathSpec)
      Parameters:
      pathSpec - specifier to inspect
      Returns:
      true if this GATKPath represents a remote storage system which may benefit from prefetching (gcs or http(s))
    • isEligibleForPrefetching

      public static boolean isEligibleForPrefetching(Path path)
      Parameters:
      path - path to inspect
      Returns:
      true if this Path represents a remote storage system which may benefit from prefetching (gcs or http(s))