Package htsjdk.samtools.reference
Interface ReferenceSequenceFile
- All Superinterfaces:
AutoCloseable
,Closeable
- All Known Implementing Classes:
BlockCompressedIndexedFastaSequenceFile
,FastaSequenceFile
,IndexedFastaSequenceFile
,SRAIndexedSequenceFile
An interface for working with files of reference sequences regardless of the file format
being used.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
getSequence
(String contig) Retrieves the complete sequence described by this contig.Must return a sequence dictionary with at least the following fields completed for each sequence: name, length.getSubsequenceAt
(String contig, long start, long stop) Gets the subsequence of the contig in the range [start,stop]boolean
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.toString()
-
Method Details
-
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
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
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
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
-