code: def from_sparse(m, ploidy, order=None, out=None):
          
  
          h = HaplotypeArray.from_sparse(m, order=order, out=out)
          g = h.to_genotypes(ploidy=ploidy)
          return g
docs: Construct a genotype array from a sparse matrix.
  
          Parameters
          ----------
          m : scipy.sparse.spmatrix
              Sparse matrix
          ploidy : int
              The sample ploidy.
          order : {'C', 'F'}, optional
              Whether to store data in C (row-major) or Fortran (column-major)
              order in memory.
          out : ndarray, shape (n_variants, n_samples), optional
              Use this array as the output buffer.
  
          Returns
          -------
          g : GenotypeArray, shape (n_variants, n_samples, ploidy)
              Genotype array.
  
          Examples
          --------
  
          >>> import allel
          >>> import numpy as np
          >>> import scipy.sparse
          >>> data = np.array([ 1,  1,  1,  1, -1, -1], dtype=np.int8)
          >>> indices = np.array([1, 3, 0, 1, 2, 3], dtype=np.int32)
          >>> indptr = np.array([0, 0, 2, 4, 6], dtype=np.int32)
          >>> m = scipy.sparse.csr_matrix((data, indices, indptr))
          >>> g = allel.GenotypeArray.from_sparse(m, ploidy=2)
          >>> g
          <GenotypeArray shape=(4, 2, 2) dtype=int8>
          0/0 0/0
          0/1 0/1
          1/1 0/0
          0/0 ./.