Skip to content

Commit

Permalink
review comment
Browse files Browse the repository at this point in the history
  • Loading branch information
nitin-ebi committed Feb 25, 2024
1 parent f83ef53 commit 4bbf206
Showing 1 changed file with 13 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -107,27 +107,19 @@ protected List<Variant> 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<Document> inactiveEntitySubmittedVariant = (Collection<Document>) 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<Document> inactiveEntitySubmittedVariant = (Collection<Document>) 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
Expand Down

0 comments on commit 4bbf206

Please sign in to comment.