use of ca.corefacility.bioinformatics.irida.model.sample.Sample in project irida by phac-nml.
the class SISTRSampleUpdaterTest method testUpdaterNoFile.
@Test(expected = PostProcessingException.class)
public void testUpdaterNoFile() throws PostProcessingException, AnalysisAlreadySetException {
ImmutableMap<String, String> expectedResults = ImmutableMap.of("SISTR serovar", "Enteritidis", "SISTR cgMLST Subspecies", "enterica", "SISTR QC Status", "PASS");
Path outputPath = Paths.get("src/test/resources/files/not_really_a_file.txt");
AnalysisOutputFile outputFile = new AnalysisOutputFile(outputPath, null, null, null);
Analysis analysis = new Analysis(null, ImmutableMap.of("sistr-predictions", outputFile), null, null);
AnalysisSubmission submission = AnalysisSubmission.builder(UUID.randomUUID()).inputFiles(ImmutableSet.of(new SingleEndSequenceFile(null))).build();
submission.setAnalysis(analysis);
Sample sample = new Sample();
sample.setId(1L);
updater.update(Lists.newArrayList(sample), submission);
}
use of ca.corefacility.bioinformatics.irida.model.sample.Sample in project irida by phac-nml.
the class AssemblyFileProcessorTest method testAssembleFile.
@Test
public void testAssembleFile() {
Long sequenceFileId = 1L;
SequenceFilePair pair = new SequenceFilePair(new SequenceFile(Paths.get("file_R1_1.fastq.gz")), new SequenceFile(Paths.get("file_R2_1.fastq.gz")));
Sample sample = new Sample();
Project project = new Project();
project.setAssembleUploads(true);
when(objectRepository.findOne(sequenceFileId)).thenReturn(pair);
when(ssoRepository.getSampleForSequencingObject(pair)).thenReturn(new SampleSequencingObjectJoin(sample, pair));
when(psjRepository.getProjectForSample(sample)).thenReturn(ImmutableList.of(new ProjectSampleJoin(project, sample, true)));
assertTrue("should want to assemble file", processor.shouldProcessFile(sequenceFileId));
processor.process(pair);
verify(submissionRepository).save(any(AnalysisSubmission.class));
}
use of ca.corefacility.bioinformatics.irida.model.sample.Sample in project irida by phac-nml.
the class AssemblyFileProcessorTest method testOneProjectEnabled.
@Test
public void testOneProjectEnabled() {
SequenceFilePair pair = new SequenceFilePair(new SequenceFile(Paths.get("file_R1_1.fastq.gz")), new SequenceFile(Paths.get("file_R2_1.fastq.gz")));
Sample sample = new Sample();
Project project = new Project();
project.setAssembleUploads(true);
Project disabledProject = new Project();
disabledProject.setAssembleUploads(false);
when(ssoRepository.getSampleForSequencingObject(pair)).thenReturn(new SampleSequencingObjectJoin(sample, pair));
when(psjRepository.getProjectForSample(sample)).thenReturn(ImmutableList.of(new ProjectSampleJoin(disabledProject, sample, true), new ProjectSampleJoin(project, sample, true)));
processor.process(pair);
verify(submissionRepository).save(any(AnalysisSubmission.class));
}
use of ca.corefacility.bioinformatics.irida.model.sample.Sample in project irida by phac-nml.
the class RESTProjectSamplesController method updateSample.
/**
* Update a {@link Sample} details.
*
* @param sampleId
* the identifier of the {@link Sample}.
* @param updatedFields
* the updated fields of the {@link Sample}.
* @return a response including links to the {@link Project} and
* {@link Sample}.
*/
@RequestMapping(value = "/api/samples/{sampleId}", method = RequestMethod.PATCH, consumes = { MediaType.APPLICATION_XML_VALUE, MediaType.APPLICATION_JSON_VALUE })
public ModelMap updateSample(@PathVariable Long sampleId, @RequestBody Map<String, Object> updatedFields) {
ModelMap modelMap = new ModelMap();
// issue an update request
final Sample s = sampleService.updateFields(sampleId, updatedFields);
addLinksForSample(Optional.empty(), s);
modelMap.addAttribute(RESTGenericController.RESOURCE_NAME, s);
return modelMap;
}
use of ca.corefacility.bioinformatics.irida.model.sample.Sample in project irida by phac-nml.
the class RESTProjectSamplesController method getSample.
/**
* Read a {@link Sample} by its id
*
* @param sampleId
* the id of the {@link Sample} to read
* @return representation of the sample
*/
@RequestMapping(value = "/api/samples/{sampleId}", method = RequestMethod.GET)
public ModelMap getSample(@PathVariable Long sampleId) {
ModelMap modelMap = new ModelMap();
Sample s = sampleService.read(sampleId);
addLinksForSample(Optional.empty(), s);
modelMap.addAttribute(RESTGenericController.RESOURCE_NAME, s);
return modelMap;
}
Aggregations