Search in sources :

Example 1 with IridaWorkflowDescription

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

the class IridaWorkflowLoaderServiceIT method testLoadWorkflowDescriptionSinglePaired.

/**
 * Tests loading up the workflow description file (single and paired end data).
 *
 * @throws IOException
 * @throws IridaWorkflowLoadException
 */
@Test
public void testLoadWorkflowDescriptionSinglePaired() throws IOException, IridaWorkflowLoadException {
    IridaWorkflowDescription iridaWorkflowDescription = buildTestDescriptionSinglePaired();
    IridaWorkflowDescription iridaWorkflowFromFile = workflowLoaderService.loadWorkflowDescription(workflowSinglePairedXmlPath);
    assertEquals("irida workflow description is invalid", iridaWorkflowFromFile, iridaWorkflowDescription);
}
Also used : IridaWorkflowDescription(ca.corefacility.bioinformatics.irida.model.workflow.description.IridaWorkflowDescription) Test(org.junit.Test)

Example 2 with IridaWorkflowDescription

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

the class IridaWorkflowLoaderServiceIT method testLoadWorkflowDescriptionPaired.

/**
 * Tests loading up the workflow description file (paired end data).
 *
 * @throws IOException
 * @throws IridaWorkflowLoadException
 */
@Test
public void testLoadWorkflowDescriptionPaired() throws IOException, IridaWorkflowLoadException {
    IridaWorkflowDescription iridaWorkflowDescription = buildTestDescriptionPaired();
    IridaWorkflowDescription iridaWorkflowFromFile = workflowLoaderService.loadWorkflowDescription(workflowPairedXmlPath);
    assertEquals("irida workflow description is invalid", iridaWorkflowFromFile, iridaWorkflowDescription);
}
Also used : IridaWorkflowDescription(ca.corefacility.bioinformatics.irida.model.workflow.description.IridaWorkflowDescription) Test(org.junit.Test)

Example 3 with IridaWorkflowDescription

use of ca.corefacility.bioinformatics.irida.model.workflow.description.IridaWorkflowDescription 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 4 with IridaWorkflowDescription

use of ca.corefacility.bioinformatics.irida.model.workflow.description.IridaWorkflowDescription 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 5 with IridaWorkflowDescription

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

the class AnalysisSubmissionServiceImpl method createSingleSampleSubmission.

/**
 * {@inheritDoc}
 */
@Override
@Transactional
@PreAuthorize("hasRole('ROLE_USER')")
public Collection<AnalysisSubmission> createSingleSampleSubmission(IridaWorkflow workflow, Long ref, List<SingleEndSequenceFile> sequenceFiles, List<SequenceFilePair> sequenceFilePairs, Map<String, String> params, IridaWorkflowNamedParameters namedParameters, String name, String analysisDescription, List<Project> projectsToShare, boolean writeResultsToSamples) {
    final Collection<AnalysisSubmission> createdSubmissions = new HashSet<AnalysisSubmission>();
    // Single end reads
    IridaWorkflowDescription description = workflow.getWorkflowDescription();
    if (description.acceptsSingleSequenceFiles()) {
        final Map<Sample, SingleEndSequenceFile> samplesMap = sequencingObjectService.getUniqueSamplesForSequencingObjects(Sets.newHashSet(sequenceFiles));
        for (final Map.Entry<Sample, SingleEndSequenceFile> entry : samplesMap.entrySet()) {
            Sample s = entry.getKey();
            SingleEndSequenceFile file = entry.getValue();
            // Build the analysis submission
            AnalysisSubmission.Builder builder = AnalysisSubmission.builder(workflow.getWorkflowIdentifier());
            builder.name(name + "_" + s.getSampleName());
            builder.inputFiles(ImmutableSet.of(file));
            builder.updateSamples(writeResultsToSamples);
            builder.priority(AnalysisSubmission.Priority.MEDIUM);
            // Add reference file
            if (ref != null && description.requiresReference()) {
                // Note: This cannot be empty if through the UI if the
                // pipeline required a reference file.
                ReferenceFile referenceFile = referenceFileRepository.findOne(ref);
                builder.referenceFile(referenceFile);
            }
            if (description.acceptsParameters()) {
                if (namedParameters != null) {
                    builder.withNamedParameters(namedParameters);
                } else {
                    if (!params.isEmpty()) {
                        // Note: This cannot be empty if through the UI if
                        // the pipeline required params.
                        builder.inputParameters(params);
                    }
                }
            }
            // Create the submission
            createdSubmissions.add(create(builder.build()));
        }
    }
    // Paired end reads
    if (description.acceptsPairedSequenceFiles()) {
        final Map<Sample, SequenceFilePair> samplesMap = sequencingObjectService.getUniqueSamplesForSequencingObjects(Sets.newHashSet(sequenceFilePairs));
        for (final Map.Entry<Sample, SequenceFilePair> entry : samplesMap.entrySet()) {
            Sample s = entry.getKey();
            SequenceFilePair filePair = entry.getValue();
            // Build the analysis submission
            AnalysisSubmission.Builder builder = AnalysisSubmission.builder(workflow.getWorkflowIdentifier());
            builder.name(name + "_" + s.getSampleName());
            builder.inputFiles(ImmutableSet.of(filePair));
            builder.updateSamples(writeResultsToSamples);
            // Add reference file
            if (ref != null && description.requiresReference()) {
                ReferenceFile referenceFile = referenceFileRepository.findOne(ref);
                builder.referenceFile(referenceFile);
            }
            if (description.acceptsParameters()) {
                if (namedParameters != null) {
                    builder.withNamedParameters(namedParameters);
                } else {
                    if (!params.isEmpty()) {
                        // Note: This cannot be empty if through the UI if
                        // the pipeline required params.
                        builder.inputParameters(params);
                    }
                }
            }
            // Add description to submission, can be null
            builder.analysisDescription(analysisDescription);
            // Create the submission
            createdSubmissions.add(create(builder.build()));
        }
    }
    // Share with the required projects
    for (AnalysisSubmission submission : createdSubmissions) {
        for (Project project : projectsToShare) {
            pasRepository.save(new ProjectAnalysisSubmissionJoin(project, submission));
        }
    }
    return createdSubmissions;
}
Also used : ReferenceFile(ca.corefacility.bioinformatics.irida.model.project.ReferenceFile) Sample(ca.corefacility.bioinformatics.irida.model.sample.Sample) AnalysisSubmission(ca.corefacility.bioinformatics.irida.model.workflow.submission.AnalysisSubmission) SingleEndSequenceFile(ca.corefacility.bioinformatics.irida.model.sequenceFile.SingleEndSequenceFile) SequenceFilePair(ca.corefacility.bioinformatics.irida.model.sequenceFile.SequenceFilePair) Project(ca.corefacility.bioinformatics.irida.model.project.Project) IridaWorkflowDescription(ca.corefacility.bioinformatics.irida.model.workflow.description.IridaWorkflowDescription) ProjectAnalysisSubmissionJoin(ca.corefacility.bioinformatics.irida.model.workflow.submission.ProjectAnalysisSubmissionJoin) ImmutableMap(com.google.common.collect.ImmutableMap) PreAuthorize(org.springframework.security.access.prepost.PreAuthorize) Transactional(javax.transaction.Transactional)

Aggregations

IridaWorkflowDescription (ca.corefacility.bioinformatics.irida.model.workflow.description.IridaWorkflowDescription)22 Test (org.junit.Test)10 IridaWorkflow (ca.corefacility.bioinformatics.irida.model.workflow.IridaWorkflow)8 IridaWorkflowInput (ca.corefacility.bioinformatics.irida.model.workflow.description.IridaWorkflowInput)5 IridaWorkflowParameter (ca.corefacility.bioinformatics.irida.model.workflow.description.IridaWorkflowParameter)5 AnalysisSubmission (ca.corefacility.bioinformatics.irida.model.workflow.submission.AnalysisSubmission)5 IridaWorkflowNotFoundException (ca.corefacility.bioinformatics.irida.exceptions.IridaWorkflowNotFoundException)4 Project (ca.corefacility.bioinformatics.irida.model.project.Project)4 ImmutableMap (com.google.common.collect.ImmutableMap)4 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)4 IridaWorkflowParameterException (ca.corefacility.bioinformatics.irida.exceptions.IridaWorkflowParameterException)3 ReferenceFile (ca.corefacility.bioinformatics.irida.model.project.ReferenceFile)3 IridaWorkflowOutput (ca.corefacility.bioinformatics.irida.model.workflow.description.IridaWorkflowOutput)3 IridaWorkflowToolRepository (ca.corefacility.bioinformatics.irida.model.workflow.description.IridaWorkflowToolRepository)3 ArrayList (java.util.ArrayList)3 HashMap (java.util.HashMap)3 Map (java.util.Map)3 DuplicateSampleException (ca.corefacility.bioinformatics.irida.exceptions.DuplicateSampleException)2 AnalysisType (ca.corefacility.bioinformatics.irida.model.enums.AnalysisType)2 Sample (ca.corefacility.bioinformatics.irida.model.sample.Sample)2