@Deprecated public String getAttribute(String key) { Map<String, String> attributes = getAttributes(); return attributes == null ? null : attributes.get(key); }
@Deprecated public void addAttribute(String key, String value) { getAttributes().put(key, value); }
@Deprecated public boolean hasAttribute(String key) { return getAttributes().containsKey(key); }
public static String getInfoColumn(StudyEntry file) { StringBuilder info = new StringBuilder(); for (Map.Entry<String, String> entry : file.getAttributes().entrySet()) { String key = entry.getKey(); if (!key.equalsIgnoreCase("QUAL") && !key.equalsIgnoreCase("FILTER")) { info.append(key); String value = entry.getValue(); if (value.length() > 0) { info.append("="); info.append(value); } info.append(";"); } } return info.toString().isEmpty() ? "." : info.toString(); }
@Override protected void parseStats(Variant variant, StudyEntry study, int numAllele, String reference, String[] alternateAlleles, Map<String, String> info) { FileEntry fileEntry = study.getFiles().get(0); // EVS params are not rearranged when normalizing. Use original call if (fileEntry.getCall() != null && !fileEntry.getCall().isEmpty()) { String[] ori = fileEntry.getCall().split(":"); numAllele = Integer.parseInt(ori[3]); alternateAlleles = ori[2].split(","); reference = ori[1]; } VariantStats stats = new VariantStats(); if (info.containsKey("MAF")) { String splitsMAF[] = info.get("MAF").split(","); if (splitsMAF.length == 3) { float maf = Float.parseFloat(splitsMAF[2]) / 100; stats.setMaf(maf); } } if (info.containsKey("GTS") && info.containsKey("GTC")) { String splitsGTC[] = info.get("GTC").split(","); addGenotypeWithGTS(study.getAttributes(), splitsGTC, reference, alternateAlleles, numAllele, stats); } study.setStats(StudyEntry.DEFAULT_COHORT, stats); }
sb.append(generateInfo(file.getAttributes())).append("\t"); sb.append(Joiner.on(":").join(format)).append("\t"); sb.append(generateSampleInfo(elem, file, format));
private Variant getGenomicVariant(Variant variant) { if (variant.getAlternate().equals(".")) { // reference positions are not variants return null; } else { String ref; // large deletion if (variant.getAlternate().equals("<DEL>")) { // .get("_") because studyId and fileId are empty strings when VariantSource is initialized at readInputFile int end = Integer.valueOf(variant.getSourceEntries().get("_").getAttributes().get("END")); ref = StringUtils.repeat("N", end - variant.getStart()); return new Variant(variant.getChromosome(), variant.getStart(), ref, variant.getAlternate().equals("") ? "-" : variant.getAlternate()); // TODO: structural variants are not yet properly handled. Implement and remove this patch asap } else if (variant.getAlternate().startsWith("<") || (variant.getAlternate().length() > 1 && variant.getReference().length() > 1)) { return null; } else { ref = variant.getReference().equals("") ? "-" : variant.getReference(); return new Variant(variant.getChromosome(), variant.getStart(), ref, variant.getAlternate().equals("") ? "-" : variant.getAlternate()); } } }
addGenotypeWithGTS(studyEntry.getAttributes(), values, reference, alternateAlleles, numAllele, cohortStats); break; default:
Map<String, String> attr = study.getAttributes();