Search in sources :

Example 6 with WorkflowInput

use of com.github.jmchilton.blend4j.galaxy.beans.WorkflowInputs.WorkflowInput in project irida by phac-nml.

the class AnalysisWorkspaceServiceGalaxyTest method testPrepareAnalysisFilesPairedSuccess.

/**
 * Tests out successfully to preparing an analysis with paired files
 *
 * @throws ExecutionManagerException
 * @throws IridaWorkflowException
 */
@SuppressWarnings("unchecked")
@Test
public void testPrepareAnalysisFilesPairedSuccess() throws ExecutionManagerException, IridaWorkflowException {
    Set<SequenceFilePair> pairedFiles = Sets.newHashSet(sampleSequenceFilePairMap.values());
    submission = AnalysisSubmission.builder(workflowId).name("my analysis").inputFiles(Sets.newHashSet(pairedFiles)).referenceFile(referenceFile).build();
    submission.setRemoteAnalysisId(HISTORY_ID);
    submission.setRemoteWorkflowId(WORKFLOW_ID);
    when(sequencingObjectService.getSequencingObjectsOfTypeForAnalysisSubmission(submission, SequenceFilePair.class)).thenReturn(pairedFiles);
    when(iridaWorkflowsService.getIridaWorkflow(workflowId)).thenReturn(iridaWorkflowPaired);
    when(galaxyHistoriesService.findById(HISTORY_ID)).thenReturn(workflowHistory);
    when(galaxyLibrariesService.buildEmptyLibrary(any(GalaxyProjectName.class))).thenReturn(workflowLibrary);
    when(sequencingObjectService.getUniqueSamplesForSequencingObjects(pairedFiles)).thenReturn(sampleSequenceFilePairMap);
    when(galaxyHistoriesService.fileToHistory(refFile, InputFileType.FASTA, workflowHistory)).thenReturn(refDataset);
    when(galaxyWorkflowService.getWorkflowDetails(WORKFLOW_ID)).thenReturn(workflowDetails);
    when(analysisParameterServiceGalaxy.prepareAnalysisParameters(any(Map.class), any(IridaWorkflow.class))).thenReturn(new WorkflowInputsGalaxy(new WorkflowInputs()));
    when(galaxyWorkflowService.getWorkflowInputId(workflowDetails, SEQUENCE_FILE_PAIRED_LABEL)).thenReturn(SEQUENCE_FILE_PAIRED_ID);
    when(galaxyWorkflowService.getWorkflowInputId(workflowDetails, REFERENCE_FILE_LABEL)).thenReturn(REFERENCE_FILE_ID);
    when(analysisCollectionServiceGalaxy.uploadSequenceFilesPaired(any(Map.class), eq(workflowHistory), eq(workflowLibrary))).thenReturn(collectionResponsePaired);
    PreparedWorkflowGalaxy preparedWorkflow = workflowPreparation.prepareAnalysisFiles(submission);
    assertEquals("preparedWorflow history id not equal to " + HISTORY_ID, HISTORY_ID, preparedWorkflow.getRemoteAnalysisId());
    assertEquals("preparedWorkflow library is invalid", LIBRARY_ID, preparedWorkflow.getRemoteDataId());
    assertNotNull("workflowInputs in preparedWorkflow is null", preparedWorkflow.getWorkflowInputs());
    Map<String, WorkflowInput> workflowInputsMap = preparedWorkflow.getWorkflowInputs().getInputsObject().getInputs();
    assertEquals("workflow inputs has invalid size", 2, workflowInputsMap.size());
    assertTrue("workflow inputs should contain reference file entry", workflowInputsMap.containsKey(REFERENCE_FILE_ID));
    assertTrue("workflow inputs should contain sequence file paired entry", workflowInputsMap.containsKey(SEQUENCE_FILE_PAIRED_ID));
    verify(analysisCollectionServiceGalaxy, never()).uploadSequenceFilesSingleEnd(any(Map.class), any(History.class), any(Library.class));
    verify(analysisCollectionServiceGalaxy).uploadSequenceFilesPaired(any(Map.class), any(History.class), any(Library.class));
}
Also used : IridaWorkflow(ca.corefacility.bioinformatics.irida.model.workflow.IridaWorkflow) GalaxyProjectName(ca.corefacility.bioinformatics.irida.model.upload.galaxy.GalaxyProjectName) WorkflowInputsGalaxy(ca.corefacility.bioinformatics.irida.model.workflow.execution.galaxy.WorkflowInputsGalaxy) SequenceFilePair(ca.corefacility.bioinformatics.irida.model.sequenceFile.SequenceFilePair) PreparedWorkflowGalaxy(ca.corefacility.bioinformatics.irida.model.workflow.execution.galaxy.PreparedWorkflowGalaxy) WorkflowInput(com.github.jmchilton.blend4j.galaxy.beans.WorkflowInputs.WorkflowInput) ImmutableMap(com.google.common.collect.ImmutableMap) Test(org.junit.Test)

Aggregations

IridaWorkflow (ca.corefacility.bioinformatics.irida.model.workflow.IridaWorkflow)6 PreparedWorkflowGalaxy (ca.corefacility.bioinformatics.irida.model.workflow.execution.galaxy.PreparedWorkflowGalaxy)6 WorkflowInput (com.github.jmchilton.blend4j.galaxy.beans.WorkflowInputs.WorkflowInput)6 Test (org.junit.Test)6 WorkflowInputsGalaxy (ca.corefacility.bioinformatics.irida.model.workflow.execution.galaxy.WorkflowInputsGalaxy)5 GalaxyProjectName (ca.corefacility.bioinformatics.irida.model.upload.galaxy.GalaxyProjectName)3 AnalysisSubmission (ca.corefacility.bioinformatics.irida.model.workflow.submission.AnalysisSubmission)3 HistoriesClient (com.github.jmchilton.blend4j.galaxy.HistoriesClient)3 WorkflowsClient (com.github.jmchilton.blend4j.galaxy.WorkflowsClient)3 History (com.github.jmchilton.blend4j.galaxy.beans.History)3 HistoryContents (com.github.jmchilton.blend4j.galaxy.beans.HistoryContents)3 Workflow (com.github.jmchilton.blend4j.galaxy.beans.Workflow)3 ImmutableMap (com.google.common.collect.ImmutableMap)3 Path (java.nio.file.Path)3 WithMockUser (org.springframework.security.test.context.support.WithMockUser)3 SequenceFilePair (ca.corefacility.bioinformatics.irida.model.sequenceFile.SequenceFilePair)2 SingleEndSequenceFile (ca.corefacility.bioinformatics.irida.model.sequenceFile.SingleEndSequenceFile)2 LibrariesClient (com.github.jmchilton.blend4j.galaxy.LibrariesClient)2 LibraryContent (com.github.jmchilton.blend4j.galaxy.beans.LibraryContent)2 ArrayList (java.util.ArrayList)2