In [1]:
%matplotlib notebook
import sys
sys.path.insert(0,'/global/project/projectdirs/metatlas/anaconda/lib/python2.7/site-packages' )
from metatlas import metatlas_objects as metob
# from metatlas import h5_query as h5q

In [2]:
ids = metob.retrieve('compoundidentifications', username='bpb')
metob.edit_objects(ids)
# metob.store(ids)


:0: FutureWarning: IPython widgets are experimental and may change in the future.
/global/project/projectdirs/metatlas/anaconda/lib/python2.7/site-packages/pandas/core/internals.py:956: FutureWarning: comparison to `None` will result in an elementwise object comparison in the future.
  return self._try_coerce_result(func(values, other))

In [3]:
allCompounds = metob.retrieve('Compounds',InchI='InchI%')
print len(allCompounds)
# ids = metob.retrieve('compoundidentifications', username='bpb’)
metob.edit_objects(allCompounds)
# metob.store(ids)


11875

In [4]:
allCompounds[0]


Out[4]:
{'InChI': u'InChI=1S/C15H24/c1-11(2)13-8-9-14-7-5-6-12(3)15(14,4)10-13/h7,12-13H,1,5-6,8-10H2,2-4H3/t12-,13-,15-/m1/s1',
 'MonoIsotopic_molecular_weight': 204.18780517578125,
 'creation_time': '2015-10-08T17:37:27',
 'description': u'',
 'formula': u'C15H24',
 'functional_sets': '[]',
 'head_id': u'0005ec9d4a8e4f1c9bd7cdee585a1ebc',
 'last_modified': '2015-10-08T17:38:13',
 'name': u'(-)-4-epieremophilene',
 'prev_uid': u'origin',
 'reference_xrefs': '[]',
 'synonyms': u'',
 'unique_id': u'0005ec9d4a8e4f1c9bd7cdee585a1ebc',
 'url': u'',
 'username': u'bpb'}

In [5]:
metob.edit_objects(allCompounds)


---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-5-a9965f398a7e> in <module>()
----> 1 metob.edit_objects(allCompounds)

/global/project/projectdirs/metatlas/anaconda/lib/python2.7/site-packages/metatlas/metatlas_objects.pyc in edit_objects(objects)
   1092         if isinstance(trait, MetList):
   1093             [o.__setitem__(tname, str([i.unique_id for i in o[tname]]))
-> 1094              for o in objs]
   1095         if isinstance(trait, MetInstance):
   1096             [o.__setitem__(tname, getattr(o[tname], 'unique_id', 'None')) for o in objs]

AttributeError: 'str' object has no attribute 'unique_id'