當前位置: 首頁>>代碼示例>>Python>>正文


Python GirderClient.addMetadataToItem方法代碼示例

本文整理匯總了Python中girder_client.GirderClient.addMetadataToItem方法的典型用法代碼示例。如果您正苦於以下問題:Python GirderClient.addMetadataToItem方法的具體用法?Python GirderClient.addMetadataToItem怎麽用?Python GirderClient.addMetadataToItem使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在girder_client.GirderClient的用法示例。


在下文中一共展示了GirderClient.addMetadataToItem方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: len

# 需要導入模塊: from girder_client import GirderClient [as 別名]
# 或者: from girder_client.GirderClient import addMetadataToItem [as 別名]
searchPGS = c.get('resource/search', {
    'q': 'Phylogenetic signal',
    'types': '["item"]'
})
if len(searchPGS['item']) == 0:
  uploadPGS = True

# Read our analyses into Python dictionaries and upload them to girder.
if uploadACR:
  ACR = {}
  with open ("%s/ancestral-state/aceArbor.json" % args.path, "r") as acrFile:
      acrStr = acrFile.read()
  ACR['analysis'] = json.loads(acrStr)
  item = c.createItem(folderId, 'aceArbor', 'Ancestral state reconstruction')
  c.addMetadataToItem(item['_id'], ACR)
  print "aceArbor successfully uploaded"
else:
  print "aceArbor already exists"

if uploadPGS:
  PGS = {}
  with open ("%s/phylogenetic-signal/Phylogenetic_signal.json" % args.path, "r") as pgsFile:
      pgsStr = pgsFile.read()
  PGS['analysis'] = json.loads(pgsStr)
  item = c.createItem(folderId, 'Phylogenetic signal', 'Phylogenetic signal')
  c.addMetadataToItem(item['_id'], PGS)
  print "Phylogenetic signal successfully uploaded"
else:
  print "Phylogenetic signal already exists"
開發者ID:Kitware,項目名稱:flow,代碼行數:31,代碼來源:easymode-setup.py

示例2: open

# 需要導入模塊: from girder_client import GirderClient [as 別名]
# 或者: from girder_client.GirderClient import addMetadataToItem [as 別名]
            'name': 'Data',
            'description': 'Data Folder',
            'public': 'true'
        })
        c.post('folder', parameters={
            'parentType': 'collection',
            'parentId': collection['_id'],
            'name': 'Analyses',
            'description': 'Analysis folder',
            'public': 'true'
        })
    else:
        collection = collection_search['collection'][0]

    # Get the 'Analyses' folder for this collection.
    analysis_folder = c.load_or_create_folder('Analyses', collection['_id'], 'collection')
    folder_id = analysis_folder['_id']

    # Read this analysis into a Python dictionary and upload it to Girder.
    analysis = {}
    with open (fullpath, "r") as analysis_file:
        analysis_str = analysis_file.read()
    try:
      analysis['analysis'] = json.loads(analysis_str)
    except ValueError:
      print "Could not read valid JSON from %s" % analysis_filename
      continue
    item = c.createItem(folder_id, analysis_name, analysis_name)
    c.addMetadataToItem(item['_id'], analysis)
    print "%s successfully uploaded to %s" % (analysis_filename, collection_name)
開發者ID:Kitware,項目名稱:flow,代碼行數:32,代碼來源:load-analyses.py


注:本文中的girder_client.GirderClient.addMetadataToItem方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。