Class PicardHtsPath
java.lang.Object
htsjdk.io.HtsPath
picard.nio.PicardHtsPath
- All Implemented Interfaces:
htsjdk.io.IOPath, Serializable
public class PicardHtsPath
extends htsjdk.io.HtsPath
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionPicardHtsPath(htsjdk.io.HtsPath htsPath) Create a PicardHtsPath from an existingHtsPathor subclass.PicardHtsPath(File file) Create a PicardHtsPath from aFilereference.PicardHtsPath(String rawInputString) Create a PicardHtsPath from a raw input path string. -
Method Summary
Modifier and TypeMethodDescriptionstatic PicardHtsPathConstruct aPicardHtsPathfrom aPathstatic List<PicardHtsPath> fromPaths(Collection<String> paths) Create aList<PicardHtsPath>from path representations.static booleanisOther(htsjdk.io.IOPath ioPath) Test ifioPathis something other than a regular file, directory, or symbolic link.static PicardHtsPathreplaceExtension(htsjdk.io.IOPath path, String newExtension, boolean append) Takes an IOPath and returns a new PicardHtsPath object that keeps the same basename as the original but has a new extension.static PicardHtsPathresolve(PicardHtsPath absPath, String relativePath) Wrapper for Path.resolve()toPath()Resolve the URI of this object to aPathobject.toPaths(Collection<PicardHtsPath> picardHtsPaths) Create aList<Path>fromPicardHtsPathsMethods inherited from class htsjdk.io.HtsPath
equals, getCachedPath, getInputStream, getOutputStream, getRawInputString, getToPathFailureReason, getURI, getURIString, hasFileSystemProvider, hashCode, isPath, setCachedPath, toStringMethods inherited from interface htsjdk.io.IOPath
getBaseName, getExtension, getScheme, hasExtension, isBam, isCram, isFasta, isSam
-
Constructor Details
-
PicardHtsPath
Create a PicardHtsPath from a raw input path string.If the raw input string already contains a scheme (including a "file" scheme), assume its already properly escape/encoded. If no scheme component is present, assume it references a raw path on the local file system, so try to get a Path first, and then retrieve the URI from the resulting Path. This ensures that input strings that are local file references without a scheme component and contain embedded characters are valid in file names, but which would otherwise be interpreted as excluded URI characters (such as the URI fragment delimiter "#") are properly escape/encoded.
- Parameters:
rawInputString- a string specifying an input path. May not be null.
-
PicardHtsPath
public PicardHtsPath(htsjdk.io.HtsPath htsPath) Create a PicardHtsPath from an existingHtsPathor subclass.- Parameters:
htsPath- an existing PathSpecifier. May not be null.
-
PicardHtsPath
-
-
Method Details
-
fromPaths
Create aList<PicardHtsPath>from path representations.- Parameters:
paths- URIs or local paths. May not be null but may be empty.- Returns:
- the converted
List
-
toPath
Resolve the URI of this object to aPathobject.- Specified by:
toPathin interfacehtsjdk.io.IOPath- Overrides:
toPathin classhtsjdk.io.HtsPath- Returns:
- the resulting
Path - Throws:
RuntimeException- if an I/O error occurs when creating the file system
-
fromPath
Construct aPicardHtsPathfrom aPath- Parameters:
path- may NOT be null- Returns:
- a new object representing path
-
isOther
public static boolean isOther(htsjdk.io.IOPath ioPath) Test ifioPathis something other than a regular file, directory, or symbolic link.- Returns:
trueif it's a device, named pipe, htsget API URL, etc.- Throws:
RuntimeException- if an I/O error occurs when creating the file system
-
toPaths
Create aList<Path>fromPicardHtsPaths- Parameters:
picardHtsPaths- may NOT be null- Returns:
- Path representations of the input picardHtsPaths
-
replaceExtension
public static PicardHtsPath replaceExtension(htsjdk.io.IOPath path, String newExtension, boolean append) Takes an IOPath and returns a new PicardHtsPath object that keeps the same basename as the original but has a new extension. If append is set to false, only the last component of an extension will be replaced. e.g. "my.fasta.gz" -> "my.fasta.tmp" If the input IOPath was created from a rawInputString that specifies a relative local path, the new path will have a rawInputString that specifies an absolute path. (This perhaps unwanted conversion occurs when we call PicardHtsPath.toPath().) Examples: - (test_na12878.bam, .bai) -> test_na12878.bai (append = false) - (test_na12878.bam, .md5) -> test_na12878.bam.md5 (append = true)- Parameters:
path- The original pathnewExtension- A new file extension. Must include the leading dot e.g. ".txt", ".bam"append- If set to true, append the new extension to the original basename. If false, replace the original extension with the new extension. If append = false and the original name has no extension, an exception will be thrown.- Returns:
- A new PicardHtsPath object with the new extension
-
resolve
Wrapper for Path.resolve()
-