use of ca.corefacility.bioinformatics.irida.model.joins.impl.SampleGenomeAssemblyJoin in project irida by phac-nml.
the class SamplesController method getSampleFiles.
/**
* Get the page that shows the files belonging to that sample.
*
* @param model
* Spring {@link Model}
* @param projectId
* the id of the {@link Project} the sample is in
* @param sampleId
* Sample id
* @return a Map representing all files (pairs and singles) for the sample.
*/
@RequestMapping(value = { "/projects/{projectId}/samples/{sampleId}/sequenceFiles" })
public String getSampleFiles(final Model model, @PathVariable Long projectId, @PathVariable Long sampleId) {
Sample sample = sampleService.read(sampleId);
model.addAttribute("sampleId", sampleId);
Collection<SampleSequencingObjectJoin> filePairJoins = sequencingObjectService.getSequencesForSampleOfType(sample, SequenceFilePair.class);
Collection<SampleSequencingObjectJoin> singleFileJoins = sequencingObjectService.getSequencesForSampleOfType(sample, SingleEndSequenceFile.class);
Collection<SampleGenomeAssemblyJoin> genomeAssemblyJoins = sampleService.getAssembliesForSample(sample);
logger.trace("Assembly joins " + genomeAssemblyJoins);
List<GenomeAssembly> genomeAssemblies = genomeAssemblyJoins.stream().map(SampleGenomeAssemblyJoin::getObject).collect(Collectors.toList());
List<SequencingObject> filePairs = filePairJoins.stream().map(SampleSequencingObjectJoin::getObject).collect(Collectors.toList());
// get the project if available
Project project = null;
if (projectId != null) {
project = projectService.read(projectId);
}
// add project to qc entries and filter any unavailable entries
for (SequencingObject f : filePairs) {
enhanceQcEntries(f, project);
}
for (SampleSequencingObjectJoin f : singleFileJoins) {
enhanceQcEntries(f.getObject(), project);
}
// SequenceFile
model.addAttribute("paired_end", filePairs);
model.addAttribute("single_end", singleFileJoins);
// assemblies
model.addAttribute("assemblies", genomeAssemblies);
model.addAttribute(MODEL_ATTR_SAMPLE, sample);
model.addAttribute(MODEL_ATTR_CAN_MANAGE_SAMPLE, isProjectManagerForSample(sample));
model.addAttribute(MODEL_ATTR_ACTIVE_NAV, ACTIVE_NAV_FILES);
return SAMPLE_FILES_PAGE;
}
Aggregations