Package picard.nio
Class PicardBucketUtils
java.lang.Object
picard.nio.PicardBucketUtils
Derived from BucketUtils.java in GATK
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic PicardHtsPath
getLocalTempFilePath
(String prefix, String extension) Creates a temporary file in a local directory.static PicardHtsPath
getRandomGCSDirectory
(String relativePath) Creates a PicardHtsPath object to a "directory" on a Google Cloud System filesystem with a randomly generated URI.static PicardHtsPath
getTempFilePath
(htsjdk.io.IOPath directory, String prefix, String extension) This overload of getTempFilePath takes the directory of type PicardHtsPath instead of String.static PicardHtsPath
getTempFilePath
(String directory, String extension) Calls getTempFilePath with the empty string as the prefix.static PicardHtsPath
getTempFilePath
(String directory, String prefix, String extension) Get a temporary file path based on the prefix and extension provided.static boolean
isEligibleForPrefetching
(htsjdk.io.IOPath pathSpec) static boolean
isEligibleForPrefetching
(Path path) static boolean
isGcsUrl
(htsjdk.io.IOPath pathSpec) Return true if thisPicardHTSPath
represents a gcs URI.static Path
randomRemotePath
(String stagingLocation, String prefix, String suffix) Picks a random name, by putting some random letters between "prefix" and "suffix".
-
Field Details
-
GOOGLE_CLOUD_STORAGE_FILESYSTEM_SCHEME
- See Also:
-
HTTP_FILESYSTEM_PROVIDER_SCHEME
- See Also:
-
HTTPS_FILESYSTEM_PROVIDER_SCHEME
- See Also:
-
HDFS_SCHEME
- See Also:
-
FILE_SCHEME
- See Also:
-
GCLOUD_PICARD_STAGING_DIRECTORY
- See Also:
-
-
Method Details
-
getTempFilePath
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
Calls getTempFilePath with the empty string as the prefix.- See Also:
-
getLocalTempFilePath
Creates a temporary file in a local directory.- See Also:
-
getRandomGCSDirectory
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
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 namesuffix
- The end of the file name, e.g. ".tmp"
-
isGcsUrl
public static boolean isGcsUrl(htsjdk.io.IOPath pathSpec) Return true if thisPicardHTSPath
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
- Parameters:
path
- path to inspect- Returns:
- true if this
Path
represents a remote storage system which may benefit from prefetching (gcs or http(s))
-