Hi!
What do we want :
Using the API (bioblend 0.4.3, Galaxy-dist ( 22 jan 2014 ) ): upload files from user’s FTP directory to Galaxy and launch workflow
How we do it :
1. Determine the user's libraryID and historyID
2. Upload files : gi.libraries.upload_file_from_server (libraryID, server_dir) and get the datasetID in user’s library (libraryID).
3. Check the status of the upoaded file : gi.datasets.show_dataset (datasetID).
4. If state of dataset is 'ok' (gi.datasets.show_dataset (datasetID) ['state']), we import it to the history (historyID): gi.histories.upload_dataset_from_library (historyID, datasetID, 'library')
5. Now we can run workflow
Problem:
For the new user the command gi.datasets.show_dataset (datasetID) works properly and displays information about the required dataset, but after a while (after some upload iterations) the command gi.datasets.show_dataset(datasetID) displays information about wrong dataset ( with identical datasetID, but not the current member of user’s library (libraryID).
But in bioblend docs:
" show_dataset(dataset_id, deleted=False)
Display information about and/or content of a dataset. This can be a history or a library dataset."
Example:
libraryID = gi.libraries.get_libraries()[ 0 ][ 'id' ]
u'417e33144b294c21'
lib = gi.libraries.show_library(libraryID, True)
[ {
u'url': u'/api/libraries/417e33144b294c21/contents/c8990a1b374598b0', u'type': u'file',
u'id': u'c8990a1b374598b0',
u'name': u'/opo_opo.csfasta'
}
]
datasetID = c8990a1b374598b0
http://<server>/api/datasets/c8990a1b374598b0?key=<api_key>
gi.datasets.show_dataset('c8990a1b374598b0')
{
u'accessible': True, u'visible': True,
u'copied_from_ldda_id': u'911dde3ddb677bcd',
u'file_size': 0, u'file_ext': u'data',
u'id': u'c8990a1b374598b0',
u'misc_info': u'failure running job', u'hda_ldda': u'hda',
u'download_url': u'/api/histories/5969b1f7201f12ae/contents/c8990a1b374598b0/display',
u'state': u'error', u'display_types': [], u'display_apps': [], u'misc_blurb': u'tool error',
u'peek': u'<table cellspacing="0" cellpadding="3"></table>', u'data_type': u'data', u'tags': [],
u'deleted': True, u'history_id': u'5969b1f7201f12ae', u'genome_build': u'?', u'hid': 220,
u'visualizations': [], u'metadata_dbkey': u'?',
u'name': u'dataset_1.dat', <-?????
u'uuid': None,
u'model_class': u'HistoryDatasetAssociation', u'purged': False, u'api_type': u'file'
}
BUT
---
http://<server>/api/libraries/417e33144b294c21/contents/c8990a1b374598b0?key=<api_key>
gi.libraries.show_dataset(librarypID, 'c8990a1b374598b0')
{
"data_type": "csfasta",
"date_uploaded": "2014-04-08T12:07:14.357356",
"file_name": "/home/pandorin/galaxy-dist/database/files/000/dataset_228.dat",
"file_size": 82283303,
"folder_id": "417e33144b294c21",
"genome_build": "?",
"id": "c8990a1b374598b0",
"ldda_id": "c8990a1b374598b0",
"message": "",
"metadata_data_lines": null,
"metadata_dbkey": "?",
"metadata_sequences": null,
"misc_blurb": "78.5 MB",
"misc_info": "\nuploaded csfasta file",
"model_class": "LibraryDataset",
"name": "opo_opo.csfasta",
"template_data": {},
"uuid": null
}
In libraries.show_dataset() no 'state' attribute.