From 4bbf2066781c756caca3c9ed206789c427f60ba3 Mon Sep 17 00:00:00 2001 From: nkumar2 Date: Sun, 25 Feb 2024 23:27:20 +0000 Subject: [PATCH] review comment --- .../DeprecatedVariantMongoReader.java | 34 +++++++------------ 1 file changed, 13 insertions(+), 21 deletions(-) diff --git a/eva-accession-release/src/main/java/uk/ac/ebi/eva/accession/release/batch/io/deprecated/DeprecatedVariantMongoReader.java b/eva-accession-release/src/main/java/uk/ac/ebi/eva/accession/release/batch/io/deprecated/DeprecatedVariantMongoReader.java index 51a0f7560..c77dec321 100644 --- a/eva-accession-release/src/main/java/uk/ac/ebi/eva/accession/release/batch/io/deprecated/DeprecatedVariantMongoReader.java +++ b/eva-accession-release/src/main/java/uk/ac/ebi/eva/accession/release/batch/io/deprecated/DeprecatedVariantMongoReader.java @@ -107,27 +107,19 @@ protected List getVariants(Document deprecatedVariant) { Document inactiveEntity = inactiveObjects.iterator().next(); String contig = inactiveEntity.getString(VariantMongoAggregationReader.CONTIG_FIELD); long start = inactiveEntity.getLong(VariantMongoAggregationReader.START_FIELD); - - for (Document submittedVariantOperation : submittedVariantOperations) { - Collection inactiveEntitySubmittedVariant = (Collection) submittedVariantOperation - .get("inactiveObjects"); - Document submittedVariant = inactiveEntitySubmittedVariant.iterator().next(); - String submittedVariantContig = submittedVariant.getString(CONTIG_FIELD); - String reference = submittedVariant.getString("ref"); - String alternate = submittedVariant.getString("alt"); - - if (contig.equals(submittedVariantContig)) { - // Since we only need evidence that at least one submitted variant agrees - // with the deprecated RS in locus, we just return one variant record per RS - Variant variantToReturn = new Variant(contig, start, - start + Math.max(reference.length(), alternate.length()) - 1, - reference, alternate); - variantToReturn.setMainId("rs" + deprecatedVariant.getLong("accession")); - return Arrays.asList(variantToReturn); - } - } - - return new ArrayList<>(); + Collection inactiveEntitySubmittedVariant = (Collection) submittedVariantOperations + .iterator().next().get("inactiveObjects"); + Document submittedVariant = inactiveEntitySubmittedVariant.iterator().next(); + String reference = submittedVariant.getString("ref"); + String alternate = submittedVariant.getString("alt"); + + // Since we only need evidence that at least one submitted variant agrees + // with the deprecated RS in locus, we just return one variant record per RS + Variant variantToReturn = new Variant(contig, start, + start + Math.max(reference.length(), alternate.length()) - 1, + reference, alternate); + variantToReturn.setMainId("rs" + deprecatedVariant.getLong("accession")); + return Arrays.asList(variantToReturn); } @Override