/*
* note offset of CSQ ALLELE_NUM field if it is declared
*/
- findAlleleNumberFieldIndex();
+ locateCsqFields();
// check if reference is wrt assembly19 (GRCh37)
// todo may need to allow user to specify reference assembly?
}
/**
- * If the CSQ INFO header declares that ALLELE_NUM is included in the data,
- * record its (pipe-delimited) offset in each (comma-delimited) consequence
- * block; CSQ fields are declared in the CSQ INFO Description e.g.
+ * Records the position of fields for ALLELE_NUM and Feature defined in the
+ * CSQ INFO header (if there is one). CSQ fields are declared in the CSQ INFO
+ * Description e.g.
* <p>
* Description="Consequence ...from ... VEP. Format: Allele|Consequence|...
*/
- protected void findAlleleNumberFieldIndex()
+ protected void locateCsqFields()
{
VCFInfoHeaderLine csqInfo = header.getInfoHeaderLine(CSQ);
+ if (csqInfo == null)
+ {
+ return;
+ }
+
String desc = csqInfo.getDescription();
if (desc != null)
{
/*
* nucleotide-to-nucleotide mapping e.g. transcript to CDS
*/
- // TODO no DBRef to CDS is added to transcripts
List<SequenceFeature> features = seq.getFeatures()
.getPositionalFeatures(SequenceOntologyI.SEQUENCE_VARIANT);
for (SequenceFeature sf : features)
* these may be per alternate allele (INFO[key].Number = 'A')
* or per allele including reference (INFO[key].Number = 'R')
*/
- VCFHeaderLineCount number = header.getInfoHeaderLine(key)
- .getCountType();
+ VCFInfoHeaderLine infoHeader = header.getInfoHeaderLine(key);
+ if (infoHeader == null)
+ {
+ /*
+ * can't be sure what data belongs to this allele, so
+ * play safe and don't take any
+ */
+ continue;
+ }
+
+ VCFHeaderLineCount number = infoHeader.getCountType();
int index = altAlelleIndex;
if (number == VCFHeaderLineCount.R)
{