use of ca.corefacility.bioinformatics.irida.model.sample.QCEntry in project irida by phac-nml.
the class SequencingObjectServiceImplIT method testCreateSequenceFileInSample.
@Test
@WithMockUser(username = "fbristow", roles = "SEQUENCER")
public void testCreateSequenceFileInSample() throws IOException, InterruptedException {
Sample s = sampleService.read(1L);
SequenceFile sf = new SequenceFile();
Path sequenceFile = Files.createTempFile("TEMPORARY-SEQUENCE-FILE", ".gz");
OutputStream gzOut = new GZIPOutputStream(Files.newOutputStream(sequenceFile));
gzOut.write(FASTQ_FILE_CONTENTS);
gzOut.close();
sf.setFile(sequenceFile);
SingleEndSequenceFile so = new SingleEndSequenceFile(sf);
objectService.createSequencingObjectInSample(so, s);
SequencingRun mr = sequencingRunService.read(1L);
sequencingRunService.addSequencingObjectToSequencingRun(mr, so);
// Sleeping for a bit to let file processing run
Thread.sleep(10000);
Sample readSample = sampleService.read(s.getId());
List<QCEntry> qcEntries = sampleService.getQCEntriesForSample(readSample);
assertEquals("should be one qc entries", 1, qcEntries.size());
QCEntry qcEntry = qcEntries.iterator().next();
assertTrue("should be coverage entry", qcEntry instanceof CoverageQCEntry);
CoverageQCEntry coverage = (CoverageQCEntry) qcEntry;
assertEquals("should be 18 bases", 18, coverage.getTotalBases());
}
use of ca.corefacility.bioinformatics.irida.model.sample.QCEntry in project irida by phac-nml.
the class ProjectSamplesController method buildProjectSampleDataTablesModel.
/**
* Build a {@link ProjectSampleModel} object for a given {@link Sample}
*
* @param sso a {@link ProjectSampleJoin} to build the {@link ProjectSampleModel} from
* @param locale of the current user.
* @return a newly constructed {@link ProjectSampleModel}
*/
private DTProjectSamples buildProjectSampleDataTablesModel(ProjectSampleJoin sso, Locale locale) {
Project p = sso.getSubject();
List<QCEntry> qcEntriesForSample = sampleService.getQCEntriesForSample(sso.getObject());
List<String> list = new ArrayList<>();
for (QCEntry q : qcEntriesForSample) {
q.addProjectSettings(p);
String status = q.getStatus().toString();
if (q.getStatus() == QCEntry.QCEntryStatus.NEGATIVE) {
list.add(messageSource.getMessage("sample.files.qc." + q.getType(), new Object[] { q.getMessage() }, locale));
}
}
return new DTProjectSamples(sso, list);
}
use of ca.corefacility.bioinformatics.irida.model.sample.QCEntry in project irida by phac-nml.
the class DefaultFileProcessingChainTest method testFailWriteQCEntry.
@Test
public void testFailWriteQCEntry() throws FileProcessorTimeoutException {
FileProcessingChain fileProcessingChain = new DefaultFileProcessingChain(objectRepository, qcRepository, new FailingFileProcessorNoContinue());
when(objectRepository.exists(objectId)).thenReturn(true);
boolean exceptionCaught = false;
try {
fileProcessingChain.launchChain(1L);
} catch (FileProcessorException e) {
exceptionCaught = true;
}
assertTrue("File process should have thrown exception", exceptionCaught);
ArgumentCaptor<QCEntry> captor = ArgumentCaptor.forClass(QCEntry.class);
verify(qcRepository).save(captor.capture());
QCEntry qcEntry = captor.getValue();
assertEquals("should have saved qc entry for sample", seqObject, qcEntry.getSequencingObject());
}
Aggregations