public abstract class AbstractVCFCodec extends AsciiFeatureCodec<VariantContext> implements NameAwareCodec
Modifier and Type | Field and Description |
---|---|
protected java.util.Map<java.lang.String,java.util.List<Allele>> |
alleleMap |
protected boolean |
doOnTheFlyModifications
If true, then we'll magically fix up VCF headers on the fly when we read them in
|
protected java.util.HashMap<java.lang.String,java.util.List<java.lang.String>> |
filterHash |
protected java.lang.String[] |
genotypeParts |
protected VCFHeader |
header |
protected int |
lineNo |
protected java.lang.String[] |
locParts |
static int |
MAX_ALLELE_SIZE_BEFORE_WARNING |
protected java.lang.String |
name |
protected static int |
NUM_STANDARD_FIELDS |
protected java.lang.String[] |
parts |
protected java.lang.String |
remappedSampleName
If non-null, we will replace the sample name read from the VCF header with this sample name.
|
protected java.util.Map<java.lang.String,java.lang.String> |
stringCache |
static boolean |
validate |
protected VCFHeaderVersion |
version |
protected boolean |
warnedAboutNoEqualsForNonFlag |
Modifier | Constructor and Description |
---|---|
protected |
AbstractVCFCodec() |
Modifier and Type | Method and Description |
---|---|
static boolean |
canDecodeFile(java.lang.String potentialInput,
java.lang.String MAGIC_HEADER_LINE) |
LazyGenotypesContext.LazyData |
createGenotypeMap(java.lang.String str,
java.util.List<Allele> alleles,
java.lang.String chr,
int pos)
create a genotype map
|
VariantContext |
decode(java.lang.String line)
decode the line into a feature (VariantContext)
|
Feature |
decodeLoc(java.lang.String line)
the fast decode function
|
void |
disableOnTheFlyModifications()
Forces all VCFCodecs to not perform any on the fly modifications to the VCF header
of VCF records.
|
protected void |
generateException(java.lang.String message) |
protected static void |
generateException(java.lang.String message,
int lineNo) |
protected java.lang.String |
getCachedString(java.lang.String str)
Return a cached copy of the supplied string.
|
java.lang.String |
getName()
get the name of this codec
|
protected static Allele |
oneAllele(java.lang.String index,
java.util.List<Allele> alleles)
create a an allele from an index and an array of alleles
|
protected static java.util.List<Allele> |
parseAlleles(java.lang.String ref,
java.lang.String alts,
int lineNo)
parse out the alleles
|
protected abstract java.util.List<java.lang.String> |
parseFilters(java.lang.String filterString)
parse the filter string, first checking to see if we already have parsed it in a previous attempt
|
protected static java.util.List<Allele> |
parseGenotypeAlleles(java.lang.String GT,
java.util.List<Allele> alleles,
java.util.Map<java.lang.String,java.util.List<Allele>> cache)
parse genotype alleles from the genotype string
|
protected VCFHeader |
parseHeaderFromLines(java.util.List<java.lang.String> headerStrings,
VCFHeaderVersion version)
create a VCF header from a set of header record lines
|
protected static java.lang.Double |
parseQual(java.lang.String qualString)
parse out the qual value
|
void |
setName(java.lang.String name)
set the name of this codec
|
void |
setRemappedSampleName(java.lang.String remappedSampleName)
Replaces the sample name read from the VCF header with the remappedSampleName.
|
VCFHeader |
setVCFHeader(VCFHeader header,
VCFHeaderVersion version)
Explicitly set the VCFHeader on this codec.
|
close, decode, isDone, makeIndexableSourceFromStream, makeSourceFromStream, readActualHeader, readHeader
decodeLoc, getFeatureType
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
canDecode
public static final int MAX_ALLELE_SIZE_BEFORE_WARNING
protected static final int NUM_STANDARD_FIELDS
protected VCFHeader header
protected VCFHeaderVersion version
protected java.util.Map<java.lang.String,java.util.List<Allele>> alleleMap
public static boolean validate
protected java.lang.String[] parts
protected java.lang.String[] genotypeParts
protected final java.lang.String[] locParts
protected java.util.HashMap<java.lang.String,java.util.List<java.lang.String>> filterHash
protected java.lang.String name
protected int lineNo
protected java.util.Map<java.lang.String,java.lang.String> stringCache
protected boolean warnedAboutNoEqualsForNonFlag
protected boolean doOnTheFlyModifications
protected java.lang.String remappedSampleName
protected abstract java.util.List<java.lang.String> parseFilters(java.lang.String filterString)
filterString
- the string to parseprotected VCFHeader parseHeaderFromLines(java.util.List<java.lang.String> headerStrings, VCFHeaderVersion version)
headerStrings
- a list of strings that represent all the ## and # entriespublic VCFHeader setVCFHeader(VCFHeader header, VCFHeaderVersion version)
public Feature decodeLoc(java.lang.String line)
line
- the line of text for the recordpublic VariantContext decode(java.lang.String line)
decode
in class AsciiFeatureCodec<VariantContext>
line
- the lineAsciiFeatureCodec.decode(htsjdk.tribble.readers.LineIterator)
public java.lang.String getName()
getName
in interface NameAwareCodec
public void setName(java.lang.String name)
setName
in interface NameAwareCodec
name
- new nameprotected java.lang.String getCachedString(java.lang.String str)
str
- stringprotected static Allele oneAllele(java.lang.String index, java.util.List<Allele> alleles)
index
- the indexalleles
- the allelesprotected static java.util.List<Allele> parseGenotypeAlleles(java.lang.String GT, java.util.List<Allele> alleles, java.util.Map<java.lang.String,java.util.List<Allele>> cache)
GT
- GT stringalleles
- list of possible allelescache
- cache of alleles for GTprotected static java.lang.Double parseQual(java.lang.String qualString)
qualString
- the quality stringprotected static java.util.List<Allele> parseAlleles(java.lang.String ref, java.lang.String alts, int lineNo)
ref
- the reference basealts
- a string of alternates to break into alleleslineNo
- the line number for this recordpublic static boolean canDecodeFile(java.lang.String potentialInput, java.lang.String MAGIC_HEADER_LINE)
public LazyGenotypesContext.LazyData createGenotypeMap(java.lang.String str, java.util.List<Allele> alleles, java.lang.String chr, int pos)
str
- the stringalleles
- the list of allelespublic final void disableOnTheFlyModifications()
public void setRemappedSampleName(java.lang.String remappedSampleName)
remappedSampleName
- replacement sample name for the sample specified in the VCF headerprotected void generateException(java.lang.String message)
protected static void generateException(java.lang.String message, int lineNo)