Search in sources :

Example 1 with GalaxyInstance

use of com.github.jmchilton.blend4j.galaxy.GalaxyInstance in project irida by phac-nml.

the class GalaxyHistoriesServiceIT method testNewHistoryForWorkflow.

/**
 * Tests constructing new history for a workflow.
 */
@Test
public void testNewHistoryForWorkflow() {
    GalaxyInstance galaxyInstanceAdmin = localGalaxy.getGalaxyInstanceAdmin();
    HistoriesClient historiesClient = galaxyInstanceAdmin.getHistoriesClient();
    History actualHistory = galaxyHistory.newHistoryForWorkflow();
    assertNotNull(actualHistory);
    // make sure history is within Galaxy
    History foundHistory = null;
    for (History h : historiesClient.getHistories()) {
        if (h.getId().equals(actualHistory.getId())) {
            foundHistory = h;
        }
    }
    assertNotNull(foundHistory);
}
Also used : History(com.github.jmchilton.blend4j.galaxy.beans.History) GalaxyInstance(com.github.jmchilton.blend4j.galaxy.GalaxyInstance) HistoriesClient(com.github.jmchilton.blend4j.galaxy.HistoriesClient) Test(org.junit.Test)

Example 2 with GalaxyInstance

use of com.github.jmchilton.blend4j.galaxy.GalaxyInstance in project irida by phac-nml.

the class NonWindowsLocalGalaxyConfig method localGalaxy.

/**
 * Builds a new LocalGalaxy allowing for connecting with a running Galaxy
 * instance.
 *
 * @return A LocalGalaxy with information about the running Galaxy instance.
 * @throws Exception
 */
@Lazy
@Bean
public LocalGalaxy localGalaxy() throws Exception {
    LocalGalaxy localGalaxy = new LocalGalaxy();
    logger.debug("Setting URL for test Galaxy: " + galaxyURL);
    logger.debug("Setting invalid URL for test Galaxy: " + galaxyInvalidURL);
    logger.debug("Setting invalid URL2 for test Galaxy: " + galaxyInvalidURL2);
    localGalaxy.setGalaxyURL(galaxyURL);
    localGalaxy.setInvalidGalaxyURL(galaxyInvalidURL);
    localGalaxy.setTestGalaxyURL(galaxyInvalidURL2);
    localGalaxy.setAdminName(new GalaxyAccountEmail("admin@galaxy.org"));
    localGalaxy.setAdminPassword("admin");
    localGalaxy.setAdminAPIKey("admin");
    logger.debug("Creating Admin Blend4j Galaxy Instance using api key: " + localGalaxy.getAdminAPIKey());
    GalaxyInstance adminInstance = GalaxyInstanceFactory.get(localGalaxy.getGalaxyURL().toString(), localGalaxy.getAdminAPIKey());
    localGalaxy.setGalaxyInstanceAdmin(adminInstance);
    localGalaxy.setupWorkflows();
    return localGalaxy;
}
Also used : LocalGalaxy(ca.corefacility.bioinformatics.irida.pipeline.upload.galaxy.integration.LocalGalaxy) GalaxyAccountEmail(ca.corefacility.bioinformatics.irida.model.upload.galaxy.GalaxyAccountEmail) GalaxyInstance(com.github.jmchilton.blend4j.galaxy.GalaxyInstance) Lazy(org.springframework.context.annotation.Lazy) Bean(org.springframework.context.annotation.Bean)

Example 3 with GalaxyInstance

use of com.github.jmchilton.blend4j.galaxy.GalaxyInstance in project irida by phac-nml.

the class JobDetailsCommandLineTransfer method main.

public static void main(String[] args) {
    checkNotNull(GALAXY_URL, "Galaxy URL is required. [galaxy.url]");
    checkNotNull(GALAXY_API, "Galaxy API key is required. [galaxy.api.key]");
    checkNotNull(JDBC_URL, "JDBC URL is required. [jdbc.url]");
    checkNotNull(JDBC_USER, "JDBC user is required. [jdbc.user]");
    checkNotNull(JDBC_PASS, "JDBC password is required. [jdbc.pass]");
    final GalaxyInstance gi = GalaxyInstanceFactory.get(GALAXY_URL, GALAXY_API);
    final JobsClient jobsClient = gi.getJobsClient();
    final DriverManagerDataSource dataSource = new DriverManagerDataSource(JDBC_URL, JDBC_USER, JDBC_PASS);
    dataSource.setDriverClassName("com.mysql.jdbc.Driver");
    final JdbcTemplate template = new JdbcTemplate(dataSource);
    template.query("select id, execution_manager_identifier from tool_execution", (rs, row) -> Pair.of(rs.getLong("id"), rs.getString("execution_manager_identifier"))).forEach(e -> {
        final JobDetails jobDetails = jobsClient.showJob(e.v);
        template.update("update tool_execution set command_line = ? where id = ?", jobDetails.getCommandLine(), e.k);
        logger.debug(String.format("Updated tool execution [%s] with command line [%s]", e.k, jobDetails.getCommandLine()));
    });
}
Also used : Logger(org.slf4j.Logger) GalaxyInstance(com.github.jmchilton.blend4j.galaxy.GalaxyInstance) LoggerFactory(org.slf4j.LoggerFactory) GalaxyInstanceFactory(com.github.jmchilton.blend4j.galaxy.GalaxyInstanceFactory) DriverManagerDataSource(org.springframework.jdbc.datasource.DriverManagerDataSource) Preconditions(com.google.common.base.Preconditions) JobsClient(com.github.jmchilton.blend4j.galaxy.JobsClient) JobDetails(com.github.jmchilton.blend4j.galaxy.beans.JobDetails) JdbcTemplate(org.springframework.jdbc.core.JdbcTemplate) DriverManagerDataSource(org.springframework.jdbc.datasource.DriverManagerDataSource) JdbcTemplate(org.springframework.jdbc.core.JdbcTemplate) GalaxyInstance(com.github.jmchilton.blend4j.galaxy.GalaxyInstance) JobDetails(com.github.jmchilton.blend4j.galaxy.beans.JobDetails) JobsClient(com.github.jmchilton.blend4j.galaxy.JobsClient)

Example 4 with GalaxyInstance

use of com.github.jmchilton.blend4j.galaxy.GalaxyInstance 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);
}
Also used : Path(java.nio.file.Path) GalaxyHistoriesService(ca.corefacility.bioinformatics.irida.pipeline.upload.galaxy.GalaxyHistoriesService) SequenceFile(ca.corefacility.bioinformatics.irida.model.sequenceFile.SequenceFile) SingleEndSequenceFile(ca.corefacility.bioinformatics.irida.model.sequenceFile.SingleEndSequenceFile) ToolsClient(com.github.jmchilton.blend4j.galaxy.ToolsClient) LibrariesClient(com.github.jmchilton.blend4j.galaxy.LibrariesClient) GalaxyInstance(com.github.jmchilton.blend4j.galaxy.GalaxyInstance) SingleEndSequenceFile(ca.corefacility.bioinformatics.irida.model.sequenceFile.SingleEndSequenceFile) HistoriesClient(com.github.jmchilton.blend4j.galaxy.HistoriesClient) GalaxyLibrariesService(ca.corefacility.bioinformatics.irida.pipeline.upload.galaxy.GalaxyLibrariesService) Before(org.junit.Before)

Aggregations

GalaxyInstance (com.github.jmchilton.blend4j.galaxy.GalaxyInstance)4 HistoriesClient (com.github.jmchilton.blend4j.galaxy.HistoriesClient)2 SequenceFile (ca.corefacility.bioinformatics.irida.model.sequenceFile.SequenceFile)1 SingleEndSequenceFile (ca.corefacility.bioinformatics.irida.model.sequenceFile.SingleEndSequenceFile)1 GalaxyAccountEmail (ca.corefacility.bioinformatics.irida.model.upload.galaxy.GalaxyAccountEmail)1 GalaxyHistoriesService (ca.corefacility.bioinformatics.irida.pipeline.upload.galaxy.GalaxyHistoriesService)1 GalaxyLibrariesService (ca.corefacility.bioinformatics.irida.pipeline.upload.galaxy.GalaxyLibrariesService)1 LocalGalaxy (ca.corefacility.bioinformatics.irida.pipeline.upload.galaxy.integration.LocalGalaxy)1 GalaxyInstanceFactory (com.github.jmchilton.blend4j.galaxy.GalaxyInstanceFactory)1 JobsClient (com.github.jmchilton.blend4j.galaxy.JobsClient)1 LibrariesClient (com.github.jmchilton.blend4j.galaxy.LibrariesClient)1 ToolsClient (com.github.jmchilton.blend4j.galaxy.ToolsClient)1 History (com.github.jmchilton.blend4j.galaxy.beans.History)1 JobDetails (com.github.jmchilton.blend4j.galaxy.beans.JobDetails)1 Preconditions (com.google.common.base.Preconditions)1 Path (java.nio.file.Path)1 Before (org.junit.Before)1 Test (org.junit.Test)1 Logger (org.slf4j.Logger)1 LoggerFactory (org.slf4j.LoggerFactory)1