I have an array with this array schema:
dom = tiledb.Domain(
tiledb.Dim(name="variantkey", domain=(0, 2 ** 64 - 2), tile=2, dtype=np.uint64),
tiledb.Dim(name="sample_idx", domain=(0, 9000), tile=2, dtype=np.uint64))
schema = tiledb.ArraySchema(domain=dom, sparse=True,
attrs=(tiledb.Attr(name="GT", dtype=np.int8),
tiledb.Attr(name="DP", dtype=np.int64),
tiledb.Attr(name="GQ", dtype=np.float64),
))
I wrote in some data and now I want to read some out again, but I only want the values from one attribute
Usually, when I want all attributes I do:
with tiledb.SparseArray(uri, mode='r') as A:
output = A.multi_index[list(variantkey), list(sample)]
My output looks something like this:
OrderedDict([('DP', array([51, 10, 10, 8])), ('GQ', array([2., 2., 1., 5.])), ('GT', array([-1, 1, 1, 1], dtype=int8)), ('sample_idx', array([1, 1, 1, 1], dtype=uint64)), ('variantkey', array([ 576460761042780160, 576460763192885248, 576460806544375808,
12682136636723036160], dtype=uint64))])
What I want now is something like this:
OrderedDict([('DP', array([51, 10, 10, 8])), ('sample_idx', array([1, 1, 1, 1], dtype=uint64)), ('variantkey', array([ 576460761042780160, 576460763192885248, 576460806544375808,
12682136636723036160], dtype=uint64))])
So basically the same but just for one attribute.
Is this possible with multi-range subarrays?
I tried to do it with the query
method, but it does not seem to work.
If I try:
q = A.query(attrs="GT")
output = q.multi_index[list(variantkey), list(sample)]
I just get the same output as before with all three attributes.