Search in sources :

Example 11 with SequencingReadAnalysis

use of org.icgc.dcc.song.server.model.analysis.SequencingReadAnalysis in project SONG by overture-stack.

the class UploadServiceTest method testNullSyncSequencingRead.

@Test
public void testNullSyncSequencingRead() {
    val filename1 = "documents/deserialization/sequencingread-deserialize1.json";
    val uploadId1 = uploadFromTestDir(DEFAULT_STUDY, filename1, false);
    val saveStatus1 = uploadService.save(DEFAULT_STUDY, uploadId1, false);
    val analysisStatus1 = fromStatus(saveStatus1, "status");
    assertThat(analysisStatus1).isEqualTo("ok");
    val analysisId1 = fromStatus(saveStatus1, "analysisId");
    val a1 = analysisService.read(analysisId1);
    val sa1 = ((SequencingReadAnalysis) a1).getExperiment();
    assertThat(sa1.getAligned()).isNull();
    assertThat(sa1.getAlignmentTool()).isNull();
    assertThat(sa1.getInsertSize()).isNull();
    assertThat(sa1.getLibraryStrategy()).isEqualTo("WXS");
    assertThat(sa1.getPairedEnd()).isNull();
    assertThat(sa1.getReferenceGenome()).isNull();
    assertThat(sa1.getInfo().path("random").isNull()).isTrue();
    val filename2 = "documents/deserialization/sequencingread-deserialize2.json";
    val uploadId2 = uploadFromTestDir(DEFAULT_STUDY, filename2, false);
    val saveStatus2 = uploadService.save(DEFAULT_STUDY, uploadId2, false);
    val analysisStatus2 = fromStatus(saveStatus2, "status");
    assertThat(analysisStatus2).isEqualTo("ok");
    val analysisId2 = fromStatus(saveStatus2, "analysisId");
    val a2 = analysisService.read(analysisId2);
    val sa2 = ((SequencingReadAnalysis) a2).getExperiment();
    assertThat(sa2.getAligned()).isNull();
    assertThat(sa2.getAlignmentTool()).isNull();
    assertThat(sa2.getInsertSize()).isNull();
    assertThat(sa2.getLibraryStrategy()).isEqualTo("WXS");
    assertThat(sa2.getPairedEnd()).isTrue();
    assertThat(sa2.getReferenceGenome()).isNull();
}
Also used : lombok.val(lombok.val) SequencingReadAnalysis(org.icgc.dcc.song.server.model.analysis.SequencingReadAnalysis) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 12 with SequencingReadAnalysis

use of org.icgc.dcc.song.server.model.analysis.SequencingReadAnalysis in project SONG by overture-stack.

the class AnalysisService method updateAnalysis.

public ResponseEntity<String> updateAnalysis(String studyId, Analysis analysis) {
    val id = analysis.getAnalysisId();
    repository.deleteCompositeEntities(id);
    saveCompositeEntities(studyId, id, analysis.getSample());
    repository.deleteFiles(id);
    analysis.getFile().forEach(f -> fileInfoService.delete(f.getObjectId()));
    saveFiles(id, studyId, analysis.getFile());
    analysisInfoService.update(id, analysis.getInfoAsString());
    if (analysis instanceof SequencingReadAnalysis) {
        val experiment = ((SequencingReadAnalysis) analysis).getExperiment();
        updateSequencingRead(id, experiment);
    } else if (analysis instanceof VariantCallAnalysis) {
        val experiment = ((VariantCallAnalysis) analysis).getExperiment();
        updateVariantCall(id, experiment);
    }
    return ok("AnalysisId %s was updated successfully", analysis.getAnalysisId());
}
Also used : lombok.val(lombok.val) SequencingReadAnalysis(org.icgc.dcc.song.server.model.analysis.SequencingReadAnalysis) VariantCallAnalysis(org.icgc.dcc.song.server.model.analysis.VariantCallAnalysis)

Example 13 with SequencingReadAnalysis

use of org.icgc.dcc.song.server.model.analysis.SequencingReadAnalysis in project SONG by overture-stack.

the class AnalysisConverter method buildSequencingReadAnalysis.

private static SequencingReadAnalysis buildSequencingReadAnalysis(SeqReadAggregate seqReadAggregate) {
    val analysisType = AnalysisTypes.resolve(seqReadAggregate.getType());
    checkState(analysisType == SEQUENCING_READ, "The input SeqReadAggregate[%s] is NOT of analysisType [%s]", seqReadAggregate, SEQUENCING_READ.getAnalysisTypeName());
    val sequencingReadAnalysis = new SequencingReadAnalysis();
    val analysisId = seqReadAggregate.getAnalysisId();
    sequencingReadAnalysis.setAnalysisId(analysisId);
    sequencingReadAnalysis.setAnalysisState(PUBLISHED.toString());
    sequencingReadAnalysis.setStudy(seqReadAggregate.getStudyId());
    sequencingReadAnalysis.setInfo(NA);
    val sequencingReadExperiment = SequencingRead.create(seqReadAggregate.getAnalysisId(), seqReadAggregate.isAligned(), seqReadAggregate.getAlignmentTool(), NULL_INSERT_SIZE, seqReadAggregate.getLibraryStrategy(), DEFAULT_SEQUENCING_READ_IS_PAIRED, seqReadAggregate.getReferenceGenome());
    sequencingReadAnalysis.setExperiment(sequencingReadExperiment);
    return sequencingReadAnalysis;
}
Also used : lombok.val(lombok.val) SequencingReadAnalysis(org.icgc.dcc.song.server.model.analysis.SequencingReadAnalysis)

Aggregations

lombok.val (lombok.val)13 SequencingReadAnalysis (org.icgc.dcc.song.server.model.analysis.SequencingReadAnalysis)13 Test (org.junit.Test)8 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)5 VariantCallAnalysis (org.icgc.dcc.song.server.model.analysis.VariantCallAnalysis)4 CompositeEntity (org.icgc.dcc.song.server.model.entity.composites.CompositeEntity)3 Maps (com.google.common.collect.Maps)2 Collectors.toSet (java.util.stream.Collectors.toSet)2 Slf4j (lombok.extern.slf4j.Slf4j)2 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)2 RandomGenerator (org.icgc.dcc.song.core.utils.RandomGenerator)2 RandomGenerator.createRandomGenerator (org.icgc.dcc.song.core.utils.RandomGenerator.createRandomGenerator)2 Metadata (org.icgc.dcc.song.server.model.Metadata)2 File (org.icgc.dcc.song.server.model.entity.File)2 Sample (org.icgc.dcc.song.server.model.entity.Sample)2 JsonNode (com.fasterxml.jackson.databind.JsonNode)1 WireMock.aResponse (com.github.tomakehurst.wiremock.client.WireMock.aResponse)1 WireMock.get (com.github.tomakehurst.wiremock.client.WireMock.get)1 WireMock.urlMatching (com.github.tomakehurst.wiremock.client.WireMock.urlMatching)1 WireMockConfiguration.options (com.github.tomakehurst.wiremock.core.WireMockConfiguration.options)1