Skip to main content

A thin, pythonic wrapper around geftool.

Project description

gefpy使用文档(gefpy is a thin, pythonic wrapper around geftools, which runs on Python 3 (3.7+).)

bgef_creater_cy模块

  • 对geftools中creat bgef的python接口
  • 相关接口
    .. py:module:: bgef_creater_cy
    
      .. py:class:: BgefCreater(thcnt=8)
    
      .. py:method:: create_bgef(self, strin, bin, strmask, strout)
    
          Create tisscuecut bgef by bgef/gem and mask.
    
          :param strin: raw bgef or bgem
          :param bin: mask binsize
          :param strmask: mask path
          :param strout: out path
    
      .. py:method:: get_stereo_data(self, strin, bin, strmask)
    
          Get tisscuecut stereo data by bgef/gem and mask. 
    
          :param strin: raw bgef or bgem
          :param bin: mask binsize
          :param strmask: mask path
    
          + 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.
    
    
          :return: (uniq_cell, gene_names, count, cell_index, gene_index)
    

bgef_reader_cy模块

  • 提供了对gef文件的读取接口
  • 相关接口
      .. py:module:: bgef_reader_cy
    
      .. py:class:: BgefR(filepath, bin_size, n_thread)
    
      .. py:method:: get_expression_num(self)
    
      Get the number of expression.
    
      .. py:method:: get_cell_num(self)
    
      Get the number of cell.
    
      .. py:method:: get_gene_num(self)
    
      Get the number of gene.
    
      .. py:method:: get_gene_names(self)
    
      Get a list of gene names.
    
      .. py:method:: get_cell_names(self)
    
      Get a list of cell ids, each item is (exp.x<<32 | exp.y)
    
      .. py:method:: 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.
    
      :return: (gene_index, gene_names)
    
      .. py:method:: get_expression(self)
    
      Get the all expression from bgef. 
    
      + explist is a list, each item is (x, y, count, exon).
    
      :return: explist
    
      .. py:method:: 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.
    
      :return: (uniq_cell, cell_index, count)
    
      .. py:method:: 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.
    
      :param min_x: region minx
      :param max_x: region maxx
      :param min_y: region miny
      :param max_y: region maxy
      :param key: gene name
      :return: explist
    
      .. py:method:: get_offset(self)
    
      Get the offset in bgef.
    
      :return: (minx, miny)
    
      .. py:method:: get_exp_attr(self)
    
      Get the bgef attr.
    
      :return: (minx, miny, maxx, maxy, maxexp, resolution)
    
      .. py:method:: get_filtered_data(self, region, genelist)
    
      Get the filtered data from bgef by region or gene.
    
      :param region: rect region(minx,maxx,miny,maxy)
      :param 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.
    
      :return: (uniq_cell, gene_names, count, cell_index, gene_index)
    

bgef_writer_cy模块

  • bgef文件的写入功能的python接口
  • 相关接口
      .. py:module:: bgef_writer_cy
    
      .. py:function:: generate_bgef(input_file, bgef_file, stromics="Transcriptomics", n_thread = 8, bin_sizes = None, region = None)
    
      Function to generate common bin GEF file(.bgef).
    
      :param input_file:  The input file path of gem file or bin1 bgef.
      :param bgef_file:   Output BGEF filepath.
      :param stromics:    input the omics.
      :param n_thread:    Number of thread, default 8
      :param bin_sizes:   A list of bin sizes, default: 1,10,20,50,100,200,500
      :param region:      A list of region (minX, maxX, minY, maxY)
    
      .. py:function:: gem2tif(gempath, tif_path)
    
      Function to generate tif file by GEM file(.gem & .gem.gz).
    
      :param gempath:  The input file path of gem file.
      :param tif_path:   Output tiff filepath.
    

cgef_adjust_cy模块

  • 该模块提供了一些函数,包含lasso、mid count filter、渲染热图采样等功能,主要是stereo map使用
  • 相关接口
      .. py:module:: cgef_adjust_cy
    
      .. py:class:: CgefAdjust()
    
      .. py:method:: get_cell_data(self, bgef, cgef)
    
          Get raw cell data from cgef and bgef file.
    
          :param bgef: the bgef file path
          :param cgef: the cgef file path
          :returns: (genelist, vec_cell)
    
      .. py:method:: write_cgef_adjustdata(self, path, celldata, dnbdata)
    
          write the adjust cell data to cgef
    
          :param path: set the Output path
          :param celldata: input the cell data
          :param dandata: input the dandata
          
      .. py:method:: create_Region_Bgef(self, inpath, outpath, pos)
    
          generate spatial bin gef file by lasso region datas
    
          :param inpath: the bgef file path
          :param outpath: set the Output path
          :param pos: lasso region datas
    
      .. py:method:: create_Region_Cgef(self, inpath, outpath, pos)
    
          generate cell bin gef file by lasso region datas
    
          :param inpath: the cgef file path
          :param outpath: set the Output path
          :param pos: lasso region datas
    
      .. py:method:: get_regiondata_frombgef(self, inpath, bin, thcnt, pos)
    
          Get gene info from spatial bin gef file by lasso region datas
    
          :param inpath: the bgef file path
          :param bin: set bin size
          :param thcnt: thread counts
          :param pos: lasso region datas
          :returns vecdata: gene info{genecnt,midcnt,x,y} in region
    
      .. py:method:: get_regiondata_fromcgef(self, input_path, pos)
    
          Get cell statistical info from cell bin gef file by lasso region datas
    
          :param input_path: the cgef file path
          :param pos: lasso region datas
          :returns vecdata: statistical info{cell_count,total_area,average_gene_count,average_exp_count,average_dnb_count,average_area,median_gene_count,median_exp_count,median_dnb_count,median_area} in region
    
      .. py:method:: get_multilabel_regiondata_bgef(self, inpath, pos, bin=1, thcnt=4)
    
          The gene name and MIDcount of multiple labels are returned after the lasso
    
          :param inpath: the input bgef file path
          :param pos: lasso region datas(contain multi labels)
          :param bin: binsize
          :param thcnt: thread count
          :returns region_data, total_mid: region_data(gene_name, MIDcount), total midcount in region
    
      .. py:method:: get_multilabel_regiondata_cgef(self, inpath, pos)
    
          The gene name and MIDcount of multiple labels are returned after the lasso
    
          :param inpath: the input cgef file path
          :param pos: lasso region datas(contain multi labels)
          :returns vecdata, total_data: vecdata(cluster_id, mid_cnt, area, cell_id, x, y), total_data(cluster_id, mid_cnt, area, cell_id)
    
      .. py:method:: get_position_by_clusterid(self, inpath, clusterid)
    
          Get position value(x, y) by cluster id from h5ad file
    
          :param inpath: the input h5ad file
          :param clusterid: input cluster id need to get position
          :returns region_data: position value(x, y)
    
      .. py:method:: generate_filter_bgef_by_midcnt(self, inpath, outpath, binsize, filter_data, only_filter=False)
    
          generate complete bgef file by gene&protein mid count value
    
          :param inpath: input bgef file
          :param outpath: output bgef file
          :param binsize: current binsize
          :param only_filter: generate bgef only have filter gene&protein
          :param filter_data: filter gene&protein name and mid count
          :returns ret: generate result
    
      .. py:method:: get_filter_bgef_process_rate(self)
    
          Get generate process rate, Must be used in conjunction with the generate_filter_bgef_by_midcnt
    
          :returns ret: current process rate
          
      .. py:method:: generate_bgef_by_lasso(self, inpath, outpath, pos)
    
          generate complete bgef file by lasso region datas
    
          :param inpath: the input bgef file path
          :param outpath: the generate bgef file path
          :param pos: lasso region datas
          :returns ret: generate result
    
      .. py:method:: get_lasso_bgef_process_rate(self)
    
          Get generate process rate, Must be used in conjunction with the generate_bgef_by_lasso
    
          :returns ret: current process rate
    
      .. py:method:: generate_bgef_by_coordinate(self, inpath, outpath, cord, bin_size)
    
          generate bgef file by input coordinate in lasso region
    
          :param inpath: the bgef file path
          :param inpath: the bgef file path
          :param cord: lasso region datas
          :param bin_size: input binsize
          :returns ret: generate result
    
      .. py:method:: generate_cgef_by_coordinate(self, inpath, outpath, cord)
    
          generate cell bin gef file by coordinate in lasso region
    
          :param inpath: the input cgef file path
          :param outpath: the output cgef file path
          :param cord: lasso region datas
          :returns ret: generate result
    

cgef_reader模块

  • 提供了对cgef文件的读取功能
  • 相关接口
      .. py:module:: cgef_reader_cy
    
      .. py:class:: CgefR(filepath)
    
      .. py:method:: get_expression_num(self)
    
          Get the number of expression.
    
      .. py:method:: get_cell_num(self)
    
          Get the number of cell.
    
      .. py:method:: get_gene_num(self)
    
          Get the number of gene.
    
      .. py:method:: get_gene_names(self)
    
          Get a list of gene names. The type of gene name is 32 chars.
    
      .. py:method:: get_cell_names(self)
    
          Get an array of cell ids. Each cell id is (cell.x <<32 | cell.y)
    
      .. py:method:: get_cells(self)
    
          Get cells, each cell include (id, x, y, offset, geneCount, expCount, dnbCount, area, cellTypeID, clusterID)
    
      .. py:method:: get_genes(self)
    
          Get genes, each gene include(geneName, offset, cellCount, expCount, maxMIDcount)
    
      .. py:method:: get_cellid_and_count(self)
    
          Get the count of each cell in each gene.
    
          :return:  (cell_id, count)
    
      .. py:method:: get_geneid_and_count(self)
    
          Get the count of each gene in each cell.
          
          :return:  (gene_id, count)
    
      .. py:method:: get_cellborders(self)
    
          Gets cell borders.
          
          :return: borders_list
    
      .. py:method:: get_filtered_data(self, region, genelist)
    
          Get the filtered data from cgef by region or gene.
    
          :param region: rect region(minx,maxx,miny,maxy)
          :param 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.
    
          :return: (uniq_cell, gene_names, count, cell_index, gene_index)
    

cgef_writer_cy模块

  • 提供对cgef文件的写入
  • 相关接口
      .. py:module:: cgef_writer_cy
    
      .. py:function:: generate_cgef(cgef_file, bgef_file, mask_file, block_size: list)
    
      Generate cell bin GEF file from bgef + mask.
    
      :param cgef_file: Output CGEF filepath.
      :param bgef_file: Input BGEF filepath.
      :param mask_file: Input make filepath.
      :param block_size: Block size list, usually set to [256,256].
    
      .. py:function:: cgem_to_cgef(cgem_file, outpath, block_size: list)
    
      Generate cell bin GEF file from cgem.
    
      :param cgem_file: Input cgem path.
      :param outpath: Output cgef path.
      :param block_size: Block size list,  usually set to [256,256].
    

gef_to_gem_cy模块

  • 提供gem文件转gef文件的功能
  • 相关接口
      .. py:module:: gef_to_gem_cy
    
      .. py:class:: GefToGem(strout, strsn, boutexon)
    
      .. py:method:: bgef2gem(self, strbgef, binsize)
    
          Create bgem file by bgef.
    
          :param strbgef: the bgef file path
          :param binsize: set the binsize
    
      .. py:method:: cgef2gem(self, strbgef, binsize)
    
          Create cgem file by cgef and bgef.
    
          :param strcgef: the cgef file path
          :param strbgef: the bgef file path
    
      .. py:method:: bgef2cgem(self, strmask, strbgef)
    
          Create cgem file by mask and bgef.
    
          :param strcgef: the mask file path
          :param strbgef: the bgef file path
    

API(also can see here)

See here.

Reporting bugs

Open a bug at https://github.com/STOmics/gefpy/issues.

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

gefpy-1.3.2-cp310-cp310-win_amd64.whl (17.9 MB view details)

Uploaded CPython 3.10Windows x86-64

gefpy-1.3.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (25.2 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

gefpy-1.3.2-cp310-cp310-macosx_11_0_arm64.whl (781.1 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

gefpy-1.3.2-cp39-cp39-win_amd64.whl (17.9 MB view details)

Uploaded CPython 3.9Windows x86-64

gefpy-1.3.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (25.3 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

gefpy-1.3.2-cp39-cp39-macosx_11_0_arm64.whl (785.3 kB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

gefpy-1.3.2-cp38-cp38-win_amd64.whl (17.9 MB view details)

Uploaded CPython 3.8Windows x86-64

gefpy-1.3.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (25.4 MB view details)

Uploaded CPython 3.8manylinux: glibc 2.17+ x86-64

gefpy-1.3.2-cp38-cp38-macosx_11_0_arm64.whl (781.2 kB view details)

Uploaded CPython 3.8macOS 11.0+ ARM64

gefpy-1.3.2-cp37-cp37m-win_amd64.whl (17.9 MB view details)

Uploaded CPython 3.7mWindows x86-64

gefpy-1.3.2-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (25.4 MB view details)

Uploaded CPython 3.7mmanylinux: glibc 2.17+ x86-64

File details

Details for the file gefpy-1.3.2-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: gefpy-1.3.2-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 17.9 MB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.20

File hashes

Hashes for gefpy-1.3.2-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 3b85ff568833dc046b21a6e4a781344a844648a8eb7d6c327c37a3da4df41375
MD5 abdf90e9ea755534b0e72a413bee59ae
BLAKE2b-256 53481e517cccbe543e7379fd6138a23996ae5f255c9861036d72c00f66f88974

See more details on using hashes here.

File details

Details for the file gefpy-1.3.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for gefpy-1.3.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9943e86226cc17151127bf8caf0c470b9f34da1bc59d611d8ddc2149bd79d5ae
MD5 37d660484382d86fb339fda6be4e2219
BLAKE2b-256 20297a501b01effd0a0e519ed984d231139dbe678110cb674db6f80cbe482180

See more details on using hashes here.

File details

Details for the file gefpy-1.3.2-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for gefpy-1.3.2-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7cac80f9d6bccc8b8a2d6097334a604578719fd4bed663e706b965571b754b89
MD5 f3738c28d546893d9c4b02ec82722997
BLAKE2b-256 6f50d2890957364d813a106cd4de4271ee01d94db724237586c1b32a2f32c162

See more details on using hashes here.

File details

Details for the file gefpy-1.3.2-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: gefpy-1.3.2-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 17.9 MB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.20

File hashes

Hashes for gefpy-1.3.2-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 f299a690c3e1c5e9bbb9915ba836ccd7e45dbbd84ce13f4c84f44ab076c860c7
MD5 0b85062a09c5b773b29072bf62d16d13
BLAKE2b-256 2a940e5a8acef557378aa6cdbffa050c7dad590f3091e02622adbb68daf714b5

See more details on using hashes here.

File details

Details for the file gefpy-1.3.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for gefpy-1.3.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 09f04b7b82ae47e6b695158d7328858313dc266af97919b17c4592693f8d9a0e
MD5 550c33f0c828222379eb41863058aea3
BLAKE2b-256 a97e9fe93788e0ed8496916c009007272aa111540421e99de0c961726c350608

See more details on using hashes here.

File details

Details for the file gefpy-1.3.2-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

  • Download URL: gefpy-1.3.2-cp39-cp39-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 785.3 kB
  • Tags: CPython 3.9, macOS 11.0+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.20

File hashes

Hashes for gefpy-1.3.2-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c0fd56181d6933190d2ede1a0f922c0ba0e2fa9f9a03a1c70ddaec977c7e50b2
MD5 5232dce55a9e0dae144c6eac212e9cd3
BLAKE2b-256 fc31d53c2d6c8bfa84b5dcfb53cefb37b633a82972bf8974880a9a12247c5441

See more details on using hashes here.

File details

Details for the file gefpy-1.3.2-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: gefpy-1.3.2-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 17.9 MB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.20

File hashes

Hashes for gefpy-1.3.2-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 7521331a61fd47a012452e4b5b85c980cc7967edebcef3df34d914c08fb87a28
MD5 fdcb2270e88734d2bb870febd1ac8b5d
BLAKE2b-256 24126c91148ec6a3288f07bfc061c75d03895ee6f6ff3369ef3bc7f31fd68df9

See more details on using hashes here.

File details

Details for the file gefpy-1.3.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for gefpy-1.3.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 39bb9a932f63661b52fb1ebeb24f7566fdf6dbed4f023f4fec982f2543dfee21
MD5 dee99b82bbba94fd38c5e11c4170f770
BLAKE2b-256 eccef47fd3d070e92a2cf0823d013ca77cf28f197bb8547433e25c2842b03505

See more details on using hashes here.

File details

Details for the file gefpy-1.3.2-cp38-cp38-macosx_11_0_arm64.whl.

File metadata

  • Download URL: gefpy-1.3.2-cp38-cp38-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 781.2 kB
  • Tags: CPython 3.8, macOS 11.0+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.20

File hashes

Hashes for gefpy-1.3.2-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9fff20444307e495a022c701b0cbc52f14833bdd279d39da4f5f0f5fc35e55cb
MD5 35fc475f22a429c23c740ca9d485b054
BLAKE2b-256 a1312840a7ad095703b29a35bf09ab50dff75f64e30c9f29826d563f8465bf3b

See more details on using hashes here.

File details

Details for the file gefpy-1.3.2-cp37-cp37m-win_amd64.whl.

File metadata

  • Download URL: gefpy-1.3.2-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 17.9 MB
  • Tags: CPython 3.7m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.20

File hashes

Hashes for gefpy-1.3.2-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 bb12ca2f5bfcf365ba59d5b85c9d656ddf44df0a705205b6441a217c4e014adb
MD5 a0e35b8396d9afe726aaf84cb7b073cc
BLAKE2b-256 6268f78e76a02e868784ae60b1312874fe3afe5d17970a13aba4ee4fa168f06d

See more details on using hashes here.

File details

Details for the file gefpy-1.3.2-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for gefpy-1.3.2-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 948561f7c3347f21480d9885279d4046427be74af38770d2f757d73bafbd67f2
MD5 c0bffc246ba9c9bf4b6256aeccba6bc9
BLAKE2b-256 2c0883876c6e3c107772143506a748c0c9b2c6670c0a14b77bafc2d813d96800

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page