@Deprecated public void setAttributes(Map<String, String> attributes) { if (impl.getFiles().isEmpty()) { impl.getFiles().add(new FileEntry("", null, attributes)); } else { impl.getFiles().get(0).setAttributes(attributes); } }
public void setFileId(String fileId) { if (impl.getFiles().isEmpty()) { impl.getFiles().add(new FileEntry(fileId, "", new HashMap<>())); } else { impl.getFiles().get(0).setFileId(fileId); } }
studyEntry.getFiles().add(new FileEntry(fileName, call, attributes));
FileEntry fileEntry = new FileEntry(getFileName(studyId, fid), null, attributes); files.add(fileEntry);
/** * Create an empty Variant (position, ref, alt) from a template with basic Study information without samples. * @param target Variant to take as a template * @return Variant filled with chromosome, start, end, ref, alt, study ID and format set to GT only, BUT no samples. */ public Variant createFromTemplate(Variant target) { Variant var = new Variant(target.getChromosome(), target.getStart(), target.getEnd(), target.getReference(), target.getAlternate()); var.setType(target.getType()); for(StudyEntry tse : target.getStudies()){ StudyEntry se = new StudyEntry(tse.getStudyId()); se.setFiles(Collections.singletonList(new FileEntry("", "", new HashMap<>()))); se.setFormat(Arrays.asList(getGtKey(), getFilterKey())); se.setSamplesPosition(new HashMap<>()); se.setSamplesData(new ArrayList<>()); var.addStudyEntry(se); } return var; }
@Override public FileEntry build() { try { FileEntry record = new FileEntry(); record.fileId = fieldSetFlags()[0] ? this.fileId : (java.lang.String) defaultValue(fields()[0]); record.call = fieldSetFlags()[1] ? this.call : (java.lang.String) defaultValue(fields()[1]); record.attributes = fieldSetFlags()[2] ? this.attributes : (java.util.Map<java.lang.String,java.lang.String>) defaultValue(fields()[2]); return record; } catch (Exception e) { throw new org.apache.avro.AvroRuntimeException(e); } } }
FileEntry fileEntry = new FileEntry(fields[2], null, new HashMap<>()); try {
StudyEntry studyEntry = new StudyEntry(studyId); if (fileId != null) { FileEntry fileEntry = new FileEntry(fileId, call, attributes); studyEntry.setFiles(Collections.singletonList(fileEntry));
public static Variant getVariant(String var) { Variant v = new Variant(var); StudyEntry sb = new StudyEntry("1", "1"); String call = v.getStart() + ":" + v.getReference() + ":" + v.getAlternate() + ":" + 0; sb.setFiles(Collections.singletonList(new FileEntry("1", "", new HashMap<>()))); v.setStudies(Collections.singletonList(sb)); if (v.getAlternate().contains(",")) { String[] alternates = v.getAlternate().split(","); v.setAlternate(alternates[0]); for (int i = 1; i < alternates.length; i++) { v.getStudies().get(0).getSecondaryAlternates().add(new AlternateCoordinate(null, null, null, null, alternates[i], null)); } } return v; }
for (FileEntry file : vse.getFiles()) { HashMap<String, String> attributes = new HashMap<>(file.getAttributes()); //TODO: Check file attributes files.add(new FileEntry(file.getFileId(), file.getCall(), attributes));
files.add(new FileEntry(id.toString(), "", Collections.emptyMap()));
studyEntry.setFiles(Collections.singletonList(new FileEntry(keyFields.getPhaseSet(), call, null))); normalizedVariant.setStudies(Collections.singletonList(studyEntry)); for (FileEntry file : entry.getFiles()) { HashMap<String, String> attributes = new HashMap<>(file.getAttributes()); files.add(new FileEntry(file.getFileId(), sameVariant ? null : call, attributes)); normalizedEntry.setFiles(Collections.singletonList(new FileEntry(keyFields.getPhaseSet(), call, null)));
fileId = 2; studyEntry = new StudyEntry(studyId.toString()); FileEntry fileEntry = new FileEntry(fileId.toString(), null, new HashMap<>()); fileEntry.getAttributes().put("QUAL", "0.01"); fileEntry.getAttributes().put("AN", "2.0");
se.setFiles(Collections.singletonList(new FileEntry("1", "", new HashMap<>()))); v1.setStudies(Collections.singletonList(se)); se.setFormat(Arrays.asList(GENOTYPE_KEY, GENOTYPE_FILTER_KEY)); se.setFiles(Collections.singletonList(new FileEntry("1", "", new HashMap<>()))); v2.setStudies(Collections.singletonList(se)); se.setSamplesPosition(asMap("S1", 0));
public Variant convert(VcfSliceProtos.VcfRecord vcfRecord, String chromosome, int slicePosition) { int start = getStart(vcfRecord, slicePosition); int end = getEnd(vcfRecord, slicePosition); Variant variant = new Variant(chromosome, start, end, vcfRecord.getReference(), vcfRecord.getAlternate()); variant.setType(getVariantType(vcfRecord.getType())); variant.setIds(vcfRecord.getIdNonDefaultList()); variant.resetLength(); FileEntry fileEntry = new FileEntry(); fileEntry.setFileId(fileId); Map<String, String> attributes = getFileAttributes(vcfRecord); fileEntry.setAttributes(attributes); fileEntry.setCall(vcfRecord.getCall().isEmpty() ? null : vcfRecord.getCall()); if (vcfRecord.getType().equals(VariantProto.VariantType.NO_VARIATION)) { attributes.put("END", Integer.toString(end)); } StudyEntry studyEntry = new StudyEntry(studyId); studyEntry.setFiles(Collections.singletonList(fileEntry)); studyEntry.setFormat(getFormat(vcfRecord)); studyEntry.setSamplesData(getSamplesData(vcfRecord, studyEntry.getFormatPositions())); studyEntry.setSamplesPosition(retrieveSamplePosition()); studyEntry.getFormatPositions(); // Initialize the map List<VariantProto.AlternateCoordinate> alts = vcfRecord.getSecondaryAlternatesList(); studyEntry.setSecondaryAlternates(getAlternateCoordinates(alts)); variant.addStudyEntry(studyEntry); studyEntry.getFormatPositions(); // Initialize the map return variant; }