diff --git a/pybis/src/python/pybis/property.py b/pybis/src/python/pybis/property.py index 51c814f7bc9766667a7f3acb6185eb65b49149da..f9633f28bd8ef47aed353b7341a7c328ddf982b5 100644 --- a/pybis/src/python/pybis/property.py +++ b/pybis/src/python/pybis/property.py @@ -59,8 +59,9 @@ class PropertyHolder(): data_type = property_type['dataType'] if data_type == 'CONTROLLEDVOCABULARY': voc = self._openbis.get_terms(name) - if value not in voc.terms: - raise ValueError("Value must be one of these terms: " + ", ".join(voc.terms)) + value = value.upper() + if value not in voc.df['code'].values: + raise ValueError("Value must be one of these terms: " + ", ".join(voc.df['code'].values)) elif data_type in ('INTEGER', 'BOOLEAN', 'VARCHAR'): if not check_datatype(data_type, value): raise ValueError("Value must be of type {}".format(data_type)) diff --git a/pybis/src/python/pybis/pybis.py b/pybis/src/python/pybis/pybis.py index 360276b069afea2761628e04e303055f72a4a205..fb57c602b38fc4b126e135fa9433123ec4d91667 100644 --- a/pybis/src/python/pybis/pybis.py +++ b/pybis/src/python/pybis/pybis.py @@ -460,6 +460,7 @@ def _subcriteria_for_code(code, object_type): return get_search_type_for_entity(object_type.lower()) + class Openbis: """Interface for communicating with openBIS. A recent version of openBIS is required (minimum 16.05.2). @@ -581,6 +582,31 @@ class Openbis: 'update_object(sampleId, space, project, experiment, parents, children, components, properties, tagIds, attachments)', # 'update_sample(sampleId, space, project, experiment, parents, children, components, properties, tagIds, attachments)' alias ] + def _repr_html_(self): + html = """ + <table border="1" class="dataframe"> + <thead> + <tr style="text-align: right;"> + <th>attribute</th> + <th>value</th> + </tr> + </thead> + <tbody> + """ + + attrs = ['url', 'port', 'hostname', 'verify_certificates', 'as_v3', 'as_v1', 'reg_v1', 'token'] + for attr in attrs: + html += "<tr> <td>{}</td> <td>{}</td> </tr>".format( + attr, getattr(self, attr, '') + ) + + html += """ + </tbody> + </table> + """ + return html + + @property def spaces(self): return self.get_spaces()