Dear openBIS enthusiasts,
for some processing we need to check if objects of type ‘SAMPLE’ have a child of a certain type. The child object in question is many hierarchical levels further down. Currently we access the children using pybis as follows:
# Get objects of type 'SAMPLE' and store them in a DataFrame.
samples = o.get_samples(type='SAMPLE').df
# Iterate over the rows of the 'samples' DataFrame.
for row in samples.iterrows():
# Get an object using the identifier from the current row.
obj = o.get_object(row[1].identifier)
# Iterate through the children of the current object.
for child in obj.children:
# Get the child object.
obj1 = o.get_object(child)
for child2 in obj1.children:
obj2 = o.get_object(child2)
... repeat and eventually check some condition
Currently, this is not very performant, especially since we have many objects of the type ‘SAMPLE’.
Is there any more performant way you can think of, how we can improve this query?
Thanks in advance and cheers
Friedemann