Esempio n. 1
0
    def take(self, indices, axis=0, out=None, mode='raise', **kwargs):
        return take_genotypes(self, indices, axis=axis, wrap_axes={0, 1}, cls=type(self),
                              take=_chunked.take, out=out, mode=mode, **kwargs)

    def subset(self, sel0=None, sel1=None, **kwargs):
        return subset_genotype_array(self, sel0, sel1, cls=type(self),
                                     subset=_chunked.subset, **kwargs)

    def concatenate(self, others, axis=0, **kwargs):
        return concatenate_genotypes(self, others, axis=axis, wrap_axes={0, 1},
                                     cls=type(self), concatenate=_chunked.concatenate,
                                     **kwargs)


# copy docstrings
copy_method_doc(GenotypeChunkedArray.fill_masked, GenotypeArray.fill_masked)
copy_method_doc(GenotypeChunkedArray.subset, GenotypeArray.subset)
copy_method_doc(GenotypeChunkedArray.is_called, GenotypeArray.is_called)
copy_method_doc(GenotypeChunkedArray.is_missing, GenotypeArray.is_missing)
copy_method_doc(GenotypeChunkedArray.is_hom, GenotypeArray.is_hom)
copy_method_doc(GenotypeChunkedArray.is_hom_ref, GenotypeArray.is_hom_ref)
copy_method_doc(GenotypeChunkedArray.is_hom_alt, GenotypeArray.is_hom_alt)
copy_method_doc(GenotypeChunkedArray.is_het, GenotypeArray.is_het)
copy_method_doc(GenotypeChunkedArray.is_call, GenotypeArray.is_call)
copy_method_doc(GenotypeChunkedArray.to_haplotypes, GenotypeArray.to_haplotypes)
copy_method_doc(GenotypeChunkedArray.to_n_ref, GenotypeArray.to_n_ref)
copy_method_doc(GenotypeChunkedArray.to_n_alt, GenotypeArray.to_n_alt)
copy_method_doc(GenotypeChunkedArray.to_allele_counts, GenotypeArray.to_allele_counts)
copy_method_doc(GenotypeChunkedArray.to_packed, GenotypeArray.to_packed)
# TODO
# copy_method_doc(GenotypeChunkedArray.from_packed, GenotypeArray.from_packed)
Esempio n. 2
0
        out = self.apply_method('to_gt',
                                kwargs=dict(phased=phased,
                                            max_allele=max_allele),
                                **storage_kwargs)
        return _chunked.ChunkedArray(out)

    def map_alleles(self, mapping, **storage_kwargs):
        def f(block, bmapping):
            return block.map_alleles(bmapping, copy=False)
        domain = (self, mapping)
        out = _chunked.apply(domain, f, **storage_kwargs)
        return GenotypeChunkedArray(out)


# copy docstrings
copy_method_doc(GenotypeChunkedArray.fill_masked,
                _ndarray.GenotypeArray.fill_masked)
copy_method_doc(GenotypeChunkedArray.subset,
                _ndarray.GenotypeArray.subset)
copy_method_doc(GenotypeChunkedArray.is_called,
                _ndarray.GenotypeArray.is_called)
copy_method_doc(GenotypeChunkedArray.is_missing,
                _ndarray.GenotypeArray.is_missing)
copy_method_doc(GenotypeChunkedArray.is_hom,
                _ndarray.GenotypeArray.is_hom)
copy_method_doc(GenotypeChunkedArray.is_hom_ref,
                _ndarray.GenotypeArray.is_hom_ref)
copy_method_doc(GenotypeChunkedArray.is_hom_alt,
                _ndarray.GenotypeArray.is_hom_alt)
copy_method_doc(GenotypeChunkedArray.is_het,
                _ndarray.GenotypeArray.is_het)
copy_method_doc(GenotypeChunkedArray.is_call,
Esempio n. 3
0
                                kwargs=dict(phased=phased,
                                            max_allele=max_allele),
                                **storage_kwargs)
        return _chunked.ChunkedArray(out)

    def map_alleles(self, mapping, **storage_kwargs):
        def f(block, bmapping):
            return block.map_alleles(bmapping, copy=False)

        domain = (self, mapping)
        out = _chunked.apply(domain, f, **storage_kwargs)
        return GenotypeChunkedArray(out)


# copy docstrings
copy_method_doc(GenotypeChunkedArray.fill_masked,
                _ndarray.GenotypeArray.fill_masked)
copy_method_doc(GenotypeChunkedArray.subset, _ndarray.GenotypeArray.subset)
copy_method_doc(GenotypeChunkedArray.is_called,
                _ndarray.GenotypeArray.is_called)
copy_method_doc(GenotypeChunkedArray.is_missing,
                _ndarray.GenotypeArray.is_missing)
copy_method_doc(GenotypeChunkedArray.is_hom, _ndarray.GenotypeArray.is_hom)
copy_method_doc(GenotypeChunkedArray.is_hom_ref,
                _ndarray.GenotypeArray.is_hom_ref)
copy_method_doc(GenotypeChunkedArray.is_hom_alt,
                _ndarray.GenotypeArray.is_hom_alt)
copy_method_doc(GenotypeChunkedArray.is_het, _ndarray.GenotypeArray.is_het)
copy_method_doc(GenotypeChunkedArray.is_call, _ndarray.GenotypeArray.is_call)
copy_method_doc(GenotypeChunkedArray.to_haplotypes,
                _ndarray.GenotypeArray.to_haplotypes)
copy_method_doc(GenotypeChunkedArray.to_n_ref, _ndarray.GenotypeArray.to_n_ref)
Esempio n. 4
0
        return self._method_drop_axis2('to_gt', phased=phased,
                                       max_allele=max_allele)

    def to_haplotypes(self):
        out = self.reshape(self.shape[0], -1)
        return view_subclass(out, HaplotypeDaskArray)

    def to_n_ref(self, fill=0, dtype='i1'):
        return self._method_drop_axis2('to_n_ref', fill=fill, dtype=dtype)

    def to_n_alt(self, fill=0, dtype='i1'):
        return self._method_drop_axis2('to_n_alt', fill=fill, dtype=dtype)


# copy docstrings
copy_method_doc(GenotypeDaskArray.fill_masked,
                _ndarray.GenotypeArray.fill_masked)
copy_method_doc(GenotypeDaskArray.subset,
                _ndarray.GenotypeArray.subset)
copy_method_doc(GenotypeDaskArray.is_called,
                _ndarray.GenotypeArray.is_called)
copy_method_doc(GenotypeDaskArray.is_missing,
                _ndarray.GenotypeArray.is_missing)
copy_method_doc(GenotypeDaskArray.is_hom,
                _ndarray.GenotypeArray.is_hom)
copy_method_doc(GenotypeDaskArray.is_hom_ref,
                _ndarray.GenotypeArray.is_hom_ref)
copy_method_doc(GenotypeDaskArray.is_hom_alt,
                _ndarray.GenotypeArray.is_hom_alt)
copy_method_doc(GenotypeDaskArray.is_het,
                _ndarray.GenotypeArray.is_het)
copy_method_doc(GenotypeDaskArray.is_call,