Search in sources :

Example 31 with SingleEndSequenceFile

use of ca.corefacility.bioinformatics.irida.model.sequenceFile.SingleEndSequenceFile in project irida by phac-nml.

the class AnalysisSubmissionServiceImplIT method testCreateRegularUser2.

/**
 * Tests creating a submission as a second regular user.
 */
@Test
@WithMockUser(username = "otheraaron", roles = "USER")
public void testCreateRegularUser2() {
    SingleEndSequenceFile sequencingObject = (SingleEndSequenceFile) sequencingObjectRepository.findOne(1L);
    AnalysisSubmission submission = AnalysisSubmission.builder(workflowId).name("test").inputFiles(Sets.newHashSet(sequencingObject)).build();
    AnalysisSubmission createdSubmission = analysisSubmissionService.create(submission);
    assertNotNull("Submission should have been created", createdSubmission);
    assertEquals("submitter should be set properly", Long.valueOf(2L), createdSubmission.getSubmitter().getId());
}
Also used : AnalysisSubmission(ca.corefacility.bioinformatics.irida.model.workflow.submission.AnalysisSubmission) SingleEndSequenceFile(ca.corefacility.bioinformatics.irida.model.sequenceFile.SingleEndSequenceFile) WithMockUser(org.springframework.security.test.context.support.WithMockUser) Test(org.junit.Test)

Example 32 with SingleEndSequenceFile

use of ca.corefacility.bioinformatics.irida.model.sequenceFile.SingleEndSequenceFile in project irida by phac-nml.

the class AnalysisSubmissionServiceImplIT method testCreateRegularUser.

/**
 * Tests creating a submission as a regular user.
 */
@Test
@WithMockUser(username = "aaron", roles = "USER")
public void testCreateRegularUser() {
    SingleEndSequenceFile sequencingObject = (SingleEndSequenceFile) sequencingObjectRepository.findOne(1L);
    AnalysisSubmission submission = AnalysisSubmission.builder(workflowId).name("test").inputFiles(Sets.newHashSet(sequencingObject)).build();
    AnalysisSubmission createdSubmission = analysisSubmissionService.create(submission);
    assertNotNull("Submission should have been created", createdSubmission);
    assertEquals("submitter should be set properly", Long.valueOf(1L), createdSubmission.getSubmitter().getId());
}
Also used : AnalysisSubmission(ca.corefacility.bioinformatics.irida.model.workflow.submission.AnalysisSubmission) SingleEndSequenceFile(ca.corefacility.bioinformatics.irida.model.sequenceFile.SingleEndSequenceFile) WithMockUser(org.springframework.security.test.context.support.WithMockUser) Test(org.junit.Test)

Example 33 with SingleEndSequenceFile

use of ca.corefacility.bioinformatics.irida.model.sequenceFile.SingleEndSequenceFile in project irida by phac-nml.

the class AnalysisSubmissionServiceImplIT method testCreateSubmissionWithUnsavedNamedParameters.

@Test(expected = UnsupportedOperationException.class)
@WithMockUser(username = "aaron", roles = "ADMIN")
public void testCreateSubmissionWithUnsavedNamedParameters() {
    final SingleEndSequenceFile sequencingObject = (SingleEndSequenceFile) sequencingObjectRepository.findOne(1L);
    final IridaWorkflowNamedParameters params = new IridaWorkflowNamedParameters("named parameters.", workflowId, ImmutableMap.of("named", "parameter"));
    final AnalysisSubmission submission = AnalysisSubmission.builder(workflowId).inputFiles(Sets.newHashSet(sequencingObject)).withNamedParameters(params).build();
    analysisSubmissionService.create(submission);
}
Also used : AnalysisSubmission(ca.corefacility.bioinformatics.irida.model.workflow.submission.AnalysisSubmission) IridaWorkflowNamedParameters(ca.corefacility.bioinformatics.irida.model.workflow.submission.IridaWorkflowNamedParameters) SingleEndSequenceFile(ca.corefacility.bioinformatics.irida.model.sequenceFile.SingleEndSequenceFile) WithMockUser(org.springframework.security.test.context.support.WithMockUser) Test(org.junit.Test)

Example 34 with SingleEndSequenceFile

use of ca.corefacility.bioinformatics.irida.model.sequenceFile.SingleEndSequenceFile in project irida by phac-nml.

the class AnalysisSubmissionServiceImplIT method testCreateSubmissionWithNamedParameters.

@Test
@WithMockUser(username = "aaron", roles = "ADMIN")
public void testCreateSubmissionWithNamedParameters() {
    final SingleEndSequenceFile sequencingObject = (SingleEndSequenceFile) sequencingObjectRepository.findOne(1L);
    final IridaWorkflowNamedParameters params = parametersRepository.findOne(1L);
    final AnalysisSubmission submission = AnalysisSubmission.builder(workflowId).inputFiles(Sets.newHashSet(sequencingObject)).withNamedParameters(params).build();
    analysisSubmissionService.create(submission);
    assertNotNull("Should have saved and created an id for the submission", submission.getId());
    assertNotNull("Submission should have a map of parameters", submission.getInputParameters());
    assertEquals("Submission parameters should be the same as the named parameters", params.getInputParameters(), submission.getInputParameters());
}
Also used : AnalysisSubmission(ca.corefacility.bioinformatics.irida.model.workflow.submission.AnalysisSubmission) IridaWorkflowNamedParameters(ca.corefacility.bioinformatics.irida.model.workflow.submission.IridaWorkflowNamedParameters) SingleEndSequenceFile(ca.corefacility.bioinformatics.irida.model.sequenceFile.SingleEndSequenceFile) WithMockUser(org.springframework.security.test.context.support.WithMockUser) Test(org.junit.Test)

Example 35 with SingleEndSequenceFile

use of ca.corefacility.bioinformatics.irida.model.sequenceFile.SingleEndSequenceFile in project irida by phac-nml.

the class AnalysisWorkspaceServiceGalaxyTest method testPrepareAnalysisFilesSingleSuccess.

/**
 * Tests out successfully to preparing an analysis with single files.
 *
 * @throws ExecutionManagerException
 * @throws IridaWorkflowException
 */
@SuppressWarnings("unchecked")
@Test
public void testPrepareAnalysisFilesSingleSuccess() throws ExecutionManagerException, IridaWorkflowException {
    Set<SingleEndSequenceFile> singleFiles = Sets.newHashSet(sampleSingleSequenceFileMap.values());
    submission = AnalysisSubmission.builder(workflowId).name("my analysis").inputFiles(Sets.newHashSet(singleFiles)).referenceFile(referenceFile).build();
    submission.setRemoteAnalysisId(HISTORY_ID);
    submission.setRemoteWorkflowId(WORKFLOW_ID);
    when(sequencingObjectService.getSequencingObjectsOfTypeForAnalysisSubmission(submission, SingleEndSequenceFile.class)).thenReturn(singleFiles);
    when(iridaWorkflowsService.getIridaWorkflow(workflowId)).thenReturn(iridaWorkflowSingle);
    when(galaxyHistoriesService.findById(HISTORY_ID)).thenReturn(workflowHistory);
    when(galaxyLibrariesService.buildEmptyLibrary(any(GalaxyProjectName.class))).thenReturn(workflowLibrary);
    when(sequencingObjectService.getUniqueSamplesForSequencingObjects(singleFiles)).thenReturn(sampleSingleSequenceFileMap);
    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_SINGLE_LABEL)).thenReturn(SEQUENCE_FILE_SINGLE_ID);
    when(galaxyWorkflowService.getWorkflowInputId(workflowDetails, REFERENCE_FILE_LABEL)).thenReturn(REFERENCE_FILE_ID);
    when(analysisCollectionServiceGalaxy.uploadSequenceFilesSingleEnd(any(Map.class), eq(workflowHistory), eq(workflowLibrary))).thenReturn(collectionResponseSingle);
    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 single entry", workflowInputsMap.containsKey(SEQUENCE_FILE_SINGLE_ID));
    verify(analysisCollectionServiceGalaxy).uploadSequenceFilesSingleEnd(any(Map.class), any(History.class), any(Library.class));
    verify(analysisCollectionServiceGalaxy, never()).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) SingleEndSequenceFile(ca.corefacility.bioinformatics.irida.model.sequenceFile.SingleEndSequenceFile) 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

SingleEndSequenceFile (ca.corefacility.bioinformatics.irida.model.sequenceFile.SingleEndSequenceFile)99 Test (org.junit.Test)72 SequenceFile (ca.corefacility.bioinformatics.irida.model.sequenceFile.SequenceFile)61 Sample (ca.corefacility.bioinformatics.irida.model.sample.Sample)44 Path (java.nio.file.Path)33 SampleSequencingObjectJoin (ca.corefacility.bioinformatics.irida.model.sample.SampleSequencingObjectJoin)24 SequencingObject (ca.corefacility.bioinformatics.irida.model.sequenceFile.SequencingObject)22 SequenceFilePair (ca.corefacility.bioinformatics.irida.model.sequenceFile.SequenceFilePair)20 WithMockUser (org.springframework.security.test.context.support.WithMockUser)18 Project (ca.corefacility.bioinformatics.irida.model.project.Project)17 AnalysisSubmission (ca.corefacility.bioinformatics.irida.model.workflow.submission.AnalysisSubmission)17 AnalysisFastQC (ca.corefacility.bioinformatics.irida.model.workflow.analysis.AnalysisFastQC)12 Analysis (ca.corefacility.bioinformatics.irida.model.workflow.analysis.Analysis)11 IridaWorkflow (ca.corefacility.bioinformatics.irida.model.workflow.IridaWorkflow)10 ArrayList (java.util.ArrayList)10 SequencingRun (ca.corefacility.bioinformatics.irida.model.run.SequencingRun)8 HistoriesClient (com.github.jmchilton.blend4j.galaxy.HistoriesClient)8 History (com.github.jmchilton.blend4j.galaxy.beans.History)8 GZIPOutputStream (java.util.zip.GZIPOutputStream)8 ModelMap (org.springframework.ui.ModelMap)8