use of ca.corefacility.bioinformatics.irida.model.project.ReferenceFile in project irida by phac-nml.
the class ReferenceFileControllerTest method setUp.
@Before
public void setUp() {
projectService = mock(ProjectService.class);
referenceFileService = mock(ReferenceFileService.class);
messageSource = mock(MessageSource.class);
// Set up the reference file
Path path = Paths.get(FILE_PATH);
ReferenceFile file = new ReferenceFile(path);
when(referenceFileService.read(FILE_ID)).thenReturn(file);
controller = new ReferenceFileController(projectService, referenceFileService, messageSource);
}
use of ca.corefacility.bioinformatics.irida.model.project.ReferenceFile in project irida by phac-nml.
the class ReferenceFileControllerTest method testCreateNewReferenceFile.
@Test
public void testCreateNewReferenceFile() throws IOException {
Path path = Paths.get(FILE_PATH);
byte[] origBytes = Files.readAllBytes(path);
List<MultipartFile> mockMultipartFiles = ImmutableList.of(new MockMultipartFile(FILE_NAME, FILE_NAME, "octet-stream", origBytes));
// TODO: (14-08-14 - Josh) look at Franklin's TestDataFactory
Project project = new Project("foo");
ReferenceFile referenceFile = new TestReferenceFile(path, 2L);
when(projectService.read(PROJECT_ID)).thenReturn(project);
when(projectService.addReferenceFileToProject(eq(project), any(ReferenceFile.class))).thenReturn(new ProjectReferenceFileJoin(project, referenceFile));
MockHttpServletResponse response = new MockHttpServletResponse();
controller.addReferenceFileToProject(PROJECT_ID, mockMultipartFiles, response, null);
verify(projectService).read(PROJECT_ID);
verify(projectService).addReferenceFileToProject(eq(project), any(ReferenceFile.class));
}
use of ca.corefacility.bioinformatics.irida.model.project.ReferenceFile in project irida by phac-nml.
the class DatabaseSetupGalaxyITService method setupPairSubmissionInDatabase.
/**
* Sets up an {@link AnalysisSubmission} with a list of paired sequence
* files and saves all dependencies in database.
*
* @param sampleId
* The id of the sample to associate with the given sequence
* file.
* @param sequenceFilePaths1
* A list of paths for the first part of the pair.
* @param sequenceFilePaths2
* A list of paths for the second part of the pair. The path to
* an input sequence file for this test.
* @param referenceFilePath
* The path to an input reference file for this test.
* @param parameters
* The input parameters.
* @param iridaWorkflowId
* The id of an irida workflow.
* @param state
* {@link AnalysisState} of the submission
* @return An {@link AnalysisSubmission} which has been saved to the
* database.
*/
public AnalysisSubmission setupPairSubmissionInDatabase(long sampleId, List<Path> sequenceFilePaths1, List<Path> sequenceFilePaths2, Path referenceFilePath, Map<String, String> parameters, UUID iridaWorkflowId, AnalysisState state) {
List<SequenceFilePair> sequenceFilePairs = setupSampleSequenceFileInDatabase(sampleId, sequenceFilePaths1, sequenceFilePaths2);
ReferenceFile referenceFile = referenceFileRepository.save(new ReferenceFile(referenceFilePath));
AnalysisSubmission submission = AnalysisSubmission.builder(iridaWorkflowId).name("paired analysis").inputFiles(Sets.newHashSet(sequenceFilePairs)).referenceFile(referenceFile).inputParameters(parameters).build();
submission.setAnalysisState(state);
analysisSubmissionService.create(submission);
return analysisSubmissionRepository.findOne(submission.getId());
}
use of ca.corefacility.bioinformatics.irida.model.project.ReferenceFile in project irida by phac-nml.
the class DatabaseSetupGalaxyITService method setupSinglePairSubmissionInDatabaseDifferentSample.
/**
* Sets up an {@link AnalysisSubmission} with a list of paired sequence
* files and a single sequence file under a different sample and saves all
* dependencies in database.
*
* @param sampleIdPaired
* The id of the sample to associate with the paired sequence
* files.
* @param sampleIdSingle
* The id of the sample to associate with the single sequence
* file.
* @param sequenceFilePaths1
* A list of paths for the first part of the pair.
* @param sequenceFilePaths2
* A list of paths for the second part of the pair. The path to
* an input sequence file for this test.
* @param singleSequenceFile
* A single sequence file to add.
* @param referenceFilePath
* The path to an input reference file for this test.
* @param iridaWorkflowId
* The id of an irida workflow.
* @return An {@link AnalysisSubmission} which has been saved to the
* database.
*/
public AnalysisSubmission setupSinglePairSubmissionInDatabaseDifferentSample(long sampleIdPaired, long sampleIdSingle, List<Path> sequenceFilePaths1, List<Path> sequenceFilePaths2, Path singleSequenceFile, Path referenceFilePath, UUID iridaWorkflowId) {
SingleEndSequenceFile singleEndFile = (SingleEndSequenceFile) setupSequencingObjectInDatabase(sampleIdSingle, singleSequenceFile).get(0);
List<SequenceFilePair> sequenceFilePairs = setupSampleSequenceFileInDatabase(sampleIdPaired, sequenceFilePaths1, sequenceFilePaths2);
Set<SequencingObject> inputs = Sets.newHashSet(sequenceFilePairs);
inputs.add(singleEndFile);
ReferenceFile referenceFile = referenceFileRepository.save(new ReferenceFile(referenceFilePath));
AnalysisSubmission submission = AnalysisSubmission.builder(iridaWorkflowId).name("paired analysis").inputFiles(inputs).referenceFile(referenceFile).build();
analysisSubmissionService.create(submission);
return analysisSubmissionRepository.findOne(submission.getId());
}
use of ca.corefacility.bioinformatics.irida.model.project.ReferenceFile in project irida by phac-nml.
the class DatabaseSetupGalaxyITService method setupPairSubmissionInDatabase.
/**
* Sets up an {@link AnalysisSubmission} with a list of paired sequence
* files and saves all dependencies in database.
*
* @param iridaWorkflowId The id of an irida workflow.
* @param sampleId The id of the sample to associate with the given sequence
* file.
* @param sequenceFilePaths1 A list of paths for the first part of the pair.
* @param sequenceFilePaths2 A list of paths for the second part of the pair. The path to
* an input sequence file for this test.
* @param referenceFilePath The path to an input reference file for this test.
* @param updateSamples whether to run the sampleUpdater for this analysis
* @return An {@link AnalysisSubmission} which has been saved to the
* database.
*/
public AnalysisSubmission setupPairSubmissionInDatabase(long sampleId, List<Path> sequenceFilePaths1, List<Path> sequenceFilePaths2, Path referenceFilePath, UUID iridaWorkflowId, boolean updateSamples) {
List<SequenceFilePair> sequenceFilePairs = setupSampleSequenceFileInDatabase(sampleId, sequenceFilePaths1, sequenceFilePaths2);
List<SequenceFilePair> settledFiles = new ArrayList<>();
for (final SequenceFilePair f : sequenceFilePairs) {
waitForFilesToSettle(f);
settledFiles.add((SequenceFilePair) sequencingObjectService.read(f.getId()));
}
ReferenceFile referenceFile = referenceFileRepository.save(new ReferenceFile(referenceFilePath));
AnalysisSubmission submission = AnalysisSubmission.builder(iridaWorkflowId).name("paired analysis").inputFiles(Sets.newHashSet(settledFiles)).referenceFile(referenceFile).updateSamples(updateSamples).build();
analysisSubmissionService.create(submission);
return analysisSubmissionRepository.findOne(submission.getId());
}
Aggregations