BioBlend: getting a list of datasets in a folder
I'm trying to get a list of all the datasets in a folder using BioBlend. I don't see a function for doing this in the API documentation. I can use "show_folder" to get some information regarding the contents of a folder, but not the dataset IDs themselves This is as far as I've gotten: s = gi.libraries.show_folder(LibID, folder_id = subfolderID)
print(s) {u'parent_library_id': u'd413a19dec13d11e', u'update_time':
u'2017-02-24T18:10:02.789955', u'description': u'170124_M02550_0174_000000000-AV8FJ', u'name': u'170124_M02550_0174_000000000-AV8FJ', u'deleted': False, u'item_count': 2, u'parent_id': u'Ff1b9846ab84237e7', u'genome_build': u'?', u'model_class': u'LibraryFolder', u'id': u'F84ffe6fca6c4fbda', u'library_path': [u'2017', u'170124_M02550_0174_000000000-AV8FJ']}
There are two items (item_count) as expected, how do I get the actual dataset IDs? Thanks!
Any ideas on how to do this? I'm trying to obtain a list of datasets that are in a Shared Data Library. I can obtain the Library ID and FolderIDs using BioBlend. However, I now want to get a list of dataIDs from within the Library/Folder structure. I don't see a function which accomplishes this in BioBlend. The closest thing I could find is "show_folders" (under "Libraries"). However, this seems to just provide information regarding the folder and not its contents. Is there a way to list the contents of a "Shared Data Folder"? There seems to be similar functionality for what I'm after in "History" (e.g. show_matching_datasets) but not for "Library". Any help would be greatly appreciated! On Fri, Feb 24, 2017 at 10:29 AM, D K <danielfortin86@gmail.com> wrote:
I'm trying to get a list of all the datasets in a folder using BioBlend. I don't see a function for doing this in the API documentation. I can use "show_folder" to get some information regarding the contents of a folder, but not the dataset IDs themselves
This is as far as I've gotten:
s = gi.libraries.show_folder(LibID, folder_id = subfolderID)
print(s)
{u'parent_library_id': u'd413a19dec13d11e', u'update_time':
u'2017-02-24T18:10:02.789955', u'description': u'170124_M02550_0174_000000000-AV8FJ', u'name': u'170124_M02550_0174_000000000-AV8FJ', u'deleted': False, u'item_count': 2, u'parent_id': u'Ff1b9846ab84237e7', u'genome_build': u'?', u'model_class': u'LibraryFolder', u'id': u'F84ffe6fca6c4fbda', u'library_path': [u'2017', u'170124_M02550_0174_000000000-AV8FJ']}
There are two items (item_count) as expected, how do I get the actual dataset IDs?
Thanks!
Since I'm adding files to data libraries anyway, I found I could get the dataID when I uploaded the file e.g.
s = gi.libraries.upload_from_galaxy_filesystem(LibID, os.path.join(folderLoc, fname), folder_id = subfolderID, file_type="fastq", dbkey="?", link_data_only = "link_to_files") dataID = (s[0])['id']
However, If I try to use this ID as the dataID to upload a dataset to a history:
gi.histories.upload_dataset_from_library(historyID, (s[0])['id'])
I get the error :
File
"/remote/home/galaxy-test2/.venv/lib/python2.7/site-packages/bioblend/galaxy/histories/__init__.py", line 342, in upload_dataset_from_library
return Client._post(self, payload, id=history_id, contents=True)
File
"/remote/home/galaxy-test2/.venv/lib/python2.7/site-packages/bioblend/galaxy/client.py", line 169, in _post
contents=contents)
File
"/remote/home/galaxy-test2/.venv/lib/python2.7/site-packages/bioblend/galaxyclient.py", line 64, in _make_url
c_url = '/'.join([c_url, module_id])
TypeError: sequence item 1: expected string, dict found
Any help would be greatly appreciated!!
participants (1)
-
D K