Search in sources :

Example 6 with IridaWorkflow

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

the class IridaWorkflowLoaderServiceIT method testLoadWorkflowNoParameters.

/**
 * Test to make sure we can load a workflow with no parameters.
 *
 * @throws IridaWorkflowLoadException
 * @throws IOException
 */
@Test
public void testLoadWorkflowNoParameters() throws IridaWorkflowLoadException, IOException {
    IridaWorkflow iridaWorkflowFromFile = workflowLoaderService.loadIridaWorkflowFromDirectory(workflowDirectoryPathNoParameters);
    assertFalse("workflow loaded with no parameters", iridaWorkflowFromFile.getWorkflowDescription().acceptsParameters());
    assertNull("parameters should be null", iridaWorkflowFromFile.getWorkflowDescription().getParameters());
}
Also used : IridaWorkflow(ca.corefacility.bioinformatics.irida.model.workflow.IridaWorkflow) Test(org.junit.Test)

Example 7 with IridaWorkflow

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

the class IridaWorkflowsConfig method iridaWorkflows.

/**
 * Builds a set of workflows to load up into IRIDA.
 *
 * @param iridaWorkflowTypesPath
 *            The parent directory containing sub-directories for all IRIDA
 *            workflow types.
 *
 * @return A set of workflows to load into IRIDA.
 * @throws IOException
 *             If an I/O error occured.
 * @throws IridaWorkflowLoadException
 *             If there was an issue loading a specific workflow.
 */
@Bean
public IridaWorkflowSet iridaWorkflows(Path iridaWorkflowTypesPath) throws IOException, IridaWorkflowLoadException {
    Set<IridaWorkflow> iridaWorkflowsSet = Sets.newHashSet();
    DirectoryStream<Path> workflowTypesStream = Files.newDirectoryStream(iridaWorkflowTypesPath);
    for (Path workflowTypePath : workflowTypesStream) {
        if (!Files.isDirectory(workflowTypePath)) {
            logger.warn("Workflow type directory " + iridaWorkflowTypesPath + " contains a file " + workflowTypePath + " that is not a proper workflow directory.");
        } else {
            iridaWorkflowsSet.addAll(iridaWorkflowLoaderService().loadAllWorkflowImplementations(workflowTypePath));
        }
    }
    return new IridaWorkflowSet(iridaWorkflowsSet);
}
Also used : Path(java.nio.file.Path) IridaWorkflowSet(ca.corefacility.bioinformatics.irida.model.workflow.config.IridaWorkflowSet) IridaWorkflow(ca.corefacility.bioinformatics.irida.model.workflow.IridaWorkflow) Bean(org.springframework.context.annotation.Bean)

Example 8 with IridaWorkflow

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

the class AssemblyFileProcessorTest method setUp.

@Before
public void setUp() throws IridaWorkflowNotFoundException {
    MockitoAnnotations.initMocks(this);
    processor = new AssemblyFileProcessor(objectRepository, submissionRepository, workflowsService, userRepository, ssoRepository, psjRepository);
    UUID workflowUUID = UUID.randomUUID();
    IridaWorkflowDescription workflowDescription = new IridaWorkflowDescription(workflowUUID, null, null, null, null, ImmutableList.of(), ImmutableList.of(), ImmutableList.of());
    IridaWorkflow workflow = new IridaWorkflow(workflowDescription, null);
    when(workflowsService.getDefaultWorkflowByType(AnalysisType.ASSEMBLY_ANNOTATION)).thenReturn(workflow);
    when(userRepository.loadUserByUsername("admin")).thenReturn(new User());
}
Also used : User(ca.corefacility.bioinformatics.irida.model.user.User) IridaWorkflow(ca.corefacility.bioinformatics.irida.model.workflow.IridaWorkflow) AssemblyFileProcessor(ca.corefacility.bioinformatics.irida.processing.impl.AssemblyFileProcessor) IridaWorkflowDescription(ca.corefacility.bioinformatics.irida.model.workflow.description.IridaWorkflowDescription) UUID(java.util.UUID) Before(org.junit.Before)

Example 9 with IridaWorkflow

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

the class IridaWorkflowsTestConfig method iridaWorkflows.

@Bean
public IridaWorkflowSet iridaWorkflows() throws IOException, IridaWorkflowLoadException, URISyntaxException {
    Path testAnalysisPath = Paths.get(TestAnalysis.class.getResource("workflows/TestAnalysis").toURI());
    Path phylogenomicsAnalysisPath = Paths.get(Analysis.class.getResource("workflows/AnalysisPhylogenomicsPipeline").toURI());
    Path assemblyAnnotationPath = Paths.get(Analysis.class.getResource("workflows/AnalysisAssemblyAnnotation").toURI());
    Set<IridaWorkflow> workflowsSet = iridaWorkflowLoaderService.loadAllWorkflowImplementations(testAnalysisPath);
    workflowsSet.addAll(iridaWorkflowLoaderService.loadAllWorkflowImplementations(phylogenomicsAnalysisPath));
    workflowsSet.addAll(iridaWorkflowLoaderService.loadAllWorkflowImplementations(assemblyAnnotationPath));
    return new IridaWorkflowSet(workflowsSet);
}
Also used : Path(java.nio.file.Path) IridaWorkflowSet(ca.corefacility.bioinformatics.irida.model.workflow.config.IridaWorkflowSet) IridaWorkflow(ca.corefacility.bioinformatics.irida.model.workflow.IridaWorkflow) Bean(org.springframework.context.annotation.Bean)

Example 10 with IridaWorkflow

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

the class AnalysisWorkspaceServiceGalaxyIT method testPrepareAnalysisFilesParametersFailInvalidParameter.

/**
 * Tests out failing to prepare paired workflow input files for execution
 * with parameters due to an invalid parameter passed.
 *
 * @throws InterruptedException
 * @throws ExecutionManagerException
 * @throws IOException
 * @throws IridaWorkflowException
 */
@Test(expected = IridaWorkflowParameterException.class)
@WithMockUser(username = "aaron", roles = "ADMIN")
public void testPrepareAnalysisFilesParametersFailInvalidParameter() throws InterruptedException, ExecutionManagerException, IOException, IridaWorkflowException {
    History history = new History();
    history.setName("testPrepareAnalysisFilesParametersFailInvalidParameter");
    HistoriesClient historiesClient = localGalaxy.getGalaxyInstanceAdmin().getHistoriesClient();
    WorkflowsClient workflowsClient = localGalaxy.getGalaxyInstanceAdmin().getWorkflowsClient();
    History createdHistory = historiesClient.create(history);
    IridaWorkflow iridaWorkflow = iridaWorkflowsService.getIridaWorkflow(validWorkflowIdPairedWithParameters);
    Path workflowPath = iridaWorkflow.getWorkflowStructure().getWorkflowFile();
    String workflowString = new String(Files.readAllBytes(workflowPath), StandardCharsets.UTF_8);
    Workflow galaxyWorkflow = workflowsClient.importWorkflow(workflowString);
    Map<String, String> parameters = ImmutableMap.of("invalid", "20");
    AnalysisSubmission analysisSubmission = analysisExecutionGalaxyITService.setupPairSubmissionInDatabase(1L, pairSequenceFiles1A, pairSequenceFiles2A, referenceFilePath, parameters, validWorkflowIdPairedWithParameters);
    analysisSubmission.setRemoteAnalysisId(createdHistory.getId());
    analysisSubmission.setRemoteWorkflowId(galaxyWorkflow.getId());
    analysisWorkspaceService.prepareAnalysisFiles(analysisSubmission);
}
Also used : Path(java.nio.file.Path) WorkflowsClient(com.github.jmchilton.blend4j.galaxy.WorkflowsClient) IridaWorkflow(ca.corefacility.bioinformatics.irida.model.workflow.IridaWorkflow) AnalysisSubmission(ca.corefacility.bioinformatics.irida.model.workflow.submission.AnalysisSubmission) Workflow(com.github.jmchilton.blend4j.galaxy.beans.Workflow) IridaWorkflow(ca.corefacility.bioinformatics.irida.model.workflow.IridaWorkflow) History(com.github.jmchilton.blend4j.galaxy.beans.History) HistoriesClient(com.github.jmchilton.blend4j.galaxy.HistoriesClient) WithMockUser(org.springframework.security.test.context.support.WithMockUser) Test(org.junit.Test)

Aggregations

IridaWorkflow (ca.corefacility.bioinformatics.irida.model.workflow.IridaWorkflow)50 AnalysisSubmission (ca.corefacility.bioinformatics.irida.model.workflow.submission.AnalysisSubmission)27 Test (org.junit.Test)27 Path (java.nio.file.Path)25 History (com.github.jmchilton.blend4j.galaxy.beans.History)19 HistoriesClient (com.github.jmchilton.blend4j.galaxy.HistoriesClient)18 WorkflowsClient (com.github.jmchilton.blend4j.galaxy.WorkflowsClient)18 Workflow (com.github.jmchilton.blend4j.galaxy.beans.Workflow)18 WithMockUser (org.springframework.security.test.context.support.WithMockUser)18 AnalysisType (ca.corefacility.bioinformatics.irida.model.enums.AnalysisType)10 SequenceFilePair (ca.corefacility.bioinformatics.irida.model.sequenceFile.SequenceFilePair)10 Analysis (ca.corefacility.bioinformatics.irida.model.workflow.analysis.Analysis)9 ArrayList (java.util.ArrayList)9 SingleEndSequenceFile (ca.corefacility.bioinformatics.irida.model.sequenceFile.SingleEndSequenceFile)8 IridaWorkflowDescription (ca.corefacility.bioinformatics.irida.model.workflow.description.IridaWorkflowDescription)8 ToolsClient (com.github.jmchilton.blend4j.galaxy.ToolsClient)8 IridaWorkflowNotFoundException (ca.corefacility.bioinformatics.irida.exceptions.IridaWorkflowNotFoundException)7 PreparedWorkflowGalaxy (ca.corefacility.bioinformatics.irida.model.workflow.execution.galaxy.PreparedWorkflowGalaxy)7 WorkflowInputsGalaxy (ca.corefacility.bioinformatics.irida.model.workflow.execution.galaxy.WorkflowInputsGalaxy)6 HistoryContents (com.github.jmchilton.blend4j.galaxy.beans.HistoryContents)6