Skip to content

Commit

Permalink
Fix some sonnar issues, #TASK-5789
Browse files Browse the repository at this point in the history
  • Loading branch information
jtarraga committed Mar 15, 2024
1 parent 2dbd3b4 commit 0b173e9
Showing 1 changed file with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,10 @@ public CellBaseDataResult<Long> update(List objectList, String field, String[] i
CellBaseDataResult<Long> nLoadedObjects = null;
switch (field) {
case POP_FREQUENCIES_FIELD:
nLoadedObjects = updatePopulationFrequencies((List<Document>) objectList, dataRelease);
nLoadedObjects = updatePopulationFrequencies(objectList, dataRelease);
break;
case ANNOTATION_FIELD:
nLoadedObjects = updateAnnotation((List<Document>) objectList, innerFields, dataRelease);
nLoadedObjects = updateAnnotation(objectList, innerFields, dataRelease);
break;
default:
logger.error("Invalid field {}: no action implemented for updating this field.", field);
Expand Down Expand Up @@ -285,11 +285,13 @@ public Bson parseQuery(VariantQuery query) throws CellBaseException {
break;
case "ciStartLeft":
createImprecisePositionQueryStart(query, andBsonList);
break;
case "ciEndRight":
// don't do anything, this is parsed later
break;
case "ciEndLeft":
createImprecisePositionQueryEnd(query, andBsonList);
break;
case "gene":
createGeneOrQuery(query, andBsonList);
break;
Expand Down Expand Up @@ -359,7 +361,7 @@ private void createTypeQuery(VariantQuery query, String typeMongoField, String s
andBsonList.add(Filters.or(orBsonList));
// Inversion or just CNV (without subtype)
} else {
andBsonList.add(Filters.eq(typeMongoField, variantTypeString.toString()));
andBsonList.add(Filters.eq(typeMongoField, variantTypeString));
}
}
}
Expand Down Expand Up @@ -450,7 +452,7 @@ private CellBaseDataResult<Long> updateAnnotation(List<Document> variantDocument
for (Document variantDBObject : variantDocumentList) {
Document annotationDBObject = (Document) variantDBObject.get(ANNOTATION_FIELD);
Document toOverwrite = new Document();
if (innerFields != null & innerFields.length > 0) {
if (innerFields != null && innerFields.length > 0) {
for (String field : innerFields) {
if (annotationDBObject.get(field) != null) {
toOverwrite.put(ANNOTATION_FIELD + "." + field, annotationDBObject.get(field));
Expand Down Expand Up @@ -810,7 +812,8 @@ private List<String> getVariantIds(List<String> ids, int dataRelease) throws Cel

// 2. We must exclude as much information as possible to improve performance
MongoDBCollection mongoDBCollection = getCollectionByRelease(snpDBCollectionByRelease, dataRelease);
DataResult<Snp> snpDataResult = mongoDBCollection.find(query, Projections.exclude("annotation"), Snp.class, new QueryOptions());
DataResult<Snp> snpDataResult = mongoDBCollection.find(query, Projections.exclude(ANNOTATION_FIELD), Snp.class,
new QueryOptions());

// 3. Build the variant IDs
Set<String> results = new HashSet<>();
Expand Down

0 comments on commit 0b173e9

Please sign in to comment.