public abstract class AbstractVCFCodec extends AsciiFeatureCodec<VariantContext> implements NameAwareCodec
Modifier and Type | Field and Description |
---|---|
protected Map<String,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 HashMap<String,List<String>> |
filterHash |
protected String[] |
genotypeParts |
protected VCFHeader |
header |
protected int |
lineNo |
protected String[] |
locParts |
static int |
MAX_ALLELE_SIZE_BEFORE_WARNING |
protected String |
name |
protected static int |
NUM_STANDARD_FIELDS |
protected String[] |
parts |
protected String |
remappedSampleName
If non-null, we will replace the sample name read from the VCF header with this sample name.
|
protected Map<String,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(String potentialInput,
String MAGIC_HEADER_LINE) |
LazyGenotypesContext.LazyData |
createGenotypeMap(String str,
List<Allele> alleles,
String chr,
int pos)
create a genotype map
|
VariantContext |
decode(String line)
decode the line into a feature (VariantContext)
|
Feature |
decodeLoc(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(String message) |
protected static void |
generateException(String message,
int lineNo) |
protected String |
getCachedString(String str)
Return a cached copy of the supplied string.
|
String |
getName()
get the name of this codec
|
protected static Allele |
oneAllele(String index,
List<Allele> alleles)
create a an allele from an index and an array of alleles
|
protected static List<Allele> |
parseAlleles(String ref,
String alts,
int lineNo)
parse out the alleles
|
protected abstract List<String> |
parseFilters(String filterString)
parse the filter string, first checking to see if we already have parsed it in a previous attempt
|
protected static List<Allele> |
parseGenotypeAlleles(String GT,
List<Allele> alleles,
Map<String,List<Allele>> cache)
parse genotype alleles from the genotype string
|
protected VCFHeader |
parseHeaderFromLines(List<String> headerStrings,
VCFHeaderVersion version)
create a VCF header from a set of header record lines
|
protected static Double |
parseQual(String qualString)
parse out the qual value
|
void |
setName(String name)
set the name of this codec
|
void |
setRemappedSampleName(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
public static boolean validate
protected String[] parts
protected String[] genotypeParts
protected final String[] locParts
protected String name
protected int lineNo
protected boolean warnedAboutNoEqualsForNonFlag
protected boolean doOnTheFlyModifications
protected String remappedSampleName
protected abstract List<String> parseFilters(String filterString)
filterString
- the string to parseprotected VCFHeader parseHeaderFromLines(List<String> headerStrings, VCFHeaderVersion version)
headerStrings
- a list of strings that represent all the ## and # entriespublic VCFHeader setVCFHeader(VCFHeader header, VCFHeaderVersion version)
public Feature decodeLoc(String line)
line
- the line of text for the recordpublic VariantContext decode(String line)
decode
in class AsciiFeatureCodec<VariantContext>
line
- the lineAsciiFeatureCodec.decode(htsjdk.tribble.readers.LineIterator)
public String getName()
getName
in interface NameAwareCodec
public void setName(String name)
setName
in interface NameAwareCodec
name
- new nameprotected String getCachedString(String str)
str
- stringprotected static Allele oneAllele(String index, List<Allele> alleles)
index
- the indexalleles
- the allelesprotected static List<Allele> parseGenotypeAlleles(String GT, List<Allele> alleles, Map<String,List<Allele>> cache)
GT
- GT stringalleles
- list of possible allelescache
- cache of alleles for GTprotected static Double parseQual(String qualString)
qualString
- the quality stringprotected static List<Allele> parseAlleles(String ref, String alts, int lineNo)
ref
- the reference basealts
- a string of alternates to break into alleleslineNo
- the line number for this recordpublic static final boolean canDecodeFile(String potentialInput, String MAGIC_HEADER_LINE)
public LazyGenotypesContext.LazyData createGenotypeMap(String str, List<Allele> alleles, String chr, int pos)
str
- the stringalleles
- the list of allelespublic final void disableOnTheFlyModifications()
public void setRemappedSampleName(String remappedSampleName)
remappedSampleName
- replacement sample name for the sample specified in the VCF headerprotected void generateException(String message)
protected static void generateException(String message, int lineNo)