variantAnnotations = new HashMap<>();
- for (Annotation annotation : annotations) {
+ for (AnnotationMongo annotation : annotations) {
String id = annotation.getId();
variantAnnotations.putIfAbsent(id, new VariantAnnotation(annotation));
variantAnnotations.computeIfPresent(id, (key, oldVar) -> oldVar.concatenate(annotation));
diff --git a/src/main/java/uk/ac/ebi/eva/pipeline/io/writers/AnnotationMongoWriter.java b/src/main/java/uk/ac/ebi/eva/pipeline/io/writers/AnnotationMongoWriter.java
index 71f9a60ef..e88bd090e 100644
--- a/src/main/java/uk/ac/ebi/eva/pipeline/io/writers/AnnotationMongoWriter.java
+++ b/src/main/java/uk/ac/ebi/eva/pipeline/io/writers/AnnotationMongoWriter.java
@@ -27,10 +27,10 @@
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.data.mongodb.core.query.Update;
import org.springframework.util.Assert;
-import uk.ac.ebi.eva.commons.models.mongo.entity.Annotation;
-import uk.ac.ebi.eva.commons.models.mongo.entity.projections.SimplifiedAnnotation;
-import uk.ac.ebi.eva.commons.models.mongo.entity.subdocuments.ConsequenceType;
-import uk.ac.ebi.eva.commons.models.mongo.entity.subdocuments.Xref;
+import uk.ac.ebi.eva.commons.mongodb.entities.AnnotationMongo;
+import uk.ac.ebi.eva.commons.mongodb.entities.projections.SimplifiedAnnotation;
+import uk.ac.ebi.eva.commons.mongodb.entities.subdocuments.ConsequenceTypeMongo;
+import uk.ac.ebi.eva.commons.mongodb.entities.subdocuments.XrefMongo;
import uk.ac.ebi.eva.utils.MongoDBHelper;
import java.util.Collection;
@@ -38,11 +38,11 @@
import java.util.List;
import java.util.Map;
-import static uk.ac.ebi.eva.commons.models.mongo.entity.Annotation.CONSEQUENCE_TYPE_FIELD;
-import static uk.ac.ebi.eva.commons.models.mongo.entity.Annotation.XREFS_FIELD;
+import static uk.ac.ebi.eva.commons.mongodb.entities.AnnotationMongo.CONSEQUENCE_TYPE_FIELD;
+import static uk.ac.ebi.eva.commons.mongodb.entities.AnnotationMongo.XREFS_FIELD;
/**
- * Write a list of {@link Annotation} into MongoDB
+ * Write a list of {@link AnnotationMongo} into MongoDB
*
* A new annotation is added in the existing document.
* In case of two annotations (or more) in the same variant the other annotations are appended:
@@ -63,12 +63,12 @@
* { "id" : "ENST00000608838", "src" : "ensemblTranscript" },
* { "id" : "ENSG00000178591", "src" : "ensemblGene"
*/
-public class AnnotationMongoWriter implements ItemWriter> {
+public class AnnotationMongoWriter implements ItemWriter> {
- private static final String ANNOTATION_XREF_ID_FIELD = Annotation.XREFS_FIELD + "." + Xref.XREF_ID_FIELD;
+ private static final String ANNOTATION_XREF_ID_FIELD = XREFS_FIELD + "." + XrefMongo.XREF_ID_FIELD;
- private static final String ANNOTATION_CT_SO_FIELD = Annotation.CONSEQUENCE_TYPE_FIELD + "."
- + ConsequenceType.SO_ACCESSION_FIELD;
+ private static final String ANNOTATION_CT_SO_FIELD = CONSEQUENCE_TYPE_FIELD + "."
+ + ConsequenceTypeMongo.SO_ACCESSION_FIELD;
public static final String EACH = "$each";
public static final String ADD_TO_SET = "$addToSet";
@@ -86,24 +86,24 @@ public AnnotationMongoWriter(MongoOperations mongoOperations, String collection)
}
@Override
- public void write(List extends List> annotations) throws Exception {
- for (List annotationList : annotations) {
+ public void write(List extends List> annotations) throws Exception {
+ for (List annotationList : annotations) {
BulkOperations bulk = mongoOperations.bulkOps(BulkOperations.BulkMode.UNORDERED, collection);
prepareBulk(annotationList, bulk);
bulk.execute();
}
}
- private void prepareBulk(List extends Annotation> annotations, BulkOperations bulk) {
- Map annotationsByStorageId = groupAnnotationById(annotations);
- for (Annotation annotation : annotationsByStorageId.values()) {
+ private void prepareBulk(List extends AnnotationMongo> annotations, BulkOperations bulk) {
+ Map annotationsByStorageId = groupAnnotationById(annotations);
+ for (AnnotationMongo annotation : annotationsByStorageId.values()) {
writeAnnotationInMongoDb(bulk, annotation);
}
}
- private Map groupAnnotationById(List extends Annotation> annotations) {
- Map groupedAnnotations = new HashMap<>();
- for (Annotation annotation : annotations) {
+ private Map groupAnnotationById(List extends AnnotationMongo> annotations) {
+ Map groupedAnnotations = new HashMap<>();
+ for (AnnotationMongo annotation : annotations) {
String id = annotation.getId();
groupedAnnotations.computeIfPresent(id, (key, oldVar) -> oldVar.concatenate(annotation));
groupedAnnotations.putIfAbsent(id, annotation);
@@ -111,24 +111,24 @@ private Map groupAnnotationById(List extends Annotation> a
return groupedAnnotations;
}
- private void writeAnnotationInMongoDb(BulkOperations bulk, Annotation annotation) {
+ private void writeAnnotationInMongoDb(BulkOperations bulk, AnnotationMongo annotation) {
Query upsertQuery = new BasicQuery(convertToMongo(new SimplifiedAnnotation(annotation)));
Update update = buildUpdateQuery(annotation);
bulk.upsert(upsertQuery, update);
}
- private BasicUpdate buildUpdateQuery(Annotation annotation) {
+ private BasicUpdate buildUpdateQuery(AnnotationMongo annotation) {
final BasicDBObject addToSetValue = new BasicDBObject();
addToSetValue.append(CONSEQUENCE_TYPE_FIELD, buildInsertConsequenceTypeQuery(annotation));
addToSetValue.append(XREFS_FIELD, buildInsertXrefsQuery(annotation));
return new BasicUpdate(new BasicDBObject(ADD_TO_SET, addToSetValue));
}
- private BasicDBObject buildInsertXrefsQuery(Annotation annotation) {
+ private BasicDBObject buildInsertXrefsQuery(AnnotationMongo annotation) {
return new BasicDBObject(EACH, convertToMongo(annotation.getXrefs()));
}
- private BasicDBObject buildInsertConsequenceTypeQuery(Annotation annotation) {
+ private BasicDBObject buildInsertConsequenceTypeQuery(AnnotationMongo annotation) {
return new BasicDBObject(EACH, convertToMongo(annotation.getConsequenceTypes()));
}
diff --git a/src/main/java/uk/ac/ebi/eva/pipeline/io/writers/VariantMongoWriter.java b/src/main/java/uk/ac/ebi/eva/pipeline/io/writers/VariantMongoWriter.java
index 77dc67b60..0362ce2e6 100644
--- a/src/main/java/uk/ac/ebi/eva/pipeline/io/writers/VariantMongoWriter.java
+++ b/src/main/java/uk/ac/ebi/eva/pipeline/io/writers/VariantMongoWriter.java
@@ -29,7 +29,7 @@
import uk.ac.ebi.eva.commons.models.data.VariantStats;
import uk.ac.ebi.eva.commons.models.mongo.entity.VariantDocument;
import uk.ac.ebi.eva.commons.models.mongo.entity.projections.SimplifiedVariant;
-import uk.ac.ebi.eva.commons.models.mongo.entity.subdocuments.VariantSourceEntryMongo;
+import uk.ac.ebi.eva.commons.mongodb.entities.subdocuments.VariantSourceEntryMongo;
import uk.ac.ebi.eva.commons.models.mongo.entity.subdocuments.VariantStatsMongo;
import uk.ac.ebi.eva.utils.MongoDBHelper;
diff --git a/src/main/java/uk/ac/ebi/eva/pipeline/jobs/steps/processors/AnnotationParserProcessor.java b/src/main/java/uk/ac/ebi/eva/pipeline/jobs/steps/processors/AnnotationParserProcessor.java
index 3b7e26376..d3be3bf35 100644
--- a/src/main/java/uk/ac/ebi/eva/pipeline/jobs/steps/processors/AnnotationParserProcessor.java
+++ b/src/main/java/uk/ac/ebi/eva/pipeline/jobs/steps/processors/AnnotationParserProcessor.java
@@ -17,7 +17,7 @@
import org.springframework.batch.item.ItemProcessor;
-import uk.ac.ebi.eva.commons.models.mongo.entity.Annotation;
+import uk.ac.ebi.eva.commons.mongodb.entities.AnnotationMongo;
import uk.ac.ebi.eva.pipeline.io.VepProcess;
import uk.ac.ebi.eva.pipeline.io.mappers.AnnotationLineMapper;
import uk.ac.ebi.eva.pipeline.parameters.AnnotationParameters;
@@ -29,7 +29,7 @@
* ItemStreamWriter that takes VariantWrappers and serialize them into a {@link VepProcess}, which will be responsible
* for annotating the variants and writing them to a file.
*/
-public class AnnotationParserProcessor implements ItemProcessor, List> {
+public class AnnotationParserProcessor implements ItemProcessor, List> {
private static final int UNUSED_LINE_NUMBER = 0;
@@ -41,7 +41,7 @@ public AnnotationParserProcessor(AnnotationParameters annotationParameters) {
}
@Override
- public List process(List ensemblVariants) throws Exception {
+ public List process(List ensemblVariants) throws Exception {
return ensemblVariants.stream()
.map(ensemblVariant -> annotationLineMapper.mapLine(ensemblVariant, UNUSED_LINE_NUMBER))
.collect(Collectors.toList());
diff --git a/src/main/java/uk/ac/ebi/eva/pipeline/jobs/steps/tasklets/AnnotationMetadataTasklet.java b/src/main/java/uk/ac/ebi/eva/pipeline/jobs/steps/tasklets/AnnotationMetadataTasklet.java
index 9ecfff5dd..277e2d0a5 100644
--- a/src/main/java/uk/ac/ebi/eva/pipeline/jobs/steps/tasklets/AnnotationMetadataTasklet.java
+++ b/src/main/java/uk/ac/ebi/eva/pipeline/jobs/steps/tasklets/AnnotationMetadataTasklet.java
@@ -24,7 +24,7 @@
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
-import uk.ac.ebi.eva.commons.models.metadata.AnnotationMetadata;
+import uk.ac.ebi.eva.commons.core.models.AnnotationMetadata;
import uk.ac.ebi.eva.pipeline.parameters.AnnotationParameters;
import uk.ac.ebi.eva.pipeline.parameters.DatabaseParameters;
diff --git a/src/test/java/uk/ac/ebi/eva/commons/models/converters/data/VariantSourceEntryToDBObjectConverterTest.java b/src/test/java/uk/ac/ebi/eva/commons/models/converters/data/VariantSourceEntryToDBObjectConverterTest.java
index 78b5b2e74..3e6359f7a 100644
--- a/src/test/java/uk/ac/ebi/eva/commons/models/converters/data/VariantSourceEntryToDBObjectConverterTest.java
+++ b/src/test/java/uk/ac/ebi/eva/commons/models/converters/data/VariantSourceEntryToDBObjectConverterTest.java
@@ -26,7 +26,7 @@
import org.springframework.test.context.TestPropertySource;
import org.springframework.test.context.junit4.SpringRunner;
import uk.ac.ebi.eva.commons.models.data.VariantSourceEntry;
-import uk.ac.ebi.eva.commons.models.mongo.entity.subdocuments.VariantSourceEntryMongo;
+import uk.ac.ebi.eva.commons.mongodb.entities.subdocuments.VariantSourceEntryMongo;
import uk.ac.ebi.eva.test.configuration.MongoOperationConfiguration;
import java.util.Arrays;
@@ -34,10 +34,10 @@
import java.util.Map;
import static org.junit.Assert.assertEquals;
-import static uk.ac.ebi.eva.commons.models.mongo.entity.subdocuments.VariantSourceEntryMongo.ATTRIBUTES_FIELD;
-import static uk.ac.ebi.eva.commons.models.mongo.entity.subdocuments.VariantSourceEntryMongo.CHARACTER_TO_REPLACE_DOTS;
-import static uk.ac.ebi.eva.commons.models.mongo.entity.subdocuments.VariantSourceEntryMongo.FILEID_FIELD;
-import static uk.ac.ebi.eva.commons.models.mongo.entity.subdocuments.VariantSourceEntryMongo.STUDYID_FIELD;
+import static uk.ac.ebi.eva.commons.mongodb.entities.subdocuments.VariantSourceEntryMongo.ATTRIBUTES_FIELD;
+import static uk.ac.ebi.eva.commons.mongodb.entities.subdocuments.VariantSourceEntryMongo.CHARACTER_TO_REPLACE_DOTS;
+import static uk.ac.ebi.eva.commons.mongodb.entities.subdocuments.VariantSourceEntryMongo.FILEID_FIELD;
+import static uk.ac.ebi.eva.commons.mongodb.entities.subdocuments.VariantSourceEntryMongo.STUDYID_FIELD;
/**
* Tests automatic conversion from {@link VariantSourceEntryMongo} to {@link DBObject}
@@ -63,6 +63,7 @@ public void setUp() {
file.addAttribute("QUAL", "0.01");
file.addAttribute("AN", "2");
file.addAttribute("MAX.PROC", "2");
+ file.setFormat("gzip");
Map na001 = new HashMap<>();
na001.put("GT", "0/0");
@@ -88,6 +89,7 @@ public void setUp() {
((DBObject) mongoFileWithIds.get("samp")).put("def", "0/0");
((DBObject) mongoFileWithIds.get("samp")).put("0/1", Arrays.asList(indexNa002));
((DBObject) mongoFileWithIds.get("samp")).put("1/1", Arrays.asList(indexNa003));
+ mongoFileWithIds.put("fm", "gzip");
}
@Test
diff --git a/src/test/java/uk/ac/ebi/eva/commons/models/converters/data/VariantToDBObjectConverterTest.java b/src/test/java/uk/ac/ebi/eva/commons/models/converters/data/VariantToDBObjectConverterTest.java
index c57269419..b87290e3d 100644
--- a/src/test/java/uk/ac/ebi/eva/commons/models/converters/data/VariantToDBObjectConverterTest.java
+++ b/src/test/java/uk/ac/ebi/eva/commons/models/converters/data/VariantToDBObjectConverterTest.java
@@ -28,8 +28,8 @@
import uk.ac.ebi.eva.commons.models.data.Variant;
import uk.ac.ebi.eva.commons.models.data.VariantSourceEntry;
import uk.ac.ebi.eva.commons.models.mongo.entity.VariantDocument;
-import uk.ac.ebi.eva.commons.models.mongo.entity.subdocuments.HgvsMongo;
-import uk.ac.ebi.eva.commons.models.mongo.entity.subdocuments.VariantSourceEntryMongo;
+import uk.ac.ebi.eva.commons.mongodb.entities.subdocuments.HgvsMongo;
+import uk.ac.ebi.eva.commons.mongodb.entities.subdocuments.VariantSourceEntryMongo;
import uk.ac.ebi.eva.test.configuration.MongoOperationConfiguration;
import java.util.ArrayList;
diff --git a/src/test/java/uk/ac/ebi/eva/pipeline/configuration/jobs/AnnotationJobTest.java b/src/test/java/uk/ac/ebi/eva/pipeline/configuration/jobs/AnnotationJobTest.java
index 89b978819..e34403ae6 100644
--- a/src/test/java/uk/ac/ebi/eva/pipeline/configuration/jobs/AnnotationJobTest.java
+++ b/src/test/java/uk/ac/ebi/eva/pipeline/configuration/jobs/AnnotationJobTest.java
@@ -46,7 +46,7 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
-import static uk.ac.ebi.eva.commons.models.mongo.entity.Annotation.CONSEQUENCE_TYPE_FIELD;
+import static uk.ac.ebi.eva.commons.mongodb.entities.AnnotationMongo.CONSEQUENCE_TYPE_FIELD;
import static uk.ac.ebi.eva.test.utils.JobTestUtils.assertCompleted;
import static uk.ac.ebi.eva.test.utils.TestFileUtils.getResourceUrl;
import static uk.ac.ebi.eva.utils.FileUtils.getResource;
diff --git a/src/test/java/uk/ac/ebi/eva/pipeline/configuration/jobs/steps/AnnotationMetadataStepTest.java b/src/test/java/uk/ac/ebi/eva/pipeline/configuration/jobs/steps/AnnotationMetadataStepTest.java
index f78e92f78..06c981d4e 100644
--- a/src/test/java/uk/ac/ebi/eva/pipeline/configuration/jobs/steps/AnnotationMetadataStepTest.java
+++ b/src/test/java/uk/ac/ebi/eva/pipeline/configuration/jobs/steps/AnnotationMetadataStepTest.java
@@ -32,7 +32,7 @@
import org.springframework.test.context.TestPropertySource;
import org.springframework.test.context.junit4.SpringRunner;
-import uk.ac.ebi.eva.commons.models.metadata.AnnotationMetadata;
+import uk.ac.ebi.eva.commons.core.models.AnnotationMetadata;
import uk.ac.ebi.eva.pipeline.Application;
import uk.ac.ebi.eva.pipeline.configuration.BeanNames;
import uk.ac.ebi.eva.pipeline.configuration.MongoConfiguration;
diff --git a/src/test/java/uk/ac/ebi/eva/pipeline/io/mappers/AnnotationLineMapperTest.java b/src/test/java/uk/ac/ebi/eva/pipeline/io/mappers/AnnotationLineMapperTest.java
index e95bf1b30..c85de3516 100644
--- a/src/test/java/uk/ac/ebi/eva/pipeline/io/mappers/AnnotationLineMapperTest.java
+++ b/src/test/java/uk/ac/ebi/eva/pipeline/io/mappers/AnnotationLineMapperTest.java
@@ -17,9 +17,9 @@
import org.junit.Test;
-import uk.ac.ebi.eva.commons.models.mongo.entity.Annotation;
-import uk.ac.ebi.eva.commons.models.mongo.entity.subdocuments.ConsequenceType;
-import uk.ac.ebi.eva.commons.models.mongo.entity.subdocuments.Score;
+import uk.ac.ebi.eva.commons.mongodb.entities.AnnotationMongo;
+import uk.ac.ebi.eva.commons.mongodb.entities.subdocuments.ConsequenceTypeMongo;
+import uk.ac.ebi.eva.commons.mongodb.entities.subdocuments.ScoreMongo;
import uk.ac.ebi.eva.test.data.VepOutputContent;
import java.util.Set;
@@ -43,7 +43,7 @@ public class AnnotationLineMapperTest {
public void shouldParseAllDefaultFieldsInVepOutput() throws Exception {
AnnotationLineMapper lineMapper = new AnnotationLineMapper(VEP_VERSION, VEP_CACHE_VERSION);
for (String annotLine : VepOutputContent.vepOutputContent.split("\n")) {
- Annotation annotation = lineMapper.mapLine(annotLine, 0);
+ AnnotationMongo annotation = lineMapper.mapLine(annotLine, 0);
assertNotNull(annotation.getConsequenceTypes());
}
}
@@ -51,13 +51,13 @@ public void shouldParseAllDefaultFieldsInVepOutput() throws Exception {
@Test
public void shouldParseAllTranscriptFieldsInVepOutput() {
AnnotationLineMapper lineMapper = new AnnotationLineMapper(VEP_VERSION, VEP_CACHE_VERSION);
- Annotation annotation = lineMapper.mapLine(VepOutputContent.vepOutputContentTranscriptFields, 0);
- Set consequenceTypes = annotation.getConsequenceTypes();
+ AnnotationMongo annotation = lineMapper.mapLine(VepOutputContent.vepOutputContentTranscriptFields, 0);
+ Set consequenceTypes = annotation.getConsequenceTypes();
assertNotNull(consequenceTypes);
assertEquals(1, consequenceTypes.size());
- ConsequenceType consequenceType = consequenceTypes.iterator().next();
+ ConsequenceTypeMongo consequenceType = consequenceTypes.iterator().next();
assertEquals(Integer.valueOf(1), consequenceType.getcDnaPosition());
assertEquals(Integer.valueOf(4), consequenceType.getCdsPosition());
@@ -69,13 +69,13 @@ public void shouldParseAllTranscriptFieldsInVepOutput() {
@Test
public void shouldParseVepOutputWithoutTranscript() {
AnnotationLineMapper lineMapper = new AnnotationLineMapper(VEP_VERSION, VEP_CACHE_VERSION);
- Annotation annotation = lineMapper.mapLine(VepOutputContent.vepOutputContentWithOutTranscript, 0);
- Set consequenceTypes = annotation.getConsequenceTypes();
+ AnnotationMongo annotation = lineMapper.mapLine(VepOutputContent.vepOutputContentWithOutTranscript, 0);
+ Set consequenceTypes = annotation.getConsequenceTypes();
assertNotNull(consequenceTypes);
assertEquals(1, consequenceTypes.size());
- ConsequenceType consequenceType = consequenceTypes.iterator().next();
+ ConsequenceTypeMongo consequenceType = consequenceTypes.iterator().next();
assertNotNull(consequenceType.getSoAccessions());
assertNull(consequenceType.getcDnaPosition());
@@ -94,7 +94,7 @@ public void shouldNotParseVepOutputWithMalformedCoordinates() {
@Test
public void shouldParseVepOutputWithChromosomeIdWithUnderscore() {
AnnotationLineMapper lineMapper = new AnnotationLineMapper(VEP_VERSION, VEP_CACHE_VERSION);
- Annotation annotation = lineMapper
+ AnnotationMongo annotation = lineMapper
.mapLine(VepOutputContent.vepOutputContentChromosomeIdWithUnderscore, 0);
assertEquals("20_1", annotation.getChromosome());
@@ -109,23 +109,23 @@ public void shouldNotParseVepOutputWithMalformedVariantFields() {
@Test
public void shouldParseVepOutputWithExtraFields() {
AnnotationLineMapper lineMapper = new AnnotationLineMapper(VEP_VERSION, VEP_CACHE_VERSION);
- Annotation annotation = lineMapper.mapLine(VepOutputContent.vepOutputContentWithExtraFieldsSingleAnnotation, 0);
+ AnnotationMongo annotation = lineMapper.mapLine(VepOutputContent.vepOutputContentWithExtraFieldsSingleAnnotation, 0);
- Set consequenceTypes = annotation.getConsequenceTypes();
+ Set consequenceTypes = annotation.getConsequenceTypes();
assertNotNull(consequenceTypes);
assertEquals(1, consequenceTypes.size());
- ConsequenceType consequenceType = consequenceTypes.iterator().next();
+ ConsequenceTypeMongo consequenceType = consequenceTypes.iterator().next();
- Score polyphen = consequenceType.getPolyphen();
- Score sifts = consequenceType.getSift();
+ ScoreMongo polyphen = consequenceType.getPolyphen();
+ ScoreMongo sifts = consequenceType.getSift();
assertNotNull(polyphen);
assertNotNull(sifts);
- Score expectedSift = new Score(0.07, "tolerated");
- Score expectedPolyphen = new Score(0.859, "possibly_damaging");
+ ScoreMongo expectedSift = new ScoreMongo(0.07, "tolerated");
+ ScoreMongo expectedPolyphen = new ScoreMongo(0.859, "possibly_damaging");
assertEquals(expectedSift, sifts);
assertEquals(expectedPolyphen, polyphen);
diff --git a/src/test/java/uk/ac/ebi/eva/pipeline/io/readers/AnnotationFlatFileReaderTest.java b/src/test/java/uk/ac/ebi/eva/pipeline/io/readers/AnnotationFlatFileReaderTest.java
index 27d6d5f0b..0066cd48f 100644
--- a/src/test/java/uk/ac/ebi/eva/pipeline/io/readers/AnnotationFlatFileReaderTest.java
+++ b/src/test/java/uk/ac/ebi/eva/pipeline/io/readers/AnnotationFlatFileReaderTest.java
@@ -21,7 +21,7 @@
import org.springframework.batch.item.file.FlatFileParseException;
import org.springframework.batch.test.MetaDataInstanceFactory;
-import uk.ac.ebi.eva.commons.models.mongo.entity.Annotation;
+import uk.ac.ebi.eva.commons.mongodb.entities.AnnotationMongo;
import uk.ac.ebi.eva.test.data.VepOutputContent;
import uk.ac.ebi.eva.test.rules.PipelineTemporaryFolderRule;
import uk.ac.ebi.eva.test.utils.JobTestUtils;
@@ -60,7 +60,7 @@ public void shouldReadAllLinesInVepOutput() throws Exception {
annotationFlatFileReader.setSaveState(false);
annotationFlatFileReader.open(executionContext);
- Annotation annotation;
+ AnnotationMongo annotation;
int consequenceTypeCount = 0;
int count = 0;
while ((annotation = annotationFlatFileReader.read()) != null) {
diff --git a/src/test/java/uk/ac/ebi/eva/pipeline/io/writers/AnnotationInVariantMongoWriterTest.java b/src/test/java/uk/ac/ebi/eva/pipeline/io/writers/AnnotationInVariantMongoWriterTest.java
index dd64f72c5..afddd1b1f 100644
--- a/src/test/java/uk/ac/ebi/eva/pipeline/io/writers/AnnotationInVariantMongoWriterTest.java
+++ b/src/test/java/uk/ac/ebi/eva/pipeline/io/writers/AnnotationInVariantMongoWriterTest.java
@@ -31,7 +31,7 @@
import org.springframework.test.context.TestPropertySource;
import org.springframework.test.context.junit4.SpringRunner;
-import uk.ac.ebi.eva.commons.models.mongo.entity.Annotation;
+import uk.ac.ebi.eva.commons.mongodb.entities.AnnotationMongo;
import uk.ac.ebi.eva.commons.models.mongo.entity.VariantDocument;
import uk.ac.ebi.eva.pipeline.Application;
import uk.ac.ebi.eva.pipeline.configuration.MongoConfiguration;
@@ -96,9 +96,9 @@ public void shouldWriteAllFieldsIntoMongoDb() throws Exception {
String databaseName = mongoRule.restoreDumpInTemporaryDatabase(getResourceUrl(MONGO_DUMP));
//prepare annotation sets
- List annotationSet1 = new ArrayList<>();
- List annotationSet2 = new ArrayList<>();
- List annotationSet3 = new ArrayList<>();
+ List annotationSet1 = new ArrayList<>();
+ List annotationSet2 = new ArrayList<>();
+ List annotationSet3 = new ArrayList<>();
String[] vepOutputLines = vepOutputContentWithExtraFields.split("\n");
@@ -180,7 +180,7 @@ public void shouldUpdateFieldsOfExistingAnnotationVersion() throws Exception {
String[] vepOutputLines = vepOutputContentWithExtraFields.split("\n");
- List annotations = new ArrayList<>();
+ List annotations = new ArrayList<>();
annotations.add(annotationLineMapper.mapLine(vepOutputLines[1], 0));
annotations.add(annotationLineMapper.mapLine(vepOutputLines[2], 0));
@@ -209,10 +209,10 @@ public void shouldUpdateFieldsOfExistingAnnotationVersion() throws Exception {
"ENST00000608838")));
}
- private BasicDBList writeAndGetAnnotation(String databaseName, Annotation annotation) throws Exception {
+ private BasicDBList writeAndGetAnnotation(String databaseName, AnnotationMongo annotation) throws Exception {
annotationInVariantMongoWriter.write(Collections.singletonList(Collections.singletonList(annotation)));
- BasicDBObject query = new BasicDBObject(Annotation.START_FIELD, annotation.getStart());
+ BasicDBObject query = new BasicDBObject(AnnotationMongo.START_FIELD, annotation.getStart());
DBCursor cursor = mongoRule.getCollection(databaseName, COLLECTION_VARIANTS_NAME).find(query);
assertTrue(cursor.hasNext());
@@ -233,8 +233,8 @@ public void shouldAddAnnotationIfVersionIsNotPresent() throws Exception {
String[] vepOutputLines = vepOutputContentWithExtraFields.split("\n");
- Annotation firstAnnotation = annotationLineMapper.mapLine(vepOutputLines[1], 0);
- Annotation differentVersionAnnotation = differentVersionAnnotationLineMapper.mapLine(vepOutputLines[2], 0);
+ AnnotationMongo firstAnnotation = annotationLineMapper.mapLine(vepOutputLines[1], 0);
+ AnnotationMongo differentVersionAnnotation = differentVersionAnnotationLineMapper.mapLine(vepOutputLines[2], 0);
// load the first annotation
MongoOperations operations = MongoConfiguration.getMongoOperations(databaseName, mongoConnection,
diff --git a/src/test/java/uk/ac/ebi/eva/pipeline/io/writers/AnnotationMongoWriterTest.java b/src/test/java/uk/ac/ebi/eva/pipeline/io/writers/AnnotationMongoWriterTest.java
index d3b0f6bf7..e02810672 100644
--- a/src/test/java/uk/ac/ebi/eva/pipeline/io/writers/AnnotationMongoWriterTest.java
+++ b/src/test/java/uk/ac/ebi/eva/pipeline/io/writers/AnnotationMongoWriterTest.java
@@ -31,9 +31,9 @@
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestPropertySource;
import org.springframework.test.context.junit4.SpringRunner;
-import uk.ac.ebi.eva.commons.models.mongo.entity.Annotation;
-import uk.ac.ebi.eva.commons.models.mongo.entity.subdocuments.ConsequenceType;
-import uk.ac.ebi.eva.commons.models.mongo.entity.subdocuments.Score;
+import uk.ac.ebi.eva.commons.mongodb.entities.AnnotationMongo;
+import uk.ac.ebi.eva.commons.mongodb.entities.subdocuments.ConsequenceTypeMongo;
+import uk.ac.ebi.eva.commons.mongodb.entities.subdocuments.ScoreMongo;
import uk.ac.ebi.eva.pipeline.Application;
import uk.ac.ebi.eva.pipeline.configuration.MongoConfiguration;
import uk.ac.ebi.eva.pipeline.io.mappers.AnnotationLineMapper;
@@ -57,10 +57,10 @@
import static uk.ac.ebi.eva.commons.models.mongo.entity.subdocuments.VariantAnnotation.POLYPHEN_FIELD;
import static uk.ac.ebi.eva.commons.models.mongo.entity.subdocuments.VariantAnnotation.SIFT_FIELD;
-import static uk.ac.ebi.eva.commons.models.mongo.entity.Annotation.CONSEQUENCE_TYPE_FIELD;
-import static uk.ac.ebi.eva.commons.models.mongo.entity.Annotation.XREFS_FIELD;
-import static uk.ac.ebi.eva.commons.models.mongo.entity.subdocuments.Score.SCORE_DESCRIPTION_FIELD;
-import static uk.ac.ebi.eva.commons.models.mongo.entity.subdocuments.Score.SCORE_SCORE_FIELD;
+import static uk.ac.ebi.eva.commons.mongodb.entities.AnnotationMongo.CONSEQUENCE_TYPE_FIELD;
+import static uk.ac.ebi.eva.commons.mongodb.entities.AnnotationMongo.XREFS_FIELD;
+import static uk.ac.ebi.eva.commons.mongodb.entities.subdocuments.ScoreMongo.SCORE_DESCRIPTION_FIELD;
+import static uk.ac.ebi.eva.commons.mongodb.entities.subdocuments.ScoreMongo.SCORE_SCORE_FIELD;
import static uk.ac.ebi.eva.test.data.VepOutputContent.vepOutputContent;
import static uk.ac.ebi.eva.test.utils.JobTestUtils.count;
@@ -104,7 +104,7 @@ public void setUp() throws Exception {
public void shouldWriteAllFieldsIntoMongoDb() throws Exception {
String databaseName = mongoRule.getRandomTemporaryDatabaseName();
- List annotations = new ArrayList<>();
+ List annotations = new ArrayList<>();
for (String annotLine : vepOutputContent.split("\n")) {
annotations.add(annotationLineMapper.mapLine(annotLine, 0));
}
@@ -143,9 +143,9 @@ public void shouldWriteAllFieldsIntoMongoDbMultipleSetsAnnotations() throws Exce
String databaseName = mongoRule.getRandomTemporaryDatabaseName();
//prepare annotation sets
- List annotationSet1 = new ArrayList<>();
- List annotationSet2 = new ArrayList<>();
- List annotationSet3 = new ArrayList<>();
+ List annotationSet1 = new ArrayList<>();
+ List annotationSet2 = new ArrayList<>();
+ List annotationSet3 = new ArrayList<>();
String[] vepOutputLines = vepOutputContent.split("\n");
@@ -188,17 +188,27 @@ public void shouldWriteAllFieldsIntoMongoDbMultipleSetsAnnotations() throws Exce
public void shouldWriteSubstitutionScoresIntoMongoDb() throws Exception {
String databaseName = mongoRule.getRandomTemporaryDatabaseName();
- Annotation annotation = new Annotation("X", 1, 10, "A", "T",
- VEP_VERSION, VEP_CACHE_VERSION);
+ ScoreMongo siftScore = new ScoreMongo(0.02, "deleterious");
+ ScoreMongo polyphenScore = new ScoreMongo(0.846, "possibly_damaging");
- Score siftScore = new Score(0.02, "deleterious");
- Score polyphenScore = new Score(0.846, "possibly_damaging");
-
- ConsequenceType consequenceType = new ConsequenceType();
+ ConsequenceTypeMongo consequenceType = new ConsequenceTypeMongo(null, null,
+ null, null, null, null, null, null,
+ null, null, null, null, null, null);
consequenceType.setSift(siftScore);
consequenceType.setPolyphen(polyphenScore);
- annotation.addConsequenceType(consequenceType);
+ AnnotationMongo annotation = new AnnotationMongo(
+ AnnotationMongo.buildAnnotationId("X", 1, "A", "T",
+ VEP_VERSION, VEP_CACHE_VERSION),
+ "X",
+ 1,
+ 10,
+ VEP_VERSION,
+ VEP_CACHE_VERSION,
+ null,
+ Collections.singleton(consequenceType));
+
+ annotation = annotation.concatenate(annotation);
MongoOperations operations = MongoConfiguration.getMongoOperations(databaseName, mongoConnection,
mongoMappingContext);
@@ -250,7 +260,7 @@ public void indexesShouldBeCreatedInBackground() throws UnknownHostException {
public void shouldUpdateFieldsOfExistingAnnotationVersion() throws Exception {
String databaseName = mongoRule.getRandomTemporaryDatabaseName();
- List annotations = new ArrayList<>();
+ List annotations = new ArrayList<>();
for (String annotLine : vepOutputContent.split("\n")) {
annotations.add(annotationLineMapper.mapLine(annotLine, 0));
}
@@ -283,9 +293,9 @@ public void shouldAddAnnotationIfAnnotationVersionIsNotPresent() throws Exceptio
String databaseName = mongoRule.getRandomTemporaryDatabaseName();
String annotLine = vepOutputContent.split("\n")[1];
- List> firstVersionAnnotation = Collections.singletonList(Collections.singletonList(
+ List> firstVersionAnnotation = Collections.singletonList(Collections.singletonList(
annotationLineMapper.mapLine(annotLine, 0)));
- List> secondVersionAnnotation = Collections.singletonList((Collections.singletonList(
+ List> secondVersionAnnotation = Collections.singletonList((Collections.singletonList(
differentVersionAnnotationLineMapper.mapLine(annotLine, 0))));
// load the annotation
diff --git a/src/test/java/uk/ac/ebi/eva/pipeline/jobs/steps/processors/AnnotationParserProcessorTest.java b/src/test/java/uk/ac/ebi/eva/pipeline/jobs/steps/processors/AnnotationParserProcessorTest.java
index 9bbc972db..f9dd233ce 100644
--- a/src/test/java/uk/ac/ebi/eva/pipeline/jobs/steps/processors/AnnotationParserProcessorTest.java
+++ b/src/test/java/uk/ac/ebi/eva/pipeline/jobs/steps/processors/AnnotationParserProcessorTest.java
@@ -18,7 +18,7 @@
import org.junit.Test;
-import uk.ac.ebi.eva.commons.models.mongo.entity.Annotation;
+import uk.ac.ebi.eva.commons.mongodb.entities.AnnotationMongo;
import uk.ac.ebi.eva.pipeline.parameters.AnnotationParameters;
import uk.ac.ebi.eva.test.data.VepOutputContent;
@@ -41,7 +41,7 @@ public void shouldParseAllDefaultFieldsInVepOutput() throws Exception {
AnnotationParserProcessor parser = new AnnotationParserProcessor(annotationParameters);
List textAnnotations = Arrays.asList(VepOutputContent.vepOutputContent.split("\n"));
- List annotations = parser.process(textAnnotations);
+ List annotations = parser.process(textAnnotations);
assertEquals(textAnnotations.size(), annotations.size());
}
diff --git a/src/test/java/uk/ac/ebi/eva/test/utils/GenotypedVcfJobTestUtils.java b/src/test/java/uk/ac/ebi/eva/test/utils/GenotypedVcfJobTestUtils.java
index 12ae3ba57..708eba4ae 100644
--- a/src/test/java/uk/ac/ebi/eva/test/utils/GenotypedVcfJobTestUtils.java
+++ b/src/test/java/uk/ac/ebi/eva/test/utils/GenotypedVcfJobTestUtils.java
@@ -23,7 +23,7 @@
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
-import static uk.ac.ebi.eva.commons.models.mongo.entity.Annotation.CONSEQUENCE_TYPE_FIELD;
+import static uk.ac.ebi.eva.commons.mongodb.entities.AnnotationMongo.CONSEQUENCE_TYPE_FIELD;
import static uk.ac.ebi.eva.test.utils.JobTestUtils.count;
import static uk.ac.ebi.eva.test.utils.JobTestUtils.getLines;
import static uk.ac.ebi.eva.utils.FileUtils.getResource;