Search in sources :

Example 1 with IridaWorkflowInput

use of ca.corefacility.bioinformatics.irida.model.workflow.description.IridaWorkflowInput in project irida by phac-nml.

the class AnalysisControllerTest method testGetAnalysisDetailsTree.

@Test
public void testGetAnalysisDetailsTree() throws IOException, IridaWorkflowNotFoundException {
    Long submissionId = 1L;
    ExtendedModelMap model = new ExtendedModelMap();
    Locale locale = Locale.ENGLISH;
    final IridaWorkflowInput input = new IridaWorkflowInput("single", "paired", "reference", true);
    AnalysisSubmission submission = TestDataFactory.constructAnalysisSubmission();
    IridaWorkflowDescription description = new IridaWorkflowDescription(submission.getWorkflowId(), "My Workflow", "V1", AnalysisType.PHYLOGENOMICS, input, Lists.newArrayList(), Lists.newArrayList(), Lists.newArrayList());
    IridaWorkflow iridaWorkflow = new IridaWorkflow(description, null);
    submission.setAnalysisState(AnalysisState.COMPLETED);
    when(analysisSubmissionServiceMock.read(submissionId)).thenReturn(submission);
    when(iridaWorkflowsServiceMock.getIridaWorkflow(submission.getWorkflowId())).thenReturn(iridaWorkflow);
    String detailsPage = analysisController.getDetailsPage(submissionId, model, locale);
    assertEquals("should be details page", AnalysisController.PAGE_DETAILS_DIRECTORY + "tree", detailsPage);
    assertEquals("Tree preview should be set", "tree", model.get("preview"));
    assertEquals("submission should be in model", submission, model.get("analysisSubmission"));
    assertEquals("submission reference file should be in model.", submission.getReferenceFile().get(), model.get("referenceFile"));
}
Also used : Locale(java.util.Locale) ExtendedModelMap(org.springframework.ui.ExtendedModelMap) IridaWorkflowInput(ca.corefacility.bioinformatics.irida.model.workflow.description.IridaWorkflowInput) IridaWorkflow(ca.corefacility.bioinformatics.irida.model.workflow.IridaWorkflow) AnalysisSubmission(ca.corefacility.bioinformatics.irida.model.workflow.submission.AnalysisSubmission) IridaWorkflowDescription(ca.corefacility.bioinformatics.irida.model.workflow.description.IridaWorkflowDescription) Test(org.junit.Test)

Example 2 with IridaWorkflowInput

use of ca.corefacility.bioinformatics.irida.model.workflow.description.IridaWorkflowInput in project irida by phac-nml.

the class IridaWorkflowTestBuilder method buildTestDescription.

/**
 * Builds a {@link IridaWorkflowDescription} with the following information.
 *
 * @param id
 *            The id of the workflow.
 * @param name
 *            The name of the workflow.
 * @param version
 *            The version of the workflow.
 * @param analysisType
 *            The {@link AnalysisType} of the workflow.
 * @param reference
 *            The reference label for the workflow.
 * @param requiresSingleSample
 *            Whether or not this workflow requires a single sample.
 * @return An {@link IridaWorkflowDescription} with the given information.
 * @throws MalformedURLException
 */
public static IridaWorkflowDescription buildTestDescription(UUID id, String name, String version, AnalysisType analysisType, Input input, String reference, boolean requiresSingleSample) throws MalformedURLException {
    List<IridaWorkflowOutput> outputs = new LinkedList<>();
    outputs.add(new IridaWorkflowOutput("output1", "output1.txt"));
    outputs.add(new IridaWorkflowOutput("output2", "output2.txt"));
    List<IridaWorkflowToolRepository> tools = new LinkedList<>();
    IridaWorkflowToolRepository workflowTool = new IridaWorkflowToolRepository("sam_to_bam", "devteam", new URL("http://toolshed.g2.bx.psu.edu/"), "8176b2575aa1");
    tools.add(workflowTool);
    IridaWorkflowInput workflowInput = null;
    switch(input) {
        case SINGLE:
            workflowInput = new IridaWorkflowInput("sequence_reads", null, reference, requiresSingleSample);
            break;
        case PAIRED:
            workflowInput = new IridaWorkflowInput(null, "sequence_reads_paired", reference, requiresSingleSample);
            break;
        case SINGLE_PAIRED:
            workflowInput = new IridaWorkflowInput("sequence_reads", "sequence_reads_paired", reference, requiresSingleSample);
            break;
    }
    List<IridaWorkflowParameter> parameters = new LinkedList<>();
    IridaToolParameter tool1 = new IridaToolParameter("irida.corefacility.ca/galaxy-shed/repos/irida/test-tool/0.1", "a");
    IridaToolParameter tool2 = new IridaToolParameter("irida.corefacility.ca/galaxy-shed/repos/irida/test-tool/0.1", "b");
    IridaWorkflowParameter parameter1 = new IridaWorkflowParameter("test-parameter", "1", Lists.newArrayList(tool1, tool2));
    parameters.add(parameter1);
    IridaWorkflowDescription iridaWorkflow = new IridaWorkflowDescription(id, name, version, analysisType, workflowInput, outputs, tools, parameters);
    return iridaWorkflow;
}
Also used : IridaWorkflowOutput(ca.corefacility.bioinformatics.irida.model.workflow.description.IridaWorkflowOutput) IridaWorkflowInput(ca.corefacility.bioinformatics.irida.model.workflow.description.IridaWorkflowInput) IridaWorkflowParameter(ca.corefacility.bioinformatics.irida.model.workflow.description.IridaWorkflowParameter) IridaToolParameter(ca.corefacility.bioinformatics.irida.model.workflow.description.IridaToolParameter) IridaWorkflowDescription(ca.corefacility.bioinformatics.irida.model.workflow.description.IridaWorkflowDescription) LinkedList(java.util.LinkedList) IridaWorkflowToolRepository(ca.corefacility.bioinformatics.irida.model.workflow.description.IridaWorkflowToolRepository) URL(java.net.URL)

Example 3 with IridaWorkflowInput

use of ca.corefacility.bioinformatics.irida.model.workflow.description.IridaWorkflowInput in project irida by phac-nml.

the class AnalysisControllerTest method testGetAnalysisDetailsNotCompleted.

@Test
public void testGetAnalysisDetailsNotCompleted() throws IOException, IridaWorkflowNotFoundException {
    Long submissionId = 1L;
    ExtendedModelMap model = new ExtendedModelMap();
    Locale locale = Locale.ENGLISH;
    final IridaWorkflowInput input = new IridaWorkflowInput("single", "paired", "reference", true);
    AnalysisSubmission submission = TestDataFactory.constructAnalysisSubmission();
    IridaWorkflowDescription description = new IridaWorkflowDescription(submission.getWorkflowId(), "My Workflow", "V1", AnalysisType.PHYLOGENOMICS, input, Lists.newArrayList(), Lists.newArrayList(), Lists.newArrayList());
    IridaWorkflow iridaWorkflow = new IridaWorkflow(description, null);
    submission.setAnalysisState(AnalysisState.RUNNING);
    when(analysisSubmissionServiceMock.read(submissionId)).thenReturn(submission);
    when(iridaWorkflowsServiceMock.getIridaWorkflow(submission.getWorkflowId())).thenReturn(iridaWorkflow);
    String detailsPage = analysisController.getDetailsPage(submissionId, model, locale);
    assertEquals("should be details page", AnalysisController.PAGE_DETAILS_DIRECTORY + "tree", detailsPage);
    assertFalse("No preview should be available", model.containsAttribute("preview"));
    assertEquals("submission should be in model", submission, model.get("analysisSubmission"));
}
Also used : Locale(java.util.Locale) ExtendedModelMap(org.springframework.ui.ExtendedModelMap) IridaWorkflowInput(ca.corefacility.bioinformatics.irida.model.workflow.description.IridaWorkflowInput) IridaWorkflow(ca.corefacility.bioinformatics.irida.model.workflow.IridaWorkflow) AnalysisSubmission(ca.corefacility.bioinformatics.irida.model.workflow.submission.AnalysisSubmission) IridaWorkflowDescription(ca.corefacility.bioinformatics.irida.model.workflow.description.IridaWorkflowDescription) Test(org.junit.Test)

Example 4 with IridaWorkflowInput

use of ca.corefacility.bioinformatics.irida.model.workflow.description.IridaWorkflowInput in project irida by phac-nml.

the class TestDataFactory method getIridaWorkflow.

public static IridaWorkflow getIridaWorkflow(UUID id) {
    IridaWorkflowInput input = new IridaWorkflowInput();
    List<IridaWorkflowOutput> outputs = ImmutableList.of(new IridaWorkflowOutput());
    List<IridaWorkflowToolRepository> tools = ImmutableList.of();
    List<IridaWorkflowParameter> parameters = ImmutableList.of();
    IridaWorkflowDescription description = new IridaWorkflowDescription(id, "My Workflow", "V1", AnalysisType.DEFAULT, input, outputs, tools, parameters);
    IridaWorkflowStructure structure = new IridaWorkflowStructure(null);
    return new IridaWorkflow(description, structure);
}
Also used : IridaWorkflowOutput(ca.corefacility.bioinformatics.irida.model.workflow.description.IridaWorkflowOutput) IridaWorkflowInput(ca.corefacility.bioinformatics.irida.model.workflow.description.IridaWorkflowInput) IridaWorkflowParameter(ca.corefacility.bioinformatics.irida.model.workflow.description.IridaWorkflowParameter) IridaWorkflow(ca.corefacility.bioinformatics.irida.model.workflow.IridaWorkflow) IridaWorkflowDescription(ca.corefacility.bioinformatics.irida.model.workflow.description.IridaWorkflowDescription) IridaWorkflowStructure(ca.corefacility.bioinformatics.irida.model.workflow.structure.IridaWorkflowStructure) IridaWorkflowToolRepository(ca.corefacility.bioinformatics.irida.model.workflow.description.IridaWorkflowToolRepository)

Example 5 with IridaWorkflowInput

use of ca.corefacility.bioinformatics.irida.model.workflow.description.IridaWorkflowInput in project irida by phac-nml.

the class IridaWorkflowLoaderServiceIT method buildTestDescription.

private IridaWorkflowDescription buildTestDescription(UUID id, String name, String version, String sequenceReadsSingle, String sequenceReadsPaired, boolean requiresSingleSample) throws MalformedURLException {
    List<IridaWorkflowOutput> outputs = new LinkedList<>();
    outputs.add(new IridaWorkflowOutput("output1", "output1.txt"));
    outputs.add(new IridaWorkflowOutput("output2", "output2.txt"));
    List<IridaWorkflowToolRepository> tools = new LinkedList<>();
    IridaWorkflowToolRepository workflowTool = new IridaWorkflowToolRepository("sam_to_bam", "devteam", new URL("http://toolshed.g2.bx.psu.edu/"), "8176b2575aa1");
    tools.add(workflowTool);
    List<IridaWorkflowParameter> parameters = new LinkedList<>();
    IridaToolParameter tool1 = new IridaToolParameter("irida.corefacility.ca/galaxy-shed/repos/irida/test-tool/0.1", "a");
    IridaToolParameter tool2 = new IridaToolParameter("irida.corefacility.ca/galaxy-shed/repos/irida/test-tool/0.1", "b");
    IridaWorkflowParameter parameter1 = new IridaWorkflowParameter("test-parameter", "1", Lists.newArrayList(tool1, tool2));
    parameters.add(parameter1);
    IridaWorkflowDescription iridaWorkflow = new IridaWorkflowDescription(id, name, version, AnalysisType.DEFAULT, new IridaWorkflowInput(sequenceReadsSingle, sequenceReadsPaired, "reference", requiresSingleSample), outputs, tools, parameters);
    return iridaWorkflow;
}
Also used : IridaWorkflowOutput(ca.corefacility.bioinformatics.irida.model.workflow.description.IridaWorkflowOutput) IridaWorkflowParameter(ca.corefacility.bioinformatics.irida.model.workflow.description.IridaWorkflowParameter) IridaWorkflowInput(ca.corefacility.bioinformatics.irida.model.workflow.description.IridaWorkflowInput) IridaToolParameter(ca.corefacility.bioinformatics.irida.model.workflow.description.IridaToolParameter) IridaWorkflowDescription(ca.corefacility.bioinformatics.irida.model.workflow.description.IridaWorkflowDescription) LinkedList(java.util.LinkedList) IridaWorkflowToolRepository(ca.corefacility.bioinformatics.irida.model.workflow.description.IridaWorkflowToolRepository) URL(java.net.URL)

Aggregations

IridaWorkflowInput (ca.corefacility.bioinformatics.irida.model.workflow.description.IridaWorkflowInput)6 IridaWorkflowDescription (ca.corefacility.bioinformatics.irida.model.workflow.description.IridaWorkflowDescription)5 IridaWorkflow (ca.corefacility.bioinformatics.irida.model.workflow.IridaWorkflow)4 IridaWorkflowOutput (ca.corefacility.bioinformatics.irida.model.workflow.description.IridaWorkflowOutput)3 IridaWorkflowParameter (ca.corefacility.bioinformatics.irida.model.workflow.description.IridaWorkflowParameter)3 IridaWorkflowToolRepository (ca.corefacility.bioinformatics.irida.model.workflow.description.IridaWorkflowToolRepository)3 IridaToolParameter (ca.corefacility.bioinformatics.irida.model.workflow.description.IridaToolParameter)2 AnalysisSubmission (ca.corefacility.bioinformatics.irida.model.workflow.submission.AnalysisSubmission)2 URL (java.net.URL)2 LinkedList (java.util.LinkedList)2 Locale (java.util.Locale)2 Test (org.junit.Test)2 ExtendedModelMap (org.springframework.ui.ExtendedModelMap)2 SampleAnalysisDuplicateException (ca.corefacility.bioinformatics.irida.exceptions.SampleAnalysisDuplicateException)1 Sample (ca.corefacility.bioinformatics.irida.model.sample.Sample)1 SequenceFilePair (ca.corefacility.bioinformatics.irida.model.sequenceFile.SequenceFilePair)1 SingleEndSequenceFile (ca.corefacility.bioinformatics.irida.model.sequenceFile.SingleEndSequenceFile)1 GalaxyProjectName (ca.corefacility.bioinformatics.irida.model.upload.galaxy.GalaxyProjectName)1 PreparedWorkflowGalaxy (ca.corefacility.bioinformatics.irida.model.workflow.execution.galaxy.PreparedWorkflowGalaxy)1 WorkflowInputsGalaxy (ca.corefacility.bioinformatics.irida.model.workflow.execution.galaxy.WorkflowInputsGalaxy)1