Package htsjdk.samtools.reference
Interface ReferenceSequenceFile
-
- All Superinterfaces:
AutoCloseable
,Closeable
- All Known Implementing Classes:
BlockCompressedIndexedFastaSequenceFile
,FastaSequenceFile
,IndexedFastaSequenceFile
,SRAIndexedSequenceFile
public interface ReferenceSequenceFile extends Closeable
An interface for working with files of reference sequences regardless of the file format being used.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
close()
ReferenceSequence
getSequence(String contig)
Retrieves the complete sequence described by this contig.SAMSequenceDictionary
getSequenceDictionary()
Must return a sequence dictionary with at least the following fields completed for each sequence: name, length.ReferenceSequence
getSubsequenceAt(String contig, long start, long stop)
Gets the subsequence of the contig in the range [start,stop]boolean
isIndexed()
ReferenceSequence
nextSequence()
Retrieves the next whole sequences from the file.void
reset()
Resets the ReferenceSequenceFile so that the next call to nextSequence() will return the first sequence in the file.String
toString()
-
-
-
Method Detail
-
getSequenceDictionary
SAMSequenceDictionary getSequenceDictionary()
Must return a sequence dictionary with at least the following fields completed for each sequence: name, length.- Returns:
- a list of sequence records representing the sequences in this reference file
-
nextSequence
ReferenceSequence nextSequence()
Retrieves the next whole sequences from the file.- Returns:
- a ReferenceSequence or null if at the end of the file
-
reset
void reset()
Resets the ReferenceSequenceFile so that the next call to nextSequence() will return the first sequence in the file.
-
isIndexed
boolean isIndexed()
- Returns:
- true if getSequence and getSubsequenceAt methods are allowed.
-
getSequence
ReferenceSequence getSequence(String contig)
Retrieves the complete sequence described by this contig.- Parameters:
contig
- contig whose data should be returned.- Returns:
- The full sequence associated with this contig.
- Throws:
UnsupportedOperationException
- if !sIndexed.
-
getSubsequenceAt
ReferenceSequence getSubsequenceAt(String contig, long start, long stop)
Gets the subsequence of the contig in the range [start,stop]- Parameters:
contig
- Contig whose subsequence to retrieve.start
- inclusive, 1-based start of region.stop
- inclusive, 1-based stop of region.- Returns:
- The partial reference sequence associated with this range.
- Throws:
UnsupportedOperationException
- if !sIndexed.
-
toString
String toString()
-
close
void close() throws IOException
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
-
-