@Override public List<Variant> apply(List<Variant> batch) throws Exception { batch.forEach(variant -> variant.getStudies() .forEach((StudyEntry studyEntry) -> { studyEntry.setStudyId(studyIdStr); studyEntry.getFiles().forEach((FileEntry fileEntry) -> fileEntry.setFileId(fileIdStr)); })); return batch; } }
private void addVariant(Variant variant) { String chromosome = variant.getChromosome(); // Remap studyId and fileId StudyEntry studyEntry = variant.getStudies().get(0); studyEntry.setStudyId(studyId); studyEntry.getFiles().get(0).setFileId(fileId); long[] coveredSlicePositions = getCoveredSlicePositions(variant); for (long slicePos : coveredSlicePositions) { addVariant(variant, chromosome, slicePos); } }
@Override public List<Document> apply(List<Variant> batch) { progressLogger.increment(batch.size(), () -> "up to position " + batch.get(batch.size() - 1)); return batch.stream().map(variant -> { for (StudyEntry studyEntry : variant.getStudies()) { studyEntry.setStudyId(studiesIdRemap.getOrDefault(studyEntry.getStudyId(), studyEntry.getStudyId())); for (FileEntry file : studyEntry.getFiles()) { if (file.getFileId().isEmpty()) { file.setFileId("-1"); } else if (fileIdRemap.containsKey(file.getFileId())) { file.setFileId(fileIdRemap.get(file.getFileId())); } } if (studyEntry.getSamplesData() == null) { studyEntry.setSamplesData(Collections.emptyList()); } } return variant; }).map(variantConverter::convertToStorageType).collect(Collectors.toList()); } }
/** * @param n * @return studyEntryList */ public List<StudyEntry> getStudies(int n) { int studyID = 2; int fieldID = 3; List<StudyEntry> studyEntryList = new ArrayList<>(); StudyEntry studyEntry = new StudyEntry(); studyEntry.setStudyId(Integer.toString(studyID)); studyEntry.setFileId(Integer.toString(fieldID)); Map<String, String> attributes = genAttributes(); studyEntry.setAttributes(attributes); studyEntry.setFormat(getFormat()); List<List<String>> sampleList = new ArrayList<>(getFormat().size()); for (int i = 0; i < n; i++) { sampleList.add(getRandomample()); } studyEntry.setSamplesData(sampleList); studyEntryList.add(studyEntry); return studyEntryList; }
se.setStudyId(vse.getStudyId()); if (null != vse.getSamplesPosition()) { se.setSamplesPosition(new HashMap<>(vse.getSamplesPosition()));
normalizedEntry.setStudyId(entry.getStudyId()); normalizedEntry.setSamplesPosition(entry.getSamplesPosition()); normalizedEntry.setFormat(entry.getFormat());
for (Variant variant : reader.read(999)) { StudyEntry studyEntry = variant.getStudies().get(0); studyEntry.setStudyId(STUDY_NAME); studyEntry.getFiles().get(0).setFileId(fileId); variant.setStudies(Collections.singletonList(studyEntry));