public class ReferenceSequenceFileFactory
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.util.Set<java.lang.String> |
FASTA_EXTENSIONS
Deprecated.
since June 2019 Use
FileExtensions.FASTA instead. |
static java.lang.String |
FASTA_INDEX_EXTENSION
Deprecated.
since June 2019 Use
FileExtensions.FASTA_INDEX instead. |
Constructor and Description |
---|
ReferenceSequenceFileFactory() |
Modifier and Type | Method and Description |
---|---|
static boolean |
canCreateIndexedFastaReader(java.nio.file.Path fastaFile)
Checks if the provided FASTA file can be open as indexed.
|
static java.io.File |
getDefaultDictionaryForReferenceSequence(java.io.File file)
Returns the default dictionary name for a FASTA file.
|
static java.nio.file.Path |
getDefaultDictionaryForReferenceSequence(java.nio.file.Path path)
Returns the default dictionary name for a FASTA file.
|
static java.lang.String |
getFastaExtension(java.nio.file.Path path)
Returns the FASTA extension for the path.
|
static java.nio.file.Path |
getFastaIndexFileName(java.nio.file.Path fastaFile)
Returns the index name for a FASTA file.
|
static ReferenceSequenceFile |
getReferenceSequenceFile(java.io.File file)
Attempts to determine the type of the reference file and return an instance
of ReferenceSequenceFile that is appropriate to read it.
|
static ReferenceSequenceFile |
getReferenceSequenceFile(java.io.File file,
boolean truncateNamesAtWhitespace)
Attempts to determine the type of the reference file and return an instance
of ReferenceSequenceFile that is appropriate to read it.
|
static ReferenceSequenceFile |
getReferenceSequenceFile(java.io.File file,
boolean truncateNamesAtWhitespace,
boolean preferIndexed)
Attempts to determine the type of the reference file and return an instance
of ReferenceSequenceFile that is appropriate to read it.
|
static ReferenceSequenceFile |
getReferenceSequenceFile(java.nio.file.Path path)
Attempts to determine the type of the reference file and return an instance
of ReferenceSequenceFile that is appropriate to read it.
|
static ReferenceSequenceFile |
getReferenceSequenceFile(java.nio.file.Path path,
boolean truncateNamesAtWhitespace)
Attempts to determine the type of the reference file and return an instance
of ReferenceSequenceFile that is appropriate to read it.
|
static ReferenceSequenceFile |
getReferenceSequenceFile(java.nio.file.Path path,
boolean truncateNamesAtWhitespace,
boolean preferIndexed)
Attempts to determine the type of the reference file and return an instance
of ReferenceSequenceFile that is appropriate to read it.
|
static ReferenceSequenceFile |
getReferenceSequenceFile(java.lang.String source,
SeekableStream in,
FastaSequenceIndex index)
Return an instance of ReferenceSequenceFile using the given fasta sequence file stream, optional index stream,
and no sequence dictionary
|
static ReferenceSequenceFile |
getReferenceSequenceFile(java.lang.String source,
SeekableStream in,
FastaSequenceIndex index,
SAMSequenceDictionary dictionary,
boolean truncateNamesAtWhitespace)
Return an instance of ReferenceSequenceFile using the given fasta sequence file stream and optional index stream
and sequence dictionary.
|
static SAMSequenceDictionary |
loadDictionary(java.io.InputStream in)
Loads the sequence dictionary from a FASTA file input stream.
|
@Deprecated public static final java.util.Set<java.lang.String> FASTA_EXTENSIONS
FileExtensions.FASTA
instead.@Deprecated public static final java.lang.String FASTA_INDEX_EXTENSION
FileExtensions.FASTA_INDEX
instead.public static ReferenceSequenceFile getReferenceSequenceFile(java.io.File file)
file
- the reference sequence file on diskpublic static ReferenceSequenceFile getReferenceSequenceFile(java.io.File file, boolean truncateNamesAtWhitespace)
file
- the reference sequence file on disktruncateNamesAtWhitespace
- if true, only include the first word of the sequence namepublic static ReferenceSequenceFile getReferenceSequenceFile(java.io.File file, boolean truncateNamesAtWhitespace, boolean preferIndexed)
file
- the reference sequence file on disktruncateNamesAtWhitespace
- if true, only include the first word of the sequence namepreferIndexed
- if true attempt to return an indexed reader that supports non-linear traversal, else return the non-indexed readerpublic static ReferenceSequenceFile getReferenceSequenceFile(java.nio.file.Path path)
path
- the reference sequence file on diskpublic static ReferenceSequenceFile getReferenceSequenceFile(java.nio.file.Path path, boolean truncateNamesAtWhitespace)
path
- the reference sequence file on disktruncateNamesAtWhitespace
- if true, only include the first word of the sequence namepublic static ReferenceSequenceFile getReferenceSequenceFile(java.nio.file.Path path, boolean truncateNamesAtWhitespace, boolean preferIndexed)
path
- the reference sequence file pathtruncateNamesAtWhitespace
- if true, only include the first word of the sequence namepreferIndexed
- if true attempt to return an indexed reader that supports non-linear traversal, else return the non-indexed readerpublic static boolean canCreateIndexedFastaReader(java.nio.file.Path fastaFile)
For a FASTA file to be indexed, it requires to have:
FastaSequenceIndex
).GZIIndex
).fastaFile
- the reference sequence file path.true
if the file can be open as indexed; false
otherwise.public static ReferenceSequenceFile getReferenceSequenceFile(java.lang.String source, SeekableStream in, FastaSequenceIndex index)
source
- The named source of the reference file (used in error messages).in
- The input stream to read the fasta file from.index
- The index, or null to return a non-indexed reader.public static ReferenceSequenceFile getReferenceSequenceFile(java.lang.String source, SeekableStream in, FastaSequenceIndex index, SAMSequenceDictionary dictionary, boolean truncateNamesAtWhitespace)
source
- The named source of the reference file (used in error messages).in
- The input stream to read the fasta file from.index
- The index, or null to return a non-indexed reader.dictionary
- The sequence dictionary, or null if there isn't one.truncateNamesAtWhitespace
- if true, only include the first word of the sequence namepublic static java.io.File getDefaultDictionaryForReferenceSequence(java.io.File file)
file
- the reference sequence file on disk.public static java.nio.file.Path getDefaultDictionaryForReferenceSequence(java.nio.file.Path path)
path
- the reference sequence file path.public static SAMSequenceDictionary loadDictionary(java.io.InputStream in)
in
- the FASTA file input stream.null
if the header has no dictionary or it was empty.public static java.lang.String getFastaExtension(java.nio.file.Path path)
path
- the reference sequence file path.java.lang.IllegalArgumentException
- if the file is not a supported reference file.public static java.nio.file.Path getFastaIndexFileName(java.nio.file.Path fastaFile)
fastaFile
- the reference sequence file path.