コード例 #1
0
def get_library_contents(gi, path):
    """
    Return the contents of a data library

    Returns a list of LibraryFolder and LibraryDataset
    instances representing the contents of the specified
    Galaxy data library.

    FIXME: should filter on full path (currently
    lists everything)

    Arguments:
      gi (GalaxyInstance): bioblend GalaxyInstance
      path (str): path of the data library to fetch
        the contents of

    Returns:
      list: list of folders and datasets.

    """
    logging.debug("Path '%s'" % path)
    lib_client = galaxy.libraries.LibraryClient(gi)
    library_name, folder_path = split_library_path(path)
    logging.debug("library_name '%s'" % library_name)
    library_id = library_id_from_name(gi, library_name)
    if library_id is None:
        print "No library '%s'" % library_name
        return
    # Get library contents
    contents = []
    for item in lib_client.show_library(library_id, contents=True):
        if item['type'] == 'folder':
            contents.append(LibraryFolder(item))
        else:
            contents.append(LibraryDataset(item))
    return contents
コード例 #2
0
def get_library_contents(gi,path):
    """
    Return the contents of a data library

    Returns a list of LibraryFolder and LibraryDataset
    instances representing the contents of the specified
    Galaxy data library.

    FIXME: should filter on full path (currently
    lists everything)

    Arguments:
      gi (GalaxyInstance): bioblend GalaxyInstance
      path (str): path of the data library to fetch
        the contents of

    Returns:
      list: list of folders and datasets.

    """
    logging.debug("Path '%s'" % path)
    lib_client = galaxy.libraries.LibraryClient(gi)
    library_name,folder_path = split_library_path(path)
    logging.debug("library_name '%s'" % library_name)
    library_id = library_id_from_name(gi,library_name)
    if library_id is None:
        print "No library '%s'" % library_name
        return
    # Get library contents
    contents = []
    for item in lib_client.show_library(library_id,contents=True):
        if item['type'] == 'folder':
            contents.append(LibraryFolder(item))
        else:
            contents.append(LibraryDataset(item))
    return contents
コード例 #3
0
ファイル: test_libraries.py プロジェクト: pjbriggs/nebulizer
 def test_library_and_multiple_folders_trailing_slash(self):
     self.assertEqual(
         split_library_path('Test Library 2/Run 11/Fastqs/'),
         ('Test Library 2','/Run 11/Fastqs'))
コード例 #4
0
ファイル: test_libraries.py プロジェクト: pjbriggs/nebulizer
 def test_library_and_folder_trailing_slash(self):
     self.assertEqual(split_library_path('Test Library 2/Run 11/'),
                      ('Test Library 2','/Run 11'))
コード例 #5
0
ファイル: test_libraries.py プロジェクト: pjbriggs/nebulizer
 def test_library_and_folder(self):
     self.assertEqual(split_library_path('Test Library 2/Run 11'),
                      ('Test Library 2','/Run 11'))
コード例 #6
0
ファイル: test_libraries.py プロジェクト: pjbriggs/nebulizer
 def test_library_name_with_spaces(self):
     self.assertEqual(split_library_path('Test Library 2'),
                      ('Test Library 2','/'))
コード例 #7
0
ファイル: test_libraries.py プロジェクト: pjbriggs/nebulizer
 def test_library_name_trailing_slash(self):
     self.assertEqual(split_library_path('TestLibrary/'),
                      ('TestLibrary','/'))
コード例 #8
0
ファイル: test_libraries.py プロジェクト: pjbriggs/nebulizer
 def test_library_name_only(self):
     self.assertEqual(split_library_path('TestLibrary'),
                      ('TestLibrary','/'))
コード例 #9
0
 def test_library_and_multiple_folders_trailing_slash(self):
     self.assertEqual(split_library_path('Test Library 2/Run 11/Fastqs/'),
                      ('Test Library 2', '/Run 11/Fastqs'))
コード例 #10
0
 def test_library_and_folder_trailing_slash(self):
     self.assertEqual(split_library_path('Test Library 2/Run 11/'),
                      ('Test Library 2', '/Run 11'))
コード例 #11
0
 def test_library_and_folder(self):
     self.assertEqual(split_library_path('Test Library 2/Run 11'),
                      ('Test Library 2', '/Run 11'))
コード例 #12
0
 def test_library_name_with_spaces(self):
     self.assertEqual(split_library_path('Test Library 2'),
                      ('Test Library 2', '/'))
コード例 #13
0
 def test_library_name_trailing_slash(self):
     self.assertEqual(split_library_path('TestLibrary/'),
                      ('TestLibrary', '/'))
コード例 #14
0
 def test_library_name_only(self):
     self.assertEqual(split_library_path('TestLibrary'),
                      ('TestLibrary', '/'))