use of ca.corefacility.bioinformatics.irida.model.sequenceFile.SequencingObject in project irida by phac-nml.
the class AnalysisSubmissionRepositoryIT method testCreateAnalysisSingleAndPairedAndReference.
/**
* Tests creating an analysis with both single and paired files and a
* reference genome.
*/
@Test
@WithMockUser(username = "aaron", roles = "ADMIN")
public void testCreateAnalysisSingleAndPairedAndReference() {
Set<SequencingObject> inputs = Sets.newHashSet(sequenceFilePair, singleEndFile);
AnalysisSubmission analysisSubmissionPaired = AnalysisSubmission.builder(workflowId).name("submission paired 1").inputFiles(inputs).referenceFile(referenceFile).build();
analysisSubmissionPaired.setSubmitter(submitter1);
AnalysisSubmission savedSubmission = analysisSubmissionRepository.save(analysisSubmissionPaired);
Set<SequencingObject> inputsSaved = objectRepository.findSequencingObjectsForAnalysisSubmission(savedSubmission);
assertTrue("should have single end file in collection", inputsSaved.contains(singleEndFile));
assertTrue("should have pair file in collection", inputsSaved.contains(sequenceFilePair));
assertEquals(referenceFile, savedSubmission.getReferenceFile().get());
}
use of ca.corefacility.bioinformatics.irida.model.sequenceFile.SequencingObject in project irida by phac-nml.
the class AnalysisExecutionServiceGalaxyTest method setup.
/**
* Setup variables for tests.
*
* @throws IridaWorkflowNotFoundException
* @throws IOException
* @throws ExecutionManagerException
* @throws NoSuchValueException
* @throws IridaWorkflowAnalysisTypeException
*/
@Before
public void setup() throws IridaWorkflowNotFoundException, IOException, ExecutionManagerException, NoSuchValueException, IridaWorkflowAnalysisTypeException, AnalysisAlreadySetException {
MockitoAnnotations.initMocks(this);
String submissionName = "name";
Set<SequencingObject> submissionInputFiles = Sets.newHashSet(new SingleEndSequenceFile(new SequenceFile()));
analysisSubmission = AnalysisSubmission.builder(WORKFLOW_ID).name(submissionName + "intial").inputFiles(submissionInputFiles).build();
analysisPreparing = AnalysisSubmission.builder(WORKFLOW_ID).name(submissionName + "preparing").inputFiles(submissionInputFiles).build();
analysisPrepared = AnalysisSubmission.builder(WORKFLOW_ID).name(submissionName + "prepared").inputFiles(submissionInputFiles).build();
analysisSubmitting = AnalysisSubmission.builder(WORKFLOW_ID).name(submissionName + "submitting").inputFiles(submissionInputFiles).build();
analysisRunning = AnalysisSubmission.builder(WORKFLOW_ID).name(submissionName + "running").inputFiles(submissionInputFiles).build();
analysisFinishedRunning = AnalysisSubmission.builder(WORKFLOW_ID).name(submissionName + "finishedrunning").inputFiles(submissionInputFiles).build();
analysisCompleting = AnalysisSubmission.builder(WORKFLOW_ID).name(submissionName + "completing").inputFiles(submissionInputFiles).build();
analysisCompleted = AnalysisSubmission.builder(WORKFLOW_ID).name(submissionName + "completed").inputFiles(submissionInputFiles).build();
analysisCompletedCleaning = AnalysisSubmission.builder(WORKFLOW_ID).name(submissionName + "cleaning").inputFiles(submissionInputFiles).build();
analysisCompletedCleaned = AnalysisSubmission.builder(WORKFLOW_ID).name(submissionName + "cleaned").inputFiles(submissionInputFiles).build();
analysisError = AnalysisSubmission.builder(WORKFLOW_ID).name(submissionName + "error").inputFiles(submissionInputFiles).build();
analysisErrorCleaning = AnalysisSubmission.builder(WORKFLOW_ID).name(submissionName + "errorcleaning").inputFiles(submissionInputFiles).build();
analysisErrorCleaned = AnalysisSubmission.builder(WORKFLOW_ID).name(submissionName + "errorcleaned").inputFiles(submissionInputFiles).build();
AnalysisExecutionServiceGalaxyAsync workflowManagementAsync = new AnalysisExecutionServiceGalaxyAsync(analysisSubmissionService, analysisService, galaxyWorkflowService, analysisWorkspaceService, iridaWorkflowsService, analysisSubmissionSampleProcessor);
AnalysisExecutionServiceGalaxyCleanupAsync analysisExecutionServiceGalaxyCleanupAsync = new AnalysisExecutionServiceGalaxyCleanupAsync(analysisSubmissionService, galaxyWorkflowService, galaxyHistoriesService, galaxyLibrariesService);
workflowManagement = new AnalysisExecutionServiceGalaxy(analysisSubmissionService, galaxyHistoriesService, workflowManagementAsync, analysisExecutionServiceGalaxyCleanupAsync);
when(iridaWorkflowsService.getIridaWorkflow(WORKFLOW_ID)).thenReturn(iridaWorkflow);
when(iridaWorkflow.getWorkflowStructure()).thenReturn(iridaWorkflowStructure);
when(iridaWorkflowStructure.getWorkflowFile()).thenReturn(workflowFile);
when(analysisSubmissionService.create(analysisSubmission)).thenReturn(analysisSubmission);
when(analysisSubmissionService.read(INTERNAL_ANALYSIS_ID)).thenReturn(analysisSubmission);
analysisSubmission.setId(INTERNAL_ANALYSIS_ID);
analysisPreparing.setId(INTERNAL_ANALYSIS_ID);
analysisPreparing.setAnalysisState(AnalysisState.PREPARING);
when(analysisWorkspaceService.prepareAnalysisWorkspace(analysisPreparing)).thenReturn(ANALYSIS_ID);
analysisPrepared.setId(INTERNAL_ANALYSIS_ID);
analysisPrepared.setAnalysisState(AnalysisState.PREPARED);
analysisPrepared.setRemoteWorkflowId(REMOTE_WORKFLOW_ID);
analysisPrepared.setRemoteAnalysisId(ANALYSIS_ID);
analysisSubmitting.setId(INTERNAL_ANALYSIS_ID);
analysisSubmitting.setAnalysisState(AnalysisState.SUBMITTING);
analysisSubmitting.setRemoteWorkflowId(REMOTE_WORKFLOW_ID);
analysisSubmitting.setRemoteAnalysisId(ANALYSIS_ID);
analysisRunning.setId(INTERNAL_ANALYSIS_ID);
analysisRunning.setAnalysisState(AnalysisState.RUNNING);
analysisRunning.setRemoteWorkflowId(REMOTE_WORKFLOW_ID);
analysisRunning.setRemoteAnalysisId(ANALYSIS_ID);
analysisRunning.setRemoteInputDataId(LIBRARY_ID);
analysisFinishedRunning.setId(INTERNAL_ANALYSIS_ID);
analysisFinishedRunning.setAnalysisState(AnalysisState.FINISHED_RUNNING);
analysisFinishedRunning.setRemoteWorkflowId(REMOTE_WORKFLOW_ID);
analysisFinishedRunning.setRemoteAnalysisId(ANALYSIS_ID);
analysisFinishedRunning.setRemoteInputDataId(LIBRARY_ID);
analysisCompleting.setId(INTERNAL_ANALYSIS_ID);
analysisCompleting.setAnalysisState(AnalysisState.COMPLETING);
analysisCompleting.setRemoteWorkflowId(REMOTE_WORKFLOW_ID);
analysisCompleting.setRemoteAnalysisId(ANALYSIS_ID);
analysisCompleting.setRemoteInputDataId(LIBRARY_ID);
when(analysisWorkspaceService.getAnalysisResults(analysisCompleting)).thenReturn(analysisResults);
when(analysisService.create(analysisResults)).thenReturn(analysisResults);
analysisCompleted.setId(INTERNAL_ANALYSIS_ID);
analysisCompleted.setAnalysisState(AnalysisState.COMPLETED);
analysisCompleted.setRemoteWorkflowId(REMOTE_WORKFLOW_ID);
analysisCompleted.setRemoteAnalysisId(ANALYSIS_ID);
analysisCompleted.setAnalysisCleanedState(AnalysisCleanedState.NOT_CLEANED);
analysisCompleted.setAnalysis(analysisResults);
analysisCompleted.setRemoteInputDataId(LIBRARY_ID);
analysisCompleted.setUpdateSamples(true);
analysisCompletedCleaning.setId(INTERNAL_ANALYSIS_ID);
analysisCompletedCleaning.setAnalysisState(AnalysisState.COMPLETED);
analysisCompletedCleaning.setRemoteWorkflowId(REMOTE_WORKFLOW_ID);
analysisCompletedCleaning.setRemoteAnalysisId(ANALYSIS_ID);
analysisCompletedCleaning.setAnalysisCleanedState(AnalysisCleanedState.CLEANING);
analysisCompletedCleaning.setAnalysis(analysisResults);
analysisCompletedCleaning.setRemoteInputDataId(LIBRARY_ID);
analysisCompletedCleaned.setId(INTERNAL_ANALYSIS_ID);
analysisCompletedCleaned.setAnalysisState(AnalysisState.COMPLETED);
analysisCompletedCleaned.setRemoteWorkflowId(REMOTE_WORKFLOW_ID);
analysisCompletedCleaned.setRemoteAnalysisId(ANALYSIS_ID);
analysisCompletedCleaned.setAnalysisCleanedState(AnalysisCleanedState.CLEANED);
analysisCompletedCleaned.setAnalysis(analysisResults);
analysisCompletedCleaned.setRemoteInputDataId(LIBRARY_ID);
analysisError.setId(INTERNAL_ANALYSIS_ID);
analysisError.setAnalysisState(AnalysisState.ERROR);
analysisError.setRemoteWorkflowId(REMOTE_WORKFLOW_ID);
analysisError.setAnalysisCleanedState(AnalysisCleanedState.NOT_CLEANED);
analysisErrorCleaning.setId(INTERNAL_ANALYSIS_ID);
analysisErrorCleaning.setAnalysisState(AnalysisState.ERROR);
analysisErrorCleaning.setRemoteWorkflowId(REMOTE_WORKFLOW_ID);
analysisErrorCleaning.setAnalysisCleanedState(AnalysisCleanedState.CLEANING);
analysisErrorCleaned.setId(INTERNAL_ANALYSIS_ID);
analysisErrorCleaned.setAnalysisState(AnalysisState.ERROR);
analysisErrorCleaned.setRemoteWorkflowId(REMOTE_WORKFLOW_ID);
analysisErrorCleaned.setAnalysisCleanedState(AnalysisCleanedState.CLEANED);
analysisPrepared.setRemoteAnalysisId(ANALYSIS_ID);
preparedWorkflow = new PreparedWorkflowGalaxy(ANALYSIS_ID, LIBRARY_ID, workflowInputsGalaxy);
when(galaxyWorkflowService.uploadGalaxyWorkflow(workflowFile)).thenReturn(REMOTE_WORKFLOW_ID);
when(galaxyHistoriesService.deleteHistory(ANALYSIS_ID)).thenReturn(new HistoryDeleteResponse());
}
use of ca.corefacility.bioinformatics.irida.model.sequenceFile.SequencingObject in project irida by phac-nml.
the class AnalysisCollectionServiceGalaxyIT method testGetSequenceFileSingleSamplesSuccess.
/**
* Tests successfully getting a map of samples and sequence files (single).
*
* @throws DuplicateSampleException
*/
@Test
@WithMockUser(username = "aaron", roles = "ADMIN")
public void testGetSequenceFileSingleSamplesSuccess() throws DuplicateSampleException {
Set<SequencingObject> sequenceFiles = Sets.newHashSet(databaseSetupGalaxyITService.setupSequencingObjectInDatabase(1L, sequenceFilePathA));
Sample sample = sampleRepository.findOne(1L);
SequencingObject sequenceFile = sequenceFiles.iterator().next();
Map<Sample, SequencingObject> sampleSequenceFiles = sequencingObjectService.getUniqueSamplesForSequencingObjects(sequenceFiles);
assertEquals("sampleSequenceFiles map has size != 1", 1, sampleSequenceFiles.size());
assertEquals("sampleSequenceFiles map does not have sequenceFile " + sequenceFile + " corresponding to sample " + sample, sequenceFile, sampleSequenceFiles.get(sample));
}
use of ca.corefacility.bioinformatics.irida.model.sequenceFile.SequencingObject in project irida by phac-nml.
the class ProjectServiceImplIT method testGetProjectForSequencingObjectsAsUser.
@Test
@WithMockUser(username = "analysisuser", password = "password1", roles = "USER")
public void testGetProjectForSequencingObjectsAsUser() {
SequencingObject read = sequencingObjectService.read(1L);
Set<Project> projectsForSequencingObjects = projectService.getProjectsForSequencingObjects(ImmutableList.of(read));
assertEquals("should have found 1 project", 1, projectsForSequencingObjects.size());
Project project = projectsForSequencingObjects.iterator().next();
assertEquals("should have found project 2", new Long(2), project.getId());
}
use of ca.corefacility.bioinformatics.irida.model.sequenceFile.SequencingObject in project irida by phac-nml.
the class ProjectServiceImplIT method testGetProjectsForSequencingObjectsAsAdmin.
@Test
@WithMockUser(username = "admin", roles = "ADMIN")
public void testGetProjectsForSequencingObjectsAsAdmin() {
SequencingObject read = sequencingObjectService.read(1L);
Set<Project> projectsForSequencingObjects = projectService.getProjectsForSequencingObjects(ImmutableList.of(read));
assertEquals("should have found 2 projects", 2, projectsForSequencingObjects.size());
}
Aggregations