use of com.github.jmchilton.blend4j.galaxy.ToolsClient in project irida by phac-nml.
the class AnalysisProvenanceServiceGalaxyTest method setUp.
@Before
public void setUp() {
this.galaxyHistoriesService = mock(GalaxyHistoriesService.class);
this.toolsClient = mock(ToolsClient.class);
this.jobsClient = mock(JobsClient.class);
this.provenanceService = new AnalysisProvenanceServiceGalaxy(galaxyHistoriesService, toolsClient, jobsClient);
}
use of com.github.jmchilton.blend4j.galaxy.ToolsClient in project irida by phac-nml.
the class AnalysisExecutionServiceTestConfig method analysisProvenanceServiceGalaxy.
@Lazy
@Bean
public AnalysisProvenanceServiceGalaxy analysisProvenanceServiceGalaxy() {
final ToolsClient toolsClient = localGalaxy.getGalaxyInstanceAdmin().getToolsClient();
final JobsClient jobsClient = localGalaxy.getGalaxyInstanceAdmin().getJobsClient();
return new AnalysisProvenanceServiceGalaxy(galaxyHistoriesService, toolsClient, jobsClient);
}
use of com.github.jmchilton.blend4j.galaxy.ToolsClient in project irida by phac-nml.
the class AnalysisWorkspaceServiceGalaxyIT method setup.
/**
* Sets up variables for testing.
*
* @throws URISyntaxException
* @throws IOException
* @throws IridaWorkflowLoadException
*/
@Before
public void setup() throws URISyntaxException, IOException, IridaWorkflowLoadException {
Assume.assumeFalse(WindowsPlatformCondition.isWindows());
Path sequenceFilePathReal = Paths.get(DatabaseSetupGalaxyITService.class.getResource("testData1.fastq").toURI());
Path referenceFilePathReal = Paths.get(DatabaseSetupGalaxyITService.class.getResource("testReference.fasta").toURI());
Path tempDir = Files.createTempDirectory(rootTempDirectory, "workspaceServiceGalaxyTest");
sequenceFilePathA = tempDir.resolve("testDataA_R1_001.fastq");
Files.copy(sequenceFilePathReal, sequenceFilePathA, StandardCopyOption.REPLACE_EXISTING);
sequenceFilePath2A = tempDir.resolve("testDataA_R2_001.fastq");
Files.copy(sequenceFilePathReal, sequenceFilePath2A, StandardCopyOption.REPLACE_EXISTING);
sequenceFilePathB = tempDir.resolve("testDataB_R1_001.fastq");
Files.copy(sequenceFilePathReal, sequenceFilePathB, StandardCopyOption.REPLACE_EXISTING);
sequenceFilePath2B = tempDir.resolve("testDataB_R2_001.fastq");
Files.copy(sequenceFilePathReal, sequenceFilePath2B, StandardCopyOption.REPLACE_EXISTING);
sequenceFilePath3 = tempDir.resolve("testData3_R1_001.fastq");
Files.copy(sequenceFilePathReal, sequenceFilePath3, StandardCopyOption.REPLACE_EXISTING);
referenceFilePath = Files.createTempFile("testReference", ".fasta");
Files.delete(referenceFilePath);
Files.copy(referenceFilePathReal, referenceFilePath);
singleFileSet = Sets.newHashSet(new SingleEndSequenceFile(new SequenceFile(sequenceFilePathA)));
GalaxyInstance galaxyInstanceAdmin = localGalaxy.getGalaxyInstanceAdmin();
HistoriesClient historiesClient = galaxyInstanceAdmin.getHistoriesClient();
ToolsClient toolsClient = galaxyInstanceAdmin.getToolsClient();
LibrariesClient librariesClient = galaxyInstanceAdmin.getLibrariesClient();
GalaxyLibrariesService galaxyLibrariesService = new GalaxyLibrariesService(librariesClient, LIBRARY_POLLING_TIME, LIBRARY_TIMEOUT, 1);
galaxyHistoriesService = new GalaxyHistoriesService(historiesClient, toolsClient, galaxyLibrariesService);
pairSequenceFiles1A = new ArrayList<>();
pairSequenceFiles1A.add(sequenceFilePathA);
pairSequenceFiles2A = new ArrayList<>();
pairSequenceFiles2A.add(sequenceFilePath2A);
pairSequenceFiles1AB = new ArrayList<>();
pairSequenceFiles1AB.add(sequenceFilePathA);
pairSequenceFiles1AB.add(sequenceFilePathB);
pairSequenceFiles2AB = new ArrayList<>();
pairSequenceFiles2AB.add(sequenceFilePath2A);
pairSequenceFiles2AB.add(sequenceFilePath2B);
}
use of com.github.jmchilton.blend4j.galaxy.ToolsClient in project irida by phac-nml.
the class AnalysisWorkspaceServiceGalaxyIT method testGetAnalysisResultsPhylogenomicsSuccess.
/**
* Tests out successfully getting results for an analysis (phylogenomics).
*
* @throws InterruptedException
* @throws ExecutionManagerException
* @throws IridaWorkflowNotFoundException
* @throws IOException
* @throws IridaWorkflowAnalysisTypeException
* @throws TimeoutException
*/
@Test
@WithMockUser(username = "aaron", roles = "ADMIN")
public void testGetAnalysisResultsPhylogenomicsSuccess() throws InterruptedException, ExecutionManagerException, IridaWorkflowNotFoundException, IOException, IridaWorkflowAnalysisTypeException, TimeoutException {
History history = new History();
history.setName("testGetAnalysisResultsPhylogenomicsSuccess");
HistoriesClient historiesClient = localGalaxy.getGalaxyInstanceAdmin().getHistoriesClient();
WorkflowsClient workflowsClient = localGalaxy.getGalaxyInstanceAdmin().getWorkflowsClient();
ToolsClient toolsClient = localGalaxy.getGalaxyInstanceAdmin().getToolsClient();
History createdHistory = historiesClient.create(history);
// upload test outputs
uploadFileToHistory(sequenceFilePathA, TABLE_NAME, createdHistory.getId(), toolsClient);
uploadFileToHistory(sequenceFilePathA, MATRIX_NAME, createdHistory.getId(), toolsClient);
uploadFileToHistory(sequenceFilePathA, TREE_NAME, createdHistory.getId(), toolsClient);
// wait for history
Util.waitUntilHistoryComplete(createdHistory.getId(), galaxyHistoriesService, 60);
IridaWorkflow iridaWorkflow = iridaWorkflowsService.getIridaWorkflow(phylogenomicsWorkflowId);
Path workflowPath = iridaWorkflow.getWorkflowStructure().getWorkflowFile();
String workflowString = new String(Files.readAllBytes(workflowPath), StandardCharsets.UTF_8);
Workflow galaxyWorkflow = workflowsClient.importWorkflow(workflowString);
AnalysisSubmission analysisSubmission = analysisExecutionGalaxyITService.setupSubmissionInDatabase(1L, sequenceFilePathA, referenceFilePath, phylogenomicsWorkflowId, false);
analysisSubmission.setRemoteAnalysisId(createdHistory.getId());
analysisSubmission.setRemoteWorkflowId(galaxyWorkflow.getId());
analysisSubmission.setAnalysisState(AnalysisState.COMPLETING);
analysisSubmissionRepository.save(analysisSubmission);
Analysis analysis = analysisWorkspaceService.getAnalysisResults(analysisSubmission);
assertNotNull("the analysis results were not properly created", analysis);
assertEquals("the Analysis results class is invalid", AnalysisType.PHYLOGENOMICS, analysis.getAnalysisType());
assertEquals("the analysis results has an invalid number of output files", 3, analysis.getAnalysisOutputFiles().size());
assertEquals("the analysis results output file has an invalid name", Paths.get(TABLE_NAME), analysis.getAnalysisOutputFile(TABLE_KEY).getFile().getFileName());
assertEquals("the analysis results output file has an invalid label", TABLE_NAME, analysis.getAnalysisOutputFile(TABLE_KEY).getLabel());
assertEquals("the analysis results output file has an invalid name", Paths.get(MATRIX_NAME), analysis.getAnalysisOutputFile(MATRIX_KEY).getFile().getFileName());
assertEquals("the analysis results output file has an invalid label", MATRIX_NAME, analysis.getAnalysisOutputFile(MATRIX_KEY).getLabel());
assertEquals("the analysis results output file has an invalid name", Paths.get(TREE_NAME), analysis.getAnalysisOutputFile(TREE_KEY).getFile().getFileName());
assertEquals("the analysis results output file has an invalid label", TREE_NAME, analysis.getAnalysisOutputFile(TREE_KEY).getLabel());
}
use of com.github.jmchilton.blend4j.galaxy.ToolsClient in project irida by phac-nml.
the class AnalysisWorkspaceServiceGalaxyIT method testGetAnalysisResultsTestAnalysisFail.
/**
* Tests out failing to get results for an analysis (missing output file).
*
* @throws InterruptedException
* @throws ExecutionManagerException
* @throws IridaWorkflowNotFoundException
* @throws IOException
* @throws IridaWorkflowAnalysisTypeException
* @throws TimeoutException
*/
@Test(expected = GalaxyDatasetNotFoundException.class)
@WithMockUser(username = "aaron", roles = "ADMIN")
public void testGetAnalysisResultsTestAnalysisFail() throws InterruptedException, ExecutionManagerException, IridaWorkflowNotFoundException, IOException, IridaWorkflowAnalysisTypeException, TimeoutException {
History history = new History();
history.setName("testGetAnalysisResultsTestAnalysisFail");
HistoriesClient historiesClient = localGalaxy.getGalaxyInstanceAdmin().getHistoriesClient();
WorkflowsClient workflowsClient = localGalaxy.getGalaxyInstanceAdmin().getWorkflowsClient();
ToolsClient toolsClient = localGalaxy.getGalaxyInstanceAdmin().getToolsClient();
History createdHistory = historiesClient.create(history);
// upload test outputs
uploadFileToHistory(sequenceFilePathA, OUTPUT1_NAME, createdHistory.getId(), toolsClient);
// wait for history
Util.waitUntilHistoryComplete(createdHistory.getId(), galaxyHistoriesService, 60);
IridaWorkflow iridaWorkflow = iridaWorkflowsService.getIridaWorkflow(validWorkflowIdSingle);
Path workflowPath = iridaWorkflow.getWorkflowStructure().getWorkflowFile();
String workflowString = new String(Files.readAllBytes(workflowPath), StandardCharsets.UTF_8);
Workflow galaxyWorkflow = workflowsClient.importWorkflow(workflowString);
AnalysisSubmission analysisSubmission = analysisExecutionGalaxyITService.setupSubmissionInDatabase(1L, sequenceFilePathA, referenceFilePath, validWorkflowIdSingle, false);
analysisSubmission.setRemoteAnalysisId(createdHistory.getId());
analysisSubmission.setRemoteWorkflowId(galaxyWorkflow.getId());
analysisSubmission.setAnalysisState(AnalysisState.COMPLETING);
analysisSubmissionRepository.save(analysisSubmission);
analysisWorkspaceService.getAnalysisResults(analysisSubmission);
}
Aggregations