getzlab / dalmatian

dalmatian is a collection of high-level companion functions for Firecloud and FISS.
18 stars 13 forks source link

TypeError: string indices must be integers #25

Closed jkobject closed 5 years ago

jkobject commented 5 years ago

Hello,

wanting to run a pipeline by passing it a sample_set, which it is meant to receive. I get this error. 'All_samples' does not exist in pair_sets and the workflow is parametrized for sample_sets.

I don't really get why it is getting pairs...

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-170-ec321d99cc07> in <module>
----> 1 CreatePanelOfNormalsGATK_PANCAN = wto.create_submission('CreatePanelOfNormalsGATK_PANCAN', 'All_normals')
      2 DepthOfCovQC_PANCAN = wto.create_submission('DepthOfCovQC_PANCAN', samplesetname + "_all", 'sample_set', expression='this.samples')
      3 print("waiting for 'DepthOfCovQC_PANCAN' & 'CNV_CreatePoNForCNV'")
      4 terra.waitForSubmission(wto, [DepthOfCovQC_PANCAN, CreatePanelOfNormalsGATK_PANCAN])

/anaconda3/envs/py36/lib/python3.6/site-packages/dalmatian/wmanager.py in create_submission(self, config, entity, etype, expression, use_callcache)
   1433             except ConfigNotFound:
   1434                 self.update_config(config)
-> 1435         preflight = self.preflight(config, entity, expression, etype)
   1436         if not preflight.result:
   1437             raise ValueError(preflight.reason)

/anaconda3/envs/py36/lib/python3.6/site-packages/dalmatian/wmanager.py in preflight(self, config_name, entity, expression, etype)
   1378             etype,
   1379             entity,
-> 1380             (expression if expression is not None else 'this')+'.%s_id' % config['rootEntityType']
   1381         )
   1382         if isinstance(workflow_entities, dict) and 'statusCode' in workflow_entities and workflow_entities['statusCode'] >= 400:

/anaconda3/envs/py36/lib/python3.6/site-packages/dalmatian/wmanager.py in call_with_lock(self, *args, **kwargs)
    149     def call_with_lock(self, *args, **kwargs):
    150         with self.lock:
--> 151             return func(self, *args, **kwargs)
    152     return call_with_lock
    153 

/anaconda3/envs/py36/lib/python3.6/site-packages/dalmatian/wmanager.py in evaluate_expression(self, etype, entity, expression)
   1308             evaluator.add_entities(
   1309                 _etype,
-> 1310                 self._get_entities_internal(_etype)
   1311             )
   1312         if 'workspace' in expression:

/anaconda3/envs/py36/lib/python3.6/site-packages/dalmatian/wmanager.py in _get_entities_internal(self, etype)
    517 
    518     def _get_entities_internal(self, etype):
--> 519         return getattr(self, 'get_{}s'.format(etype))()
    520 
    521     @_synchronized

/anaconda3/envs/py36/lib/python3.6/site-packages/dalmatian/base.py in get_pair_sets(self)
   1026         """Get DataFrame with sample sets and their attributes"""
   1027         df = self.get_entities('pair_set')
-> 1028         df['pairs'] = df['pairs'].apply(lambda x: [i['entityName'] for i in x] if type(x) is list and np.all(pd.notnull(x)) else x)
   1029 
   1030         # # convert JSON to table

/anaconda3/envs/py36/lib/python3.6/site-packages/pandas/core/series.py in apply(self, func, convert_dtype, args, **kwds)
   3589             else:
   3590                 values = self.astype(object).values
-> 3591                 mapped = lib.map_infer(values, f, convert=convert_dtype)
   3592 
   3593         if len(mapped) and isinstance(mapped[0], Series):

pandas/_libs/lib.pyx in pandas._libs.lib.map_infer()

/anaconda3/envs/py36/lib/python3.6/site-packages/dalmatian/base.py in <lambda>(x)
   1026         """Get DataFrame with sample sets and their attributes"""
   1027         df = self.get_entities('pair_set')
-> 1028         df['pairs'] = df['pairs'].apply(lambda x: [i['entityName'] for i in x] if type(x) is list and np.all(pd.notnull(x)) else x)
   1029 
   1030         # # convert JSON to table

/anaconda3/envs/py36/lib/python3.6/site-packages/dalmatian/base.py in <listcomp>(.0)
   1026         """Get DataFrame with sample sets and their attributes"""
   1027         df = self.get_entities('pair_set')
-> 1028         df['pairs'] = df['pairs'].apply(lambda x: [i['entityName'] for i in x] if type(x) is list and np.all(pd.notnull(x)) else x)
   1029 
   1030         # # convert JSON to table

TypeError: string indices must be integers

Best,

agraubert commented 5 years ago

Try updating to version 0.0.17, which simplified a lot of the backend code in dalmatian. This may solve your problem, but please note that it does make some breaking changes by universally enforcing the combined namespace/name syntax (looks like you're already using that syntax anyways)


If that doesn't work, let me know and I'll look more into this issue