Closed neobernad closed 4 years ago
I could solve it!
The VariantChunkedTable
can be transformed into a numpy array by slicing:
vt_np_array = variants[:] # THIS! vt_np_array is a VariantTable object
filter_expression = '(CHROM == \'chr01\')'
variant_selection = vt_np_array.eval(filter_expression)[:]
variants_pass = vt_np_array.compress(variant_selection)
Hi,
I have a
VariantChunkedTable
object named asvariants
that looks like follows:I would like to extract a list of indexes of the variants that belongs to a certain chromosome (e.g. chr01), so that later on I could use those indexes to subset the positions from a
GenotypeChunkedArray
object.So far I could get up to this point:
The previous instructions output 200102, that is to say, there are variants belonging to chr01, however, the following instruction crashes:
This error seems to be related to #169 and unfortunately it is up to
zarr
to take care of this.That said, is there any other way to subset genotypes depending on what chromsome they are?
Thanks, José Antonio