use of ca.corefacility.bioinformatics.irida.model.workflow.description.IridaWorkflowDescription in project irida by phac-nml.
the class IridaWorkflowLoaderServiceIT method testLoadWorkflowDescriptionSinglePaired.
/**
* Tests loading up the workflow description file (single and paired end data).
*
* @throws IOException
* @throws IridaWorkflowLoadException
*/
@Test
public void testLoadWorkflowDescriptionSinglePaired() throws IOException, IridaWorkflowLoadException {
IridaWorkflowDescription iridaWorkflowDescription = buildTestDescriptionSinglePaired();
IridaWorkflowDescription iridaWorkflowFromFile = workflowLoaderService.loadWorkflowDescription(workflowSinglePairedXmlPath);
assertEquals("irida workflow description is invalid", iridaWorkflowFromFile, iridaWorkflowDescription);
}
use of ca.corefacility.bioinformatics.irida.model.workflow.description.IridaWorkflowDescription in project irida by phac-nml.
the class IridaWorkflowLoaderServiceIT method testLoadWorkflowDescriptionPaired.
/**
* Tests loading up the workflow description file (paired end data).
*
* @throws IOException
* @throws IridaWorkflowLoadException
*/
@Test
public void testLoadWorkflowDescriptionPaired() throws IOException, IridaWorkflowLoadException {
IridaWorkflowDescription iridaWorkflowDescription = buildTestDescriptionPaired();
IridaWorkflowDescription iridaWorkflowFromFile = workflowLoaderService.loadWorkflowDescription(workflowPairedXmlPath);
assertEquals("irida workflow description is invalid", iridaWorkflowFromFile, iridaWorkflowDescription);
}
use of ca.corefacility.bioinformatics.irida.model.workflow.description.IridaWorkflowDescription in project irida by phac-nml.
the class AssemblyFileProcessorTest method setUp.
@Before
public void setUp() throws IridaWorkflowNotFoundException {
MockitoAnnotations.initMocks(this);
processor = new AssemblyFileProcessor(objectRepository, submissionRepository, workflowsService, userRepository, ssoRepository, psjRepository);
UUID workflowUUID = UUID.randomUUID();
IridaWorkflowDescription workflowDescription = new IridaWorkflowDescription(workflowUUID, null, null, null, null, ImmutableList.of(), ImmutableList.of(), ImmutableList.of());
IridaWorkflow workflow = new IridaWorkflow(workflowDescription, null);
when(workflowsService.getDefaultWorkflowByType(AnalysisType.ASSEMBLY_ANNOTATION)).thenReturn(workflow);
when(userRepository.loadUserByUsername("admin")).thenReturn(new User());
}
use of ca.corefacility.bioinformatics.irida.model.workflow.description.IridaWorkflowDescription in project irida by phac-nml.
the class AnalysisControllerTest method testGetAnalysisDetailsTree.
@Test
public void testGetAnalysisDetailsTree() throws IOException, IridaWorkflowNotFoundException {
Long submissionId = 1L;
ExtendedModelMap model = new ExtendedModelMap();
Locale locale = Locale.ENGLISH;
final IridaWorkflowInput input = new IridaWorkflowInput("single", "paired", "reference", true);
AnalysisSubmission submission = TestDataFactory.constructAnalysisSubmission();
IridaWorkflowDescription description = new IridaWorkflowDescription(submission.getWorkflowId(), "My Workflow", "V1", AnalysisType.PHYLOGENOMICS, input, Lists.newArrayList(), Lists.newArrayList(), Lists.newArrayList());
IridaWorkflow iridaWorkflow = new IridaWorkflow(description, null);
submission.setAnalysisState(AnalysisState.COMPLETED);
when(analysisSubmissionServiceMock.read(submissionId)).thenReturn(submission);
when(iridaWorkflowsServiceMock.getIridaWorkflow(submission.getWorkflowId())).thenReturn(iridaWorkflow);
String detailsPage = analysisController.getDetailsPage(submissionId, model, locale);
assertEquals("should be details page", AnalysisController.PAGE_DETAILS_DIRECTORY + "tree", detailsPage);
assertEquals("Tree preview should be set", "tree", model.get("preview"));
assertEquals("submission should be in model", submission, model.get("analysisSubmission"));
assertEquals("submission reference file should be in model.", submission.getReferenceFile().get(), model.get("referenceFile"));
}
use of ca.corefacility.bioinformatics.irida.model.workflow.description.IridaWorkflowDescription in project irida by phac-nml.
the class AnalysisSubmissionServiceImpl method createSingleSampleSubmission.
/**
* {@inheritDoc}
*/
@Override
@Transactional
@PreAuthorize("hasRole('ROLE_USER')")
public Collection<AnalysisSubmission> createSingleSampleSubmission(IridaWorkflow workflow, Long ref, List<SingleEndSequenceFile> sequenceFiles, List<SequenceFilePair> sequenceFilePairs, Map<String, String> params, IridaWorkflowNamedParameters namedParameters, String name, String analysisDescription, List<Project> projectsToShare, boolean writeResultsToSamples) {
final Collection<AnalysisSubmission> createdSubmissions = new HashSet<AnalysisSubmission>();
// Single end reads
IridaWorkflowDescription description = workflow.getWorkflowDescription();
if (description.acceptsSingleSequenceFiles()) {
final Map<Sample, SingleEndSequenceFile> samplesMap = sequencingObjectService.getUniqueSamplesForSequencingObjects(Sets.newHashSet(sequenceFiles));
for (final Map.Entry<Sample, SingleEndSequenceFile> entry : samplesMap.entrySet()) {
Sample s = entry.getKey();
SingleEndSequenceFile file = entry.getValue();
// Build the analysis submission
AnalysisSubmission.Builder builder = AnalysisSubmission.builder(workflow.getWorkflowIdentifier());
builder.name(name + "_" + s.getSampleName());
builder.inputFiles(ImmutableSet.of(file));
builder.updateSamples(writeResultsToSamples);
builder.priority(AnalysisSubmission.Priority.MEDIUM);
// Add reference file
if (ref != null && description.requiresReference()) {
// Note: This cannot be empty if through the UI if the
// pipeline required a reference file.
ReferenceFile referenceFile = referenceFileRepository.findOne(ref);
builder.referenceFile(referenceFile);
}
if (description.acceptsParameters()) {
if (namedParameters != null) {
builder.withNamedParameters(namedParameters);
} else {
if (!params.isEmpty()) {
// Note: This cannot be empty if through the UI if
// the pipeline required params.
builder.inputParameters(params);
}
}
}
// Create the submission
createdSubmissions.add(create(builder.build()));
}
}
// Paired end reads
if (description.acceptsPairedSequenceFiles()) {
final Map<Sample, SequenceFilePair> samplesMap = sequencingObjectService.getUniqueSamplesForSequencingObjects(Sets.newHashSet(sequenceFilePairs));
for (final Map.Entry<Sample, SequenceFilePair> entry : samplesMap.entrySet()) {
Sample s = entry.getKey();
SequenceFilePair filePair = entry.getValue();
// Build the analysis submission
AnalysisSubmission.Builder builder = AnalysisSubmission.builder(workflow.getWorkflowIdentifier());
builder.name(name + "_" + s.getSampleName());
builder.inputFiles(ImmutableSet.of(filePair));
builder.updateSamples(writeResultsToSamples);
// Add reference file
if (ref != null && description.requiresReference()) {
ReferenceFile referenceFile = referenceFileRepository.findOne(ref);
builder.referenceFile(referenceFile);
}
if (description.acceptsParameters()) {
if (namedParameters != null) {
builder.withNamedParameters(namedParameters);
} else {
if (!params.isEmpty()) {
// Note: This cannot be empty if through the UI if
// the pipeline required params.
builder.inputParameters(params);
}
}
}
// Add description to submission, can be null
builder.analysisDescription(analysisDescription);
// Create the submission
createdSubmissions.add(create(builder.build()));
}
}
// Share with the required projects
for (AnalysisSubmission submission : createdSubmissions) {
for (Project project : projectsToShare) {
pasRepository.save(new ProjectAnalysisSubmissionJoin(project, submission));
}
}
return createdSubmissions;
}
Aggregations