public final class GenomeLocParser
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
GenomeLocParser.ValidationLevel
How much validation should we do at runtime with this parser?
|
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
UNMAPPED_LOC_NAME |
Modifier | Constructor and Description |
---|---|
|
GenomeLocParser(htsjdk.samtools.reference.ReferenceSequenceFile refFile)
set our internal reference contig order
|
|
GenomeLocParser(htsjdk.samtools.SAMSequenceDictionary seqDict)
Create a new GenomeLocParser based on seqDictionary with the standard validation level
|
protected |
GenomeLocParser(htsjdk.samtools.SAMSequenceDictionary seqDict,
GenomeLocParser.ValidationLevel validationLevel)
Create a genome loc parser based on seqDict with the specified level of validation
|
Modifier and Type | Method and Description |
---|---|
boolean |
contigIsInDictionary(java.lang.String contig)
Determines whether the given contig is valid with respect to the sequence dictionary
already installed in the GenomeLoc.
|
GenomeLoc |
createGenomeLoc(htsjdk.tribble.Feature feature)
Creates a GenomeLoc from a Tribble feature
|
GenomeLoc |
createGenomeLoc(GATKRead read) |
GenomeLoc |
createGenomeLoc(htsjdk.samtools.util.Locatable locatable)
Creates a GenomeLoc from a
Locatable . |
GenomeLoc |
createGenomeLoc(java.lang.String contig,
int pos)
Create a new GenomeLoc, on contig, including the single position pos.
|
GenomeLoc |
createGenomeLoc(java.lang.String contig,
int start,
int stop) |
GenomeLoc |
createGenomeLoc(java.lang.String contig,
int start,
int stop,
boolean mustBeOnReference) |
GenomeLoc |
createGenomeLoc(java.lang.String contig,
int index,
int start,
int stop) |
GenomeLoc |
createGenomeLoc(java.lang.String contig,
int index,
int start,
int stop,
boolean mustBeOnReference)
Create a GenomeLoc on contig, starting at start and ending (inclusive) at stop.
|
GenomeLoc |
createGenomeLocAtStart(GenomeLoc loc,
int maxBasePairs)
Creates a loc to the left (starting at the loc start + 1) of maxBasePairs size.
|
GenomeLoc |
createGenomeLocAtStop(GenomeLoc loc,
int maxBasePairs)
Creates a loc to the right (starting at the loc stop + 1) of maxBasePairs size.
|
GenomeLoc |
createGenomeLocOnContig(java.lang.String contig,
int start,
int stop) |
GenomeLoc |
createGenomeLocOnContig(java.lang.String contig,
int contigIndex,
int start,
int stop)
Create a new genome loc, bounding start and stop by the start and end of contig
This function will return null if start and stop cannot be adjusted in any reasonable way
to be on the contig.
|
GenomeLoc |
createOverEntireContig(java.lang.String contigName)
Creates a GenomeLoc than spans the entire contig.
|
GenomeLoc |
createPaddedGenomeLoc(GenomeLoc loc,
int padding)
Creates a loc padded in both directions by maxBasePairs size (if possible).
|
int |
getContigIndex(java.lang.String contig)
Returns the contig index of a specified string version of the contig
|
protected int |
getContigIndexWithoutException(java.lang.String contig) |
htsjdk.samtools.SAMSequenceRecord |
getContigInfo(java.lang.String contig)
get the contig's SAMSequenceRecord
|
htsjdk.samtools.SAMSequenceDictionary |
getSequenceDictionary()
Return the master sequence dictionary used within this GenomeLocParser
|
static boolean |
isUnmappedGenomeLocString(java.lang.String str) |
boolean |
isValidGenomeLoc(java.lang.String contig,
int start,
int stop) |
boolean |
isValidGenomeLoc(java.lang.String contig,
int start,
int stop,
boolean mustBeOnReference)
Would a genome loc created with the given parameters be valid w.r.t.
|
GenomeLoc |
parseGenomeLoc(java.lang.String rawStr)
parse a genome interval, from a location string
Performs interval-style validation:
contig is valid; start and stop less than the end; start <= stop, and start/stop are on the contig
|
protected java.lang.String |
validateGenomeLoc(java.lang.String contig,
int contigIndex,
int start,
int stop,
boolean mustBeOnReference)
validate a position or interval on the genome as valid
Requires that contig exist in the master sequence dictionary, and that contig index be valid as well.
|
public static final java.lang.String UNMAPPED_LOC_NAME
public GenomeLocParser(htsjdk.samtools.reference.ReferenceSequenceFile refFile)
refFile
- the reference filepublic GenomeLocParser(htsjdk.samtools.SAMSequenceDictionary seqDict)
seqDict
- a non-null sequence dictionaryprotected GenomeLocParser(htsjdk.samtools.SAMSequenceDictionary seqDict, GenomeLocParser.ValidationLevel validationLevel)
seqDict
- the sequence dictionary to use when creating genome locsvalidationLevel
- how much validation should we do of the genome locs at runtime? Purely for testing purposespublic final boolean contigIsInDictionary(java.lang.String contig)
contig
- a potentially null string name for the contigpublic final htsjdk.samtools.SAMSequenceRecord getContigInfo(java.lang.String contig)
contig
- the string name of the contigpublic final int getContigIndex(java.lang.String contig)
contig
- the contig stringprotected int getContigIndexWithoutException(java.lang.String contig)
public final htsjdk.samtools.SAMSequenceDictionary getSequenceDictionary()
public GenomeLoc createGenomeLoc(java.lang.String contig, int start, int stop)
public GenomeLoc createGenomeLoc(java.lang.String contig, int start, int stop, boolean mustBeOnReference)
public GenomeLoc createGenomeLoc(java.lang.String contig, int index, int start, int stop)
public GenomeLoc createGenomeLoc(java.lang.String contig, int index, int start, int stop, boolean mustBeOnReference)
contig
- the contig nameindex
- the index into the GATK's SAMSequencingDictionary of contig (passed for efficiency to avoid the lookup)start
- the starting positionstop
- the stop position of this loc, inclusivemustBeOnReference
- if true, this factory will throw a UserException.MalformedGenomeLoc if start or stop isn't on the contigpublic GenomeLoc createGenomeLoc(java.lang.String contig, int pos)
contig
- the contig namepos
- the start and stop of the created genome locfor exact details of the creation.
protected java.lang.String validateGenomeLoc(java.lang.String contig, int contigIndex, int start, int stop, boolean mustBeOnReference)
contig
- the contig namestart
- the start positionstop
- the stop positionpublic boolean isValidGenomeLoc(java.lang.String contig, int start, int stop, boolean mustBeOnReference)
contig
- the contig we'd usestart
- the start positionstop
- the stopmustBeOnReference
- should we require the resulting genome loc to be completely on the reference genome?public boolean isValidGenomeLoc(java.lang.String contig, int start, int stop)
with mustBeOnReference == true
public GenomeLoc parseGenomeLoc(java.lang.String rawStr)
rawStr
- the string to parsepublic static boolean isUnmappedGenomeLocString(java.lang.String str)
str
- String to checkUNMAPPED_LOC_NAME
(ignoring case)public GenomeLoc createGenomeLoc(htsjdk.tribble.Feature feature)
feature
- public GenomeLoc createGenomeLoc(htsjdk.samtools.util.Locatable locatable)
Locatable
.locatable
- the input locatable.null
.java.lang.IllegalArgumentException
- if locatable
is null
.public GenomeLoc createOverEntireContig(java.lang.String contigName)
contigName
- Name of the contig.public GenomeLoc createGenomeLocAtStart(GenomeLoc loc, int maxBasePairs)
loc
- The original locmaxBasePairs
- The maximum number of basePairspublic GenomeLoc createPaddedGenomeLoc(GenomeLoc loc, int padding)
loc
- The original locpadding
- The number of base pairs to pad on either endpublic GenomeLoc createGenomeLocAtStop(GenomeLoc loc, int maxBasePairs)
loc
- The original locmaxBasePairs
- The maximum number of basePairspublic GenomeLoc createGenomeLocOnContig(java.lang.String contig, int start, int stop)
public GenomeLoc createGenomeLocOnContig(java.lang.String contig, int contigIndex, int start, int stop)
contig
- our contigstart
- our start as an arbitrary integer (may be negative, etc)stop
- our stop as an arbitrary integer (may be negative, etc)