use of ca.corefacility.bioinformatics.irida.model.project.ReferenceFile in project irida by phac-nml.
the class ProjectServiceImplIT method testAddReferenceFileAmbiguouusBasesToProject.
@Test(expected = UnsupportedReferenceFileContentError.class)
@WithMockUser(username = "admin", roles = "ADMIN")
public void testAddReferenceFileAmbiguouusBasesToProject() throws IOException, URISyntaxException {
ReferenceFile f = new ReferenceFile();
Path referenceFilePath = Paths.get(getClass().getResource("/ca/corefacility/bioinformatics/irida/service/testReferenceAmbiguous.fasta").toURI());
Path createTempFile = Files.createTempFile("testReference", ".fasta");
Files.delete(createTempFile);
referenceFilePath = Files.copy(referenceFilePath, createTempFile);
referenceFilePath.toFile().deleteOnExit();
f.setFile(referenceFilePath);
Project p = projectService.read(1L);
projectService.addReferenceFileToProject(p, f);
}
use of ca.corefacility.bioinformatics.irida.model.project.ReferenceFile in project irida by phac-nml.
the class ReferenceFileServiceImplIT method testRead.
@Test
@WithMockUser(username = "fbristow", roles = "USER")
public void testRead() {
ReferenceFile read = referenceFileService.read(1L);
assertNotNull(read);
}
use of ca.corefacility.bioinformatics.irida.model.project.ReferenceFile in project irida by phac-nml.
the class ReferenceFileServiceImplIT method testGetReferenceFilesForProject.
@Test
@WithMockUser(username = "fbristow", roles = "ADMIN")
public void testGetReferenceFilesForProject() {
Project p = projectService.read(1L);
List<Join<Project, ReferenceFile>> prs = referenceFileService.getReferenceFilesForProject(p);
assertEquals("Wrong number of reference files for project.", 1, prs.size());
ReferenceFile rf = prs.iterator().next().getObject();
assertEquals("Wrong reference file attached to project.", Long.valueOf(1), rf.getId());
}
use of ca.corefacility.bioinformatics.irida.model.project.ReferenceFile in project irida by phac-nml.
the class SampleServiceImplIT method testEstimateCoverageForSampleReferenceFile.
/**
* Tests esimating coverage with a reference file.
*
* @throws SequenceFileAnalysisException
*/
@Test
@WithMockUser(username = "fbristow", roles = "USER")
public void testEstimateCoverageForSampleReferenceFile() throws SequenceFileAnalysisException {
Long sampleID = 1L;
Sample s = sampleService.read(sampleID);
ReferenceFile referenceFile = new ReferenceFile();
referenceFile.setFileLength(500L);
double coverage = sampleService.estimateCoverageForSample(s, referenceFile);
assertEquals(2.0, coverage, deltaFloatEquality);
}
use of ca.corefacility.bioinformatics.irida.model.project.ReferenceFile in project irida by phac-nml.
the class ReferenceFileControllerTest method testDeleteReferenceFile.
@Test
public void testDeleteReferenceFile() {
logger.debug("Testing delete reference file");
MockHttpServletResponse response = new MockHttpServletResponse();
Project project = TestDataFactory.constructProject();
ReferenceFile file = TestDataFactory.constructReferenceFile();
when(projectService.read(project.getId())).thenReturn(project);
when(referenceFileService.read(file.getId())).thenReturn(file);
Map<String, Object> result = controller.deleteReferenceFile(file.getId(), project.getId(), response, Locale.US);
assertTrue(result.containsKey("result"));
assertEquals("success", result.get("result"));
}
Aggregations