Search in sources :

Example 6 with Library

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

the class GalaxyLibrariesServiceTest method testBuildEmptyLibrary.

/**
 * Tests create empty library.
 * @throws CreateLibraryException
 */
@Test
public void testBuildEmptyLibrary() throws CreateLibraryException {
    when(librariesClient.createLibrary(any(Library.class))).thenReturn(testLibrary);
    Library library = new GalaxyLibrariesService(librariesClient, 1, 2, 1).buildEmptyLibrary(new GalaxyProjectName("test"));
    assertNotNull(library);
    assertEquals("test", library.getName());
    assertEquals(LIBRARY_ID, library.getId());
}
Also used : Library(com.github.jmchilton.blend4j.galaxy.beans.Library) GalaxyProjectName(ca.corefacility.bioinformatics.irida.model.upload.galaxy.GalaxyProjectName) GalaxyLibrariesService(ca.corefacility.bioinformatics.irida.pipeline.upload.galaxy.GalaxyLibrariesService) Test(org.junit.Test)

Example 7 with Library

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

the class GalaxyLibrariesServiceTest method testBuildEmptyLibraryFail.

/**
 * Tests create empty library.
 *
 * @throws CreateLibraryException
 */
@Test(expected = CreateLibraryException.class)
public void testBuildEmptyLibraryFail() throws CreateLibraryException {
    when(librariesClient.createLibrary(any(Library.class))).thenReturn(null);
    new GalaxyLibrariesService(librariesClient, 1, 2, 1).buildEmptyLibrary(new GalaxyProjectName("test"));
}
Also used : Library(com.github.jmchilton.blend4j.galaxy.beans.Library) GalaxyProjectName(ca.corefacility.bioinformatics.irida.model.upload.galaxy.GalaxyProjectName) GalaxyLibrariesService(ca.corefacility.bioinformatics.irida.pipeline.upload.galaxy.GalaxyLibrariesService) Test(org.junit.Test)

Example 8 with Library

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

the class AnalysisCollectionServiceGalaxyIT method testUploadSequenceFilesPairedFailForward.

/**
 * Tests failing to upload a paired-end sequence file to Galaxy and
 * constructing a collection due to no found forward file.
 *
 * @throws ExecutionManagerException
 */
@Test(expected = NoSuchElementException.class)
@WithMockUser(username = "aaron", roles = "ADMIN")
public void testUploadSequenceFilesPairedFailForward() throws ExecutionManagerException {
    History history = new History();
    history.setName("testUploadSequenceFilesPairedFailForward");
    HistoriesClient historiesClient = localGalaxy.getGalaxyInstanceAdmin().getHistoriesClient();
    LibrariesClient librariesClient = localGalaxy.getGalaxyInstanceAdmin().getLibrariesClient();
    History createdHistory = historiesClient.create(history);
    Library library = new Library();
    library.setName("testUploadSequenceFilesPairedFailForward");
    Library createdLibrary = librariesClient.createLibrary(library);
    Set<SequenceFilePair> sequenceFiles = Sets.newHashSet(databaseSetupGalaxyITService.setupSampleSequenceFileInDatabase(1L, pairSequenceFiles1AInvalidName, pairSequenceFiles2A));
    Map<Sample, IridaSequenceFilePair> sampleSequenceFilePairs = new HashMap<>(sequencingObjectService.getUniqueSamplesForSequencingObjects(sequenceFiles));
    analysisCollectionServiceGalaxy.uploadSequenceFilesPaired(sampleSequenceFilePairs, createdHistory, createdLibrary);
}
Also used : IridaSequenceFilePair(ca.corefacility.bioinformatics.irida.model.irida.IridaSequenceFilePair) SequenceFilePair(ca.corefacility.bioinformatics.irida.model.sequenceFile.SequenceFilePair) IridaSequenceFilePair(ca.corefacility.bioinformatics.irida.model.irida.IridaSequenceFilePair) HashMap(java.util.HashMap) Sample(ca.corefacility.bioinformatics.irida.model.sample.Sample) Library(com.github.jmchilton.blend4j.galaxy.beans.Library) History(com.github.jmchilton.blend4j.galaxy.beans.History) LibrariesClient(com.github.jmchilton.blend4j.galaxy.LibrariesClient) HistoriesClient(com.github.jmchilton.blend4j.galaxy.HistoriesClient) WithMockUser(org.springframework.security.test.context.support.WithMockUser) Test(org.junit.Test)

Example 9 with Library

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

the class GalaxyLibrariesService method buildEmptyLibrary.

/**
 * Builds a new empty library with the given name.
 *
 * @param libraryName
 *            The name of the new library.
 * @return A Library object for the newly created library.
 * @throws CreateLibraryException
 *             If no library could be created.
 */
public Library buildEmptyLibrary(GalaxyProjectName libraryName) throws CreateLibraryException {
    checkNotNull(libraryName, "libraryName is null");
    Library persistedLibrary;
    Library library = new Library(libraryName.getName());
    persistedLibrary = librariesClient.createLibrary(library);
    if (persistedLibrary != null) {
        logger.debug("Created library=" + library.getName() + " libraryId=" + persistedLibrary.getId());
        return persistedLibrary;
    } else {
        throw new CreateLibraryException("Could not create library named " + libraryName);
    }
}
Also used : CreateLibraryException(ca.corefacility.bioinformatics.irida.exceptions.galaxy.CreateLibraryException) Library(com.github.jmchilton.blend4j.galaxy.beans.Library)

Example 10 with Library

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

the class GalaxyHistoriesServiceIT method testFilesToLibraryToHistoryRemoteSuccess.

/**
 * Tests successful upload of a file to a Galaxy history through a Library (where files are remote files).
 *
 * @throws UploadException
 * @throws GalaxyDatasetException
 */
@Test
public void testFilesToLibraryToHistoryRemoteSuccess() throws UploadException, GalaxyDatasetException {
    History history = galaxyHistory.newHistoryForWorkflow();
    Library library = buildEmptyLibrary("testFilesToLibraryToHistorySuccess");
    Map<Path, String> datasetsMap = galaxyHistory.filesToLibraryToHistory(Sets.newHashSet(dataFile, dataFile2), FILE_TYPE, history, library, DataStorage.REMOTE);
    assertNotNull(datasetsMap);
    assertEquals(2, datasetsMap.size());
    String datasetId1 = datasetsMap.get(dataFile);
    String datasetId2 = datasetsMap.get(dataFile2);
    Dataset actualDataset1 = localGalaxy.getGalaxyInstanceAdmin().getHistoriesClient().showDataset(history.getId(), datasetId1);
    assertNotNull(actualDataset1);
    Dataset actualDataset2 = localGalaxy.getGalaxyInstanceAdmin().getHistoriesClient().showDataset(history.getId(), datasetId2);
    assertNotNull(actualDataset2);
}
Also used : Path(java.nio.file.Path) Dataset(com.github.jmchilton.blend4j.galaxy.beans.Dataset) Library(com.github.jmchilton.blend4j.galaxy.beans.Library) History(com.github.jmchilton.blend4j.galaxy.beans.History) Test(org.junit.Test)

Aggregations

Library (com.github.jmchilton.blend4j.galaxy.beans.Library)20 Test (org.junit.Test)17 History (com.github.jmchilton.blend4j.galaxy.beans.History)9 Sample (ca.corefacility.bioinformatics.irida.model.sample.Sample)4 Path (java.nio.file.Path)4 SequenceFilePair (ca.corefacility.bioinformatics.irida.model.sequenceFile.SequenceFilePair)3 GalaxyProjectName (ca.corefacility.bioinformatics.irida.model.upload.galaxy.GalaxyProjectName)3 GalaxyLibrariesService (ca.corefacility.bioinformatics.irida.pipeline.upload.galaxy.GalaxyLibrariesService)3 HistoriesClient (com.github.jmchilton.blend4j.galaxy.HistoriesClient)3 LibrariesClient (com.github.jmchilton.blend4j.galaxy.LibrariesClient)3 Dataset (com.github.jmchilton.blend4j.galaxy.beans.Dataset)3 CollectionResponse (com.github.jmchilton.blend4j.galaxy.beans.collection.response.CollectionResponse)3 HashMap (java.util.HashMap)3 WithMockUser (org.springframework.security.test.context.support.WithMockUser)3 IridaSequenceFilePair (ca.corefacility.bioinformatics.irida.model.irida.IridaSequenceFilePair)2 SingleEndSequenceFile (ca.corefacility.bioinformatics.irida.model.sequenceFile.SingleEndSequenceFile)2 HistoryContents (com.github.jmchilton.blend4j.galaxy.beans.HistoryContents)2 LibraryDataset (com.github.jmchilton.blend4j.galaxy.beans.LibraryDataset)2 CollectionElementResponse (com.github.jmchilton.blend4j.galaxy.beans.collection.response.CollectionElementResponse)2 SampleAnalysisDuplicateException (ca.corefacility.bioinformatics.irida.exceptions.SampleAnalysisDuplicateException)1