use of ca.corefacility.bioinformatics.irida.model.workflow.analysis.Analysis in project irida by phac-nml.
the class AnalysisExecutionServiceGalaxyIT method testTransferAnalysisResultsSuccessPhylogenomicsPairedParametersIgnoreDefaultValues.
/**
* Tests out getting analysis results successfully for phylogenomics
* pipeline (paired test version and ignoring default parameters).
*
* @throws Exception
*/
@Test
@WithMockUser(username = "aaron", roles = "ADMIN")
public void testTransferAnalysisResultsSuccessPhylogenomicsPairedParametersIgnoreDefaultValues() throws Exception {
String validMinCoverageFromProvenance = "\"5\"";
String validMidCoverageFromProvenance = "15";
String validMaxCoverageFromProvenance = "\"20\"";
Map<String, String> parameters = ImmutableMap.of("coverage", IridaWorkflowParameter.IGNORE_DEFAULT_VALUE);
// I verify parameters were set
String validTreeFile = "5 15 20";
// correctly by checking output file
// (where parameters were printed).
AnalysisSubmission analysisSubmission = analysisExecutionGalaxyITService.setupPairSubmissionInDatabase(1L, pairedPaths1, pairedPaths2, referenceFilePath, parameters, iridaPhylogenomicsPairedParametersWorkflowId);
Future<AnalysisSubmission> analysisSubmittedFuture = analysisExecutionService.prepareSubmission(analysisSubmission);
AnalysisSubmission analysisSubmitted = analysisSubmittedFuture.get();
Future<AnalysisSubmission> analysisExecutionFuture = analysisExecutionService.executeAnalysis(analysisSubmitted);
AnalysisSubmission analysisExecuted = analysisExecutionFuture.get();
analysisExecutionGalaxyITService.waitUntilSubmissionComplete(analysisExecuted);
analysisExecuted.setAnalysisState(AnalysisState.FINISHED_RUNNING);
Future<AnalysisSubmission> analysisSubmissionCompletedFuture = analysisExecutionService.transferAnalysisResults(analysisExecuted);
analysisSubmissionCompletedFuture.get();
AnalysisSubmission analysisSubmissionCompletedDatabase = analysisSubmissionService.read(analysisSubmission.getId());
assertEquals("analysis state is not completed", AnalysisState.COMPLETED, analysisSubmissionCompletedDatabase.getAnalysisState());
Analysis analysisResults = analysisSubmissionCompletedDatabase.getAnalysis();
assertEquals("analysis results is an invalid class", AnalysisType.PHYLOGENOMICS, analysisResults.getAnalysisType());
assertEquals("invalid number of output files", 3, analysisResults.getAnalysisOutputFiles().size());
AnalysisOutputFile phylogeneticTree = analysisResults.getAnalysisOutputFile(TREE_KEY);
AnalysisOutputFile snpMatrix = analysisResults.getAnalysisOutputFile(MATRIX_KEY);
AnalysisOutputFile snpTable = analysisResults.getAnalysisOutputFile(TABLE_KEY);
// verify parameters were set properly by checking contents of file
@SuppressWarnings("resource") String treeContent = new Scanner(phylogeneticTree.getFile().toFile()).useDelimiter("\\Z").next();
assertEquals("phylogenetic trees containing the parameters should be equal", validTreeFile, treeContent);
// phy tree
final ToolExecution phyTreeCoreInputs = phylogeneticTree.getCreatedByTool();
assertEquals("The first tool execution should be by core_pipeline_outputs_paired_with_parameters v0.1.0", "core_pipeline_outputs_paired_with_parameters", phyTreeCoreInputs.getToolName());
assertEquals("The first tool execution should be by core_pipeline_outputs_paired_with_parameters v0.1.0", "0.1.0", phyTreeCoreInputs.getToolVersion());
Map<String, String> phyTreeCoreParameters = phyTreeCoreInputs.getExecutionTimeParameters();
assertEquals("incorrect number of non-file parameters", 4, phyTreeCoreParameters.size());
assertEquals("parameter coverageMin set incorrectly", validMinCoverageFromProvenance, phyTreeCoreParameters.get("coverageMin"));
assertEquals("parameter coverageMid set incorrectly", validMidCoverageFromProvenance, phyTreeCoreParameters.get("conditional.coverageMid"));
assertEquals("parameter coverageMax set incorrectly", validMaxCoverageFromProvenance, phyTreeCoreParameters.get("coverageMax"));
assertEquals("parameter conditional_select set incorrectly", "all", phyTreeCoreParameters.get("conditional.conditional_select"));
Set<ToolExecution> phyTreeCorePreviousSteps = phyTreeCoreInputs.getPreviousSteps();
assertEquals("there should exist 2 previous steps", 2, phyTreeCorePreviousSteps.size());
Set<String> uploadedFileTypesPhy = Sets.newHashSet();
for (ToolExecution previousStep : phyTreeCorePreviousSteps) {
assertTrue("previous steps should be input tools.", previousStep.isInputTool());
uploadedFileTypesPhy.add(previousStep.getExecutionTimeParameters().get("file_type"));
}
assertEquals("uploaded files should have correct types", Sets.newHashSet("\"fastqsanger\"", "\"fasta\""), uploadedFileTypesPhy);
// snp matrix
final ToolExecution matrixCoreInputs = snpMatrix.getCreatedByTool();
assertEquals("The first tool execution should be by core_pipeline_outputs_paired_with_parameters v0.1.0", "core_pipeline_outputs_paired_with_parameters", matrixCoreInputs.getToolName());
assertEquals("The first tool execution should be by core_pipeline_outputs_paired_with_parameters v0.1.0", "0.1.0", matrixCoreInputs.getToolVersion());
Map<String, String> matrixCoreParameters = matrixCoreInputs.getExecutionTimeParameters();
assertEquals("incorrect number of non-file parameters", 4, matrixCoreParameters.size());
assertEquals("parameter coverageMin set incorrectly", validMinCoverageFromProvenance, matrixCoreParameters.get("coverageMin"));
assertEquals("parameter coverageMid set incorrectly", validMidCoverageFromProvenance, phyTreeCoreParameters.get("conditional.coverageMid"));
assertEquals("parameter coverageMax set incorrectly", validMaxCoverageFromProvenance, matrixCoreParameters.get("coverageMax"));
assertEquals("parameter conditional_select set incorrectly", "all", phyTreeCoreParameters.get("conditional.conditional_select"));
Set<ToolExecution> matrixCorePreviousSteps = matrixCoreInputs.getPreviousSteps();
assertEquals("there should exist 2 previous steps", 2, matrixCorePreviousSteps.size());
Set<String> uploadedFileTypesMatrix = Sets.newHashSet();
for (ToolExecution previousStep : matrixCorePreviousSteps) {
assertTrue("previous steps should be input tools.", previousStep.isInputTool());
uploadedFileTypesMatrix.add(previousStep.getExecutionTimeParameters().get("file_type"));
}
assertEquals("uploaded files should have correct types", Sets.newHashSet("\"fastqsanger\"", "\"fasta\""), uploadedFileTypesMatrix);
// snp table
final ToolExecution tableCoreInputs = snpTable.getCreatedByTool();
assertEquals("The first tool execution should be by core_pipeline_outputs_paired_with_parameters v0.1.0", "core_pipeline_outputs_paired_with_parameters", tableCoreInputs.getToolName());
assertEquals("The first tool execution should be by core_pipeline_outputs_paired_with_parameters v0.1.0", "0.1.0", tableCoreInputs.getToolVersion());
Map<String, String> tableCoreParameters = tableCoreInputs.getExecutionTimeParameters();
assertEquals("incorrect number of non-file parameters", 4, tableCoreParameters.size());
assertEquals("parameter coverageMin set incorrectly", validMinCoverageFromProvenance, tableCoreParameters.get("coverageMin"));
assertEquals("parameter coverageMid set incorrectly", validMidCoverageFromProvenance, phyTreeCoreParameters.get("conditional.coverageMid"));
assertEquals("parameter coverageMax set incorrectly", validMaxCoverageFromProvenance, tableCoreParameters.get("coverageMax"));
assertEquals("parameter conditional_select set incorrectly", "all", phyTreeCoreParameters.get("conditional.conditional_select"));
Set<ToolExecution> tablePreviousSteps = tableCoreInputs.getPreviousSteps();
assertEquals("there should exist 2 previous steps", 2, tablePreviousSteps.size());
Set<String> uploadedFileTypesTable = Sets.newHashSet();
for (ToolExecution previousStep : tablePreviousSteps) {
assertTrue("previous steps should be input tools.", previousStep.isInputTool());
uploadedFileTypesTable.add(previousStep.getExecutionTimeParameters().get("file_type"));
}
assertEquals("uploaded files should have correct types", Sets.newHashSet("\"fastqsanger\"", "\"fasta\""), uploadedFileTypesTable);
}
use of ca.corefacility.bioinformatics.irida.model.workflow.analysis.Analysis in project irida by phac-nml.
the class AnalysisExecutionServiceGalaxyIT method testTransferAnalysisResultsSuccessPhylogenomicsPairedParameters.
/**
* Tests out getting analysis results successfully for phylogenomics
* pipeline (paired test version with parameters).
*
* @throws Exception
*/
@Test
@WithMockUser(username = "aaron", roles = "ADMIN")
public void testTransferAnalysisResultsSuccessPhylogenomicsPairedParameters() throws Exception {
String validCoverage = "20";
// coverage from
String validCoverageFromProvenance = "\"20\"";
// provenance has quotes
// this value does not have quotes around it in final results.
String validMidCoverageFromProvenance = "20";
Map<String, String> parameters = ImmutableMap.of("coverage", validCoverage);
// I verify parameters were set
String validTreeFile = "20 20 20";
// correctly by checking output file
// (where parameters were printed).
AnalysisSubmission analysisSubmission = analysisExecutionGalaxyITService.setupPairSubmissionInDatabase(1L, pairedPaths1, pairedPaths2, referenceFilePath, parameters, iridaPhylogenomicsPairedParametersWorkflowId);
Future<AnalysisSubmission> analysisSubmittedFuture = analysisExecutionService.prepareSubmission(analysisSubmission);
AnalysisSubmission analysisSubmitted = analysisSubmittedFuture.get();
Future<AnalysisSubmission> analysisExecutionFuture = analysisExecutionService.executeAnalysis(analysisSubmitted);
AnalysisSubmission analysisExecuted = analysisExecutionFuture.get();
analysisExecutionGalaxyITService.waitUntilSubmissionComplete(analysisExecuted);
analysisExecuted.setAnalysisState(AnalysisState.FINISHED_RUNNING);
Future<AnalysisSubmission> analysisSubmissionCompletedFuture = analysisExecutionService.transferAnalysisResults(analysisExecuted);
analysisSubmissionCompletedFuture.get();
AnalysisSubmission analysisSubmissionCompletedDatabase = analysisSubmissionService.read(analysisSubmission.getId());
assertEquals("analysis state is not completed", AnalysisState.COMPLETED, analysisSubmissionCompletedDatabase.getAnalysisState());
Analysis analysisResults = analysisSubmissionCompletedDatabase.getAnalysis();
assertEquals("analysis results is an invalid class", AnalysisType.PHYLOGENOMICS, analysisResults.getAnalysisType());
assertEquals("invalid number of output files", 3, analysisResults.getAnalysisOutputFiles().size());
AnalysisOutputFile phylogeneticTree = analysisResults.getAnalysisOutputFile(TREE_KEY);
AnalysisOutputFile snpMatrix = analysisResults.getAnalysisOutputFile(MATRIX_KEY);
AnalysisOutputFile snpTable = analysisResults.getAnalysisOutputFile(TABLE_KEY);
// verify parameters were set properly by checking contents of file
@SuppressWarnings("resource") String treeContent = new Scanner(phylogeneticTree.getFile().toFile()).useDelimiter("\\Z").next();
assertEquals("phylogenetic trees containing the parameters should be equal", validTreeFile, treeContent);
// phy tree
final ToolExecution phyTreeCoreInputs = phylogeneticTree.getCreatedByTool();
assertEquals("The first tool execution should be by core_pipeline_outputs_paired_with_parameters v0.1.0", "core_pipeline_outputs_paired_with_parameters", phyTreeCoreInputs.getToolName());
assertEquals("The first tool execution should be by core_pipeline_outputs_paired_with_parameters v0.1.0", "0.1.0", phyTreeCoreInputs.getToolVersion());
Map<String, String> phyTreeCoreParameters = phyTreeCoreInputs.getExecutionTimeParameters();
assertEquals("incorrect number of non-file parameters", 4, phyTreeCoreParameters.size());
assertEquals("parameter coverageMin set incorrectly", validCoverageFromProvenance, phyTreeCoreParameters.get("coverageMin"));
assertEquals("parameter coverageMid set incorrectly", validMidCoverageFromProvenance, phyTreeCoreParameters.get("conditional.coverageMid"));
assertEquals("parameter coverageMax set incorrectly", validCoverageFromProvenance, phyTreeCoreParameters.get("coverageMax"));
assertEquals("parameter conditional_select set incorrectly", "all", phyTreeCoreParameters.get("conditional.conditional_select"));
Set<ToolExecution> phyTreeCorePreviousSteps = phyTreeCoreInputs.getPreviousSteps();
assertEquals("there should exist 2 previous steps", 2, phyTreeCorePreviousSteps.size());
Set<String> uploadedFileTypesPhy = Sets.newHashSet();
for (ToolExecution previousStep : phyTreeCorePreviousSteps) {
assertTrue("previous steps should be input tools.", previousStep.isInputTool());
uploadedFileTypesPhy.add(previousStep.getExecutionTimeParameters().get("file_type"));
}
assertEquals("uploaded files should have correct types", Sets.newHashSet("\"fastqsanger\"", "\"fasta\""), uploadedFileTypesPhy);
// snp matrix
final ToolExecution matrixCoreInputs = snpMatrix.getCreatedByTool();
assertEquals("The first tool execution should be by core_pipeline_outputs_paired_with_parameters v0.1.0", "core_pipeline_outputs_paired_with_parameters", matrixCoreInputs.getToolName());
assertEquals("The first tool execution should be by core_pipeline_outputs_paired_with_parameters v0.1.0", "0.1.0", matrixCoreInputs.getToolVersion());
Map<String, String> matrixCoreParameters = matrixCoreInputs.getExecutionTimeParameters();
assertEquals("incorrect number of non-file parameters", 4, matrixCoreParameters.size());
assertEquals("parameter coverageMin set incorrectly", validCoverageFromProvenance, matrixCoreParameters.get("coverageMin"));
assertEquals("parameter coverageMid set incorrectly", validMidCoverageFromProvenance, phyTreeCoreParameters.get("conditional.coverageMid"));
assertEquals("parameter coverageMax set incorrectly", validCoverageFromProvenance, matrixCoreParameters.get("coverageMax"));
assertEquals("parameter conditional_select set incorrectly", "all", phyTreeCoreParameters.get("conditional.conditional_select"));
Set<ToolExecution> matrixCorePreviousSteps = matrixCoreInputs.getPreviousSteps();
assertEquals("there should exist 2 previous steps", 2, matrixCorePreviousSteps.size());
Set<String> uploadedFileTypesMatrix = Sets.newHashSet();
for (ToolExecution previousStep : matrixCorePreviousSteps) {
assertTrue("previous steps should be input tools.", previousStep.isInputTool());
uploadedFileTypesMatrix.add(previousStep.getExecutionTimeParameters().get("file_type"));
}
assertEquals("uploaded files should have correct types", Sets.newHashSet("\"fastqsanger\"", "\"fasta\""), uploadedFileTypesMatrix);
// snp table
final ToolExecution tableCoreInputs = snpTable.getCreatedByTool();
assertEquals("The first tool execution should be by core_pipeline_outputs_paired_with_parameters v0.1.0", "core_pipeline_outputs_paired_with_parameters", tableCoreInputs.getToolName());
assertEquals("The first tool execution should be by core_pipeline_outputs_paired_with_parameters v0.1.0", "0.1.0", tableCoreInputs.getToolVersion());
Map<String, String> tableCoreParameters = tableCoreInputs.getExecutionTimeParameters();
assertEquals("incorrect number of non-file parameters", 4, tableCoreParameters.size());
assertEquals("parameter coverageMin set incorrectly", validCoverageFromProvenance, tableCoreParameters.get("coverageMin"));
assertEquals("parameter coverageMid set incorrectly", validMidCoverageFromProvenance, phyTreeCoreParameters.get("conditional.coverageMid"));
assertEquals("parameter coverageMax set incorrectly", validCoverageFromProvenance, tableCoreParameters.get("coverageMax"));
assertEquals("parameter conditional_select set incorrectly", "all", phyTreeCoreParameters.get("conditional.conditional_select"));
Set<ToolExecution> tablePreviousSteps = tableCoreInputs.getPreviousSteps();
assertEquals("there should exist 2 previous steps", 2, tablePreviousSteps.size());
Set<String> uploadedFileTypesTable = Sets.newHashSet();
for (ToolExecution previousStep : tablePreviousSteps) {
assertTrue("previous steps should be input tools.", previousStep.isInputTool());
uploadedFileTypesTable.add(previousStep.getExecutionTimeParameters().get("file_type"));
}
assertEquals("uploaded files should have correct types", Sets.newHashSet("\"fastqsanger\"", "\"fasta\""), uploadedFileTypesTable);
}
use of ca.corefacility.bioinformatics.irida.model.workflow.analysis.Analysis in project irida by phac-nml.
the class AnalysisExecutionServiceGalaxyIT method testTransferAnalysisResultsSuccessPhylogenomicsPaired.
/**
* Tests out getting analysis results successfully for phylogenomics
* pipeline (paired test version).
*
* @throws Exception
*/
@Test
@WithMockUser(username = "aaron", roles = "ADMIN")
public void testTransferAnalysisResultsSuccessPhylogenomicsPaired() throws Exception {
AnalysisSubmission analysisSubmission = analysisExecutionGalaxyITService.setupPairSubmissionInDatabase(1L, pairedPaths1, pairedPaths2, referenceFilePath, iridaPhylogenomicsPairedWorkflowId, false);
Future<AnalysisSubmission> analysisSubmittedFuture = analysisExecutionService.prepareSubmission(analysisSubmission);
AnalysisSubmission analysisSubmitted = analysisSubmittedFuture.get();
Future<AnalysisSubmission> analysisExecutionFuture = analysisExecutionService.executeAnalysis(analysisSubmitted);
AnalysisSubmission analysisExecuted = analysisExecutionFuture.get();
analysisExecutionGalaxyITService.waitUntilSubmissionComplete(analysisExecuted);
analysisExecuted.setAnalysisState(AnalysisState.FINISHED_RUNNING);
Future<AnalysisSubmission> analysisSubmissionCompletedFuture = analysisExecutionService.transferAnalysisResults(analysisExecuted);
AnalysisSubmission analysisSubmissionCompleted = analysisSubmissionCompletedFuture.get();
AnalysisSubmission analysisSubmissionCompletedDatabase = analysisSubmissionService.read(analysisSubmission.getId());
assertEquals("analysis state is not completed", AnalysisState.COMPLETED, analysisSubmissionCompletedDatabase.getAnalysisState());
assertEquals("analysis state is not completed", AnalysisState.COMPLETED, analysisSubmissionCompleted.getAnalysisState());
Analysis analysisResults = analysisSubmissionCompleted.getAnalysis();
Analysis analysisResultsDatabase = analysisSubmissionCompletedDatabase.getAnalysis();
assertEquals("analysis results in returned submission and from database should be the same", analysisResults.getId(), analysisResultsDatabase.getId());
assertEquals(AnalysisType.PHYLOGENOMICS, analysisResults.getAnalysisType());
String analysisId = analysisExecuted.getRemoteAnalysisId();
assertEquals("id should be set properly for analysis", analysisId, analysisResultsDatabase.getExecutionManagerAnalysisId());
assertEquals("invalid number of output files", 3, analysisResultsDatabase.getAnalysisOutputFiles().size());
AnalysisOutputFile phylogeneticTree = analysisResultsDatabase.getAnalysisOutputFile(TREE_KEY);
AnalysisOutputFile snpMatrix = analysisResultsDatabase.getAnalysisOutputFile(MATRIX_KEY);
AnalysisOutputFile snpTable = analysisResultsDatabase.getAnalysisOutputFile(TABLE_KEY);
assertTrue("phylogenetic trees should be equal", com.google.common.io.Files.equal(expectedTree.toFile(), phylogeneticTree.getFile().toFile()));
assertEquals("invalid file name for snp tree", expectedTree.getFileName(), phylogeneticTree.getFile().getFileName());
assertTrue("command line (" + phylogeneticTree.getCreatedByTool().getCommandLine() + ") should match the defined pattern (" + CMD_LINE_PATTERN + ") (phylogenetic tree).", phylogeneticTree.getCreatedByTool().getCommandLine().matches(CMD_LINE_PATTERN));
final ToolExecution phyTreeCoreInputs = phylogeneticTree.getCreatedByTool();
assertEquals("The first tool execution should be by core_pipeline_outputs_paired v0.1.0", "core_pipeline_outputs_paired", phyTreeCoreInputs.getToolName());
assertEquals("The first tool execution should be by core_pipeline_outputs_paired v0.1.0", "0.1.0", phyTreeCoreInputs.getToolVersion());
final ToolExecution phyTreeCoreUpload = phyTreeCoreInputs.getPreviousSteps().iterator().next();
assertTrue("Second step should be input tool.", phyTreeCoreUpload.isInputTool());
assertTrue("snp matrices should be correct", com.google.common.io.Files.equal(expectedSnpMatrix.toFile(), snpMatrix.getFile().toFile()));
assertEquals("invalid file name for snp matrix", expectedSnpMatrix.getFileName(), snpMatrix.getFile().getFileName());
assertTrue("command line (" + snpMatrix.getCreatedByTool().getCommandLine() + ") should match the defined pattern (" + CMD_LINE_PATTERN + ") (snp matrix).", snpMatrix.getCreatedByTool().getCommandLine().matches(CMD_LINE_PATTERN));
final ToolExecution snpMatrixCoreInputs = snpMatrix.getCreatedByTool();
assertEquals("The first tool execution should be by core_pipeline_outputs_paired v0.1.0", "core_pipeline_outputs_paired", snpMatrixCoreInputs.getToolName());
assertEquals("The first tool execution should be by core_pipeline_outputs_paired v0.1.0", "0.1.0", snpMatrixCoreInputs.getToolVersion());
final ToolExecution snpMatrixCoreUpload = snpMatrixCoreInputs.getPreviousSteps().iterator().next();
assertTrue("Second step should be input tool.", snpMatrixCoreUpload.isInputTool());
assertTrue("snpTable should be correct", com.google.common.io.Files.equal(expectedSnpTable.toFile(), snpTable.getFile().toFile()));
assertEquals("invalid file name for snp table", expectedSnpTable.getFileName(), snpTable.getFile().getFileName());
assertTrue("command line (" + snpTable.getCreatedByTool().getCommandLine() + ") should match the defined pattern (" + CMD_LINE_PATTERN + ") (snp table).", snpTable.getCreatedByTool().getCommandLine().matches(CMD_LINE_PATTERN));
final ToolExecution snpTableCoreInputs = snpTable.getCreatedByTool();
assertEquals("The first tool execution should be by core_pipeline_outputs_paired v0.1.0", "core_pipeline_outputs_paired", snpTableCoreInputs.getToolName());
assertEquals("The first tool execution should be by core_pipeline_outputs_paired v0.1.0", "0.1.0", snpTableCoreInputs.getToolVersion());
final ToolExecution snpTableCoreUpload = snpTableCoreInputs.getPreviousSteps().iterator().next();
assertTrue("Second step should be input tool.", snpTableCoreUpload.isInputTool());
AnalysisSubmission finalSubmission = analysisSubmissionRepository.findOne(analysisExecuted.getId());
Analysis analysis = finalSubmission.getAnalysis();
assertNotNull("analysis should not be null in submission", analysis);
Analysis savedAnalysisFromDatabase = analysisService.read(analysisResultsDatabase.getId());
assertEquals("saved analysis in submission is not correct class", AnalysisType.PHYLOGENOMICS, savedAnalysisFromDatabase.getAnalysisType());
assertEquals("Analysis from submission and from database should be the same", savedAnalysisFromDatabase.getId(), analysis.getId());
assertEquals("analysis results from database and from submission should have correct id", analysisResultsDatabase.getId(), savedAnalysisFromDatabase.getId());
assertEquals("analysis results from database and from submission should have correct tree output file", analysisResultsDatabase.getAnalysisOutputFile(TREE_KEY).getFile(), savedAnalysisFromDatabase.getAnalysisOutputFile(TREE_KEY).getFile());
assertEquals("analysis results from database and from submission should have correct matrix output file", analysisResultsDatabase.getAnalysisOutputFile(MATRIX_KEY).getFile(), savedAnalysisFromDatabase.getAnalysisOutputFile(MATRIX_KEY).getFile());
assertEquals("analysis results from database and from submission should have correct table output file", analysisResultsDatabase.getAnalysisOutputFile(MATRIX_KEY).getFile(), savedAnalysisFromDatabase.getAnalysisOutputFile(MATRIX_KEY).getFile());
}
use of ca.corefacility.bioinformatics.irida.model.workflow.analysis.Analysis in project irida by phac-nml.
the class AnalysisExecutionServiceGalaxyIT method testTransferAnalysisResultsSuccessPhylogenomicsPairedMultiLeveledParameters.
/**
* Tests out getting analysis results successfully for phylogenomics
* pipeline (paired test version with multiple levels of parameters).
*
* @throws Exception
*/
@Test
@WithMockUser(username = "aaron", roles = "ADMIN")
public void testTransferAnalysisResultsSuccessPhylogenomicsPairedMultiLeveledParameters() throws Exception {
String validCoverage = "20";
// coverage from
String validCoverageFromProvenance = "\"20\"";
// provenance has quotes
// this value does not have quotes around it in final results.
String validMidCoverageFromProvenance = "20";
String validParameterValueFromProvenance = "20";
Map<String, String> parameters = ImmutableMap.of("coverage", validCoverage);
// I verify parameters were set
String validTreeFile = "20 20 20 20";
// correctly by checking output file
// (where parameters were printed).
AnalysisSubmission analysisSubmission = analysisExecutionGalaxyITService.setupPairSubmissionInDatabase(1L, pairedPaths1, pairedPaths2, referenceFilePath, parameters, iridaPhylogenomicsPairedMultiLeveledParametersWorkflowId);
Future<AnalysisSubmission> analysisSubmittedFuture = analysisExecutionService.prepareSubmission(analysisSubmission);
AnalysisSubmission analysisSubmitted = analysisSubmittedFuture.get();
Future<AnalysisSubmission> analysisExecutionFuture = analysisExecutionService.executeAnalysis(analysisSubmitted);
AnalysisSubmission analysisExecuted = analysisExecutionFuture.get();
analysisExecutionGalaxyITService.waitUntilSubmissionComplete(analysisExecuted);
analysisExecuted.setAnalysisState(AnalysisState.FINISHED_RUNNING);
Future<AnalysisSubmission> analysisSubmissionCompletedFuture = analysisExecutionService.transferAnalysisResults(analysisExecuted);
analysisSubmissionCompletedFuture.get();
AnalysisSubmission analysisSubmissionCompletedDatabase = analysisSubmissionService.read(analysisSubmission.getId());
assertEquals("analysis state is not completed", AnalysisState.COMPLETED, analysisSubmissionCompletedDatabase.getAnalysisState());
Analysis analysisResults = analysisSubmissionCompletedDatabase.getAnalysis();
assertEquals("analysis results is an invalid class", AnalysisType.PHYLOGENOMICS, analysisResults.getAnalysisType());
assertEquals("invalid number of output files", 3, analysisResults.getAnalysisOutputFiles().size());
AnalysisOutputFile phylogeneticTree = analysisResults.getAnalysisOutputFile(TREE_KEY);
// verify parameters were set properly by checking contents of file
@SuppressWarnings("resource") String treeContent = new Scanner(phylogeneticTree.getFile().toFile()).useDelimiter("\\Z").next();
assertEquals("phylogenetic trees containing the parameters should be equal", validTreeFile, treeContent);
// phy tree
final ToolExecution phyTreeCoreInputs = phylogeneticTree.getCreatedByTool();
assertEquals("The first tool execution should be by core_pipeline_outputs_paired_with_multi_level_parameters v0.1.0", "core_pipeline_outputs_paired_with_multi_level_parameters", phyTreeCoreInputs.getToolName());
assertEquals("The first tool execution should be by core_pipeline_outputs_paired_with_multi_level_parameters v0.1.0", "0.1.0", phyTreeCoreInputs.getToolVersion());
Map<String, String> phyTreeCoreParameters = phyTreeCoreInputs.getExecutionTimeParameters();
assertEquals("incorrect number of non-file parameters", 6, phyTreeCoreParameters.size());
assertEquals("parameter coverageMin set incorrectly", validCoverageFromProvenance, phyTreeCoreParameters.get("coverageMin"));
assertEquals("parameter coverageMid set incorrectly", validMidCoverageFromProvenance, phyTreeCoreParameters.get("conditional.coverageMid"));
assertEquals("parameter 'parameter' set incorrectly", validParameterValueFromProvenance, phyTreeCoreParameters.get("conditional.level2.parameter"));
assertEquals("parameter coverageMax set incorrectly", validCoverageFromProvenance, phyTreeCoreParameters.get("coverageMax"));
assertEquals("parameter conditional_select set incorrectly", "all", phyTreeCoreParameters.get("conditional.conditional_select"));
assertEquals("parameter conditional_select set incorrectly", "all2", phyTreeCoreParameters.get("conditional.level2.level2_select"));
}
use of ca.corefacility.bioinformatics.irida.model.workflow.analysis.Analysis in project irida by phac-nml.
the class AnalysisExecutionServiceGalaxyIT method testTransferAnalysisResultsSuccessTestAnalysis.
/**
* Tests out getting analysis results successfully.
*
* @throws Exception
*/
@Test
@WithMockUser(username = "aaron", roles = "ADMIN")
public void testTransferAnalysisResultsSuccessTestAnalysis() throws Exception {
AnalysisSubmission analysisSubmission = analysisExecutionGalaxyITService.setupSubmissionInDatabase(1L, sequenceFilePath, referenceFilePath, iridaTestAnalysisWorkflowId, false);
Future<AnalysisSubmission> analysisSubmittedFuture = analysisExecutionService.prepareSubmission(analysisSubmission);
AnalysisSubmission analysisSubmitted = analysisSubmittedFuture.get();
Future<AnalysisSubmission> analysisExecutionFuture = analysisExecutionService.executeAnalysis(analysisSubmitted);
AnalysisSubmission analysisExecuted = analysisExecutionFuture.get();
analysisExecutionGalaxyITService.waitUntilSubmissionComplete(analysisExecuted);
analysisExecuted.setAnalysisState(AnalysisState.FINISHED_RUNNING);
Future<AnalysisSubmission> analysisSubmissionCompletedFuture = analysisExecutionService.transferAnalysisResults(analysisExecuted);
AnalysisSubmission analysisSubmissionCompleted = analysisSubmissionCompletedFuture.get();
AnalysisSubmission analysisSubmissionCompletedDatabase = analysisSubmissionService.read(analysisSubmission.getId());
assertEquals(AnalysisState.COMPLETED, analysisSubmissionCompletedDatabase.getAnalysisState());
assertEquals(AnalysisState.COMPLETED, analysisSubmissionCompleted.getAnalysisState());
Analysis analysisResults = analysisSubmissionCompleted.getAnalysis();
Analysis analysisResultsDatabase = analysisSubmissionCompletedDatabase.getAnalysis();
assertEquals("analysis results in returned submission and from database should be the same", analysisResults.getId(), analysisResultsDatabase.getId());
assertEquals(Analysis.class, analysisResults.getClass());
String analysisId = analysisExecuted.getRemoteAnalysisId();
assertEquals("id should be set properly for analysis", analysisId, analysisResults.getExecutionManagerAnalysisId());
assertEquals(2, analysisResults.getAnalysisOutputFiles().size());
AnalysisOutputFile output1 = analysisResultsDatabase.getAnalysisOutputFile("output1");
AnalysisOutputFile output2 = analysisResultsDatabase.getAnalysisOutputFile("output2");
assertTrue("output files 1 should be equal", com.google.common.io.Files.equal(expectedOutputFile1.toFile(), output1.getFile().toFile()));
assertEquals(expectedOutputFile1.getFileName(), output1.getFile().getFileName());
assertTrue("output files 2 should be equal", com.google.common.io.Files.equal(expectedOutputFile2.toFile(), output2.getFile().toFile()));
assertEquals(expectedOutputFile2.getFileName(), output2.getFile().getFileName());
AnalysisSubmission finalSubmission = analysisSubmissionRepository.findOne(analysisExecuted.getId());
Analysis analysis = finalSubmission.getAnalysis();
assertNotNull(analysis);
Analysis savedAnalysisFromDatabase = analysisService.read(analysisResults.getId());
assertTrue(savedAnalysisFromDatabase instanceof Analysis);
Analysis savedTest = (Analysis) savedAnalysisFromDatabase;
assertEquals("Analysis from submission and from database should be the same", savedAnalysisFromDatabase.getId(), analysis.getId());
assertEquals(analysisResults.getId(), savedTest.getId());
}
Aggregations