X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fio%2Fvcf%2FVCFLoader.java;h=8dab1d61057a79809b01afd253b1301aafce4f06;hb=4567ee2f18f8c16ce6800ec7f888638bd4fe731a;hp=89b1d2afb3b2cd529e7c27797c70039ae427b276;hpb=64da83f39a1ed5993be83029868bd6005dd9ee6b;p=jalview.git diff --git a/src/jalview/io/vcf/VCFLoader.java b/src/jalview/io/vcf/VCFLoader.java index 89b1d2a..8dab1d6 100644 --- a/src/jalview/io/vcf/VCFLoader.java +++ b/src/jalview/io/vcf/VCFLoader.java @@ -181,7 +181,7 @@ public class VCFLoader /* * 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? @@ -239,15 +239,20 @@ public class VCFLoader } /** - * 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. *

* 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) { @@ -303,7 +308,6 @@ public class VCFLoader /* * nucleotide-to-nucleotide mapping e.g. transcript to CDS */ - // TODO no DBRef to CDS is added to transcripts List features = seq.getFeatures() .getPositionalFeatures(SequenceOntologyI.SEQUENCE_VARIANT); for (SequenceFeature sf : features) @@ -689,8 +693,17 @@ public class VCFLoader * 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) {