/** * outputFeatureInVCF. * * @param buffer a {@link java.lang.StringBuffer} object. * @param feature a {@link com.github.seqware.queryengine.model.Feature} object. * @return a boolean. */ public static boolean outputFeatureInVCF(StringBuffer buffer, Feature feature) { boolean caughtNonVCF = false; buffer.append(feature.getSeqid()).append("\t").append(feature.getStart() + 1).append("\t"); if (feature.getTagByKey(VCF, ImportConstants.VCF_SECOND_ID) == null) { buffer.append(".\t"); } else { buffer .append(feature.getTagByKey(VCF, ImportConstants.VCF_SECOND_ID).getValue().toString()) .append("\t"); } try { buffer .append( feature.getTagByKey(VCF, ImportConstants.VCF_REFERENCE_BASE).getValue().toString()) .append("\t"); buffer .append(feature.getTagByKey(VCF, ImportConstants.VCF_CALLED_BASE).getValue().toString()) .append("\t"); buffer.append(feature.getScore() == null ? "." : feature.getScore()).append("\t"); buffer .append(feature.getTagByKey(VCF, ImportConstants.VCF_FILTER).getValue().toString()) .append("\t"); buffer.append(feature.getTagByKey(VCF, ImportConstants.VCF_INFO).getValue().toString()); } catch (NullPointerException npe) { if (!caughtNonVCF) { Logger.getLogger(VCFDumper.class.getName()).info("VCF exporting non-VCF feature"); } // this may occur when exporting Features that were not originally VCF files caughtNonVCF = true; } return caughtNonVCF; }