gefpy.bgef_reader_cy
Provides an interface to read bgef format files.
- class bgef_reader_cy.BgefR(filepath, bin_size, n_thread)
- get_expression_num(self)
Get the number of expression.
- get_cell_num(self)
Get the number of cell.
- get_gene_num(self)
Get the number of gene.
- get_gene_names(self)
Get a list of gene names.
- get_cell_names(self)
Get a list of cell ids, each item is (exp.x<<32 | exp.y)
- get_gene_data(self)
Get gene data.
gene_index is a list that records the gene serial number corresponding to each exp.
gene_names is a list of gene names.
- Returns
(gene_index, gene_names)
- get_expression(self)
Get the all expression from bgef.
explist is a list, each item is (x, y, count, exon).
- Returns
explist
- get_exp_data(self)
Get sparse matrix indexes of expression data.
uniq_cell is list that save all cell, each cell val (exp.x<<32 | exp.y).
cell_index is a list that save the cell idx of each expression.
count is a list that save the midcnt of each expression.
- Returns
(uniq_cell, cell_index, count)
- get_genedata_in_region(self, min_x, max_x, min_y, max_y, key)
Get the explist by the specified gene name in the region.
- Parameters
min_x – region minx
max_x – region maxx
min_y – region miny
max_y – region maxy
key – gene name
- Returns
explist
- get_offset(self)
Get the offset in bgef.
- Returns
(minx, miny)
- get_exp_attr(self)
Get the bgef attr.
- Returns
(minx, miny, maxx, maxy, maxexp, resolution)
- get_filtered_data(self, region, genelist)
Get the filtered data from bgef by region or gene.
- Parameters
region – rect region(minx,maxx,miny,maxy)
genelist – gene name list
uniq_cell is list that save all cell, each cell val (exp.x<<32 | exp.y).
gene_names is a list of gene names.
count is a list that save the midcnt of each expression.
cell_index is a list that save the cell idx of each expression.
gene_index is a list that records the gene serial number corresponding to each exp.
- Returns
(uniq_cell, gene_names, count, cell_index, gene_index)