Coder Social home page Coder Social logo

euxhenh / phenotype-cover Goto Github PK

View Code? Open in Web Editor NEW
3.0 1.0 0.0 30 KB

A package for biomarker selection based on multiset multicover and the cross-entropy-method.

Home Page: https://www.cell.com/cell-reports-methods/fulltext/S2667-2375(22)00229-6

License: MIT License

Python 100.00%
biomarker biomarker-discovery genes scrna-seq set-cover

phenotype-cover's Introduction

This repository provides two algorithms for the phenotype cover (PC) biomarker selection problem introduced in the paper: "Multiset multicover methods for discriminative marker selection". GreedyPC is based on the extended greedy algorithm to set cover, and CEM-PC is based on the cross-entropy-method.

Install via

pip install multiset-multicover
pip install phenotype-cover

Other packages that phenotype-cover depends on are numpy, matplotlib, and scikit-learn.

Import GreedyPC or CEMPC from phenotype_cover.

Example

>>> from phenotype_cover import GreedyPC
>>> from sklearn.datasets import make_classification
>>> # You may need to log-transform X if working with raw counts
>>> X, y = make_classification(1000, 200, n_informative=5, n_classes=5, scale=100)
>>> gpc = GreedyPC()
>>> gpc.fit(X, y)
>>> features = gpc.select(100)  # coverage of 100

Some other functionality implemented in GreedyPC

>>> # Number of elements reamining and coverage attained after every iteration
>>> gpc.plot_progress()
>>> gpc.n_elements_remaining_per_iter_
>>> gpc.coverage_per_iter_
>>> # Heatmap of the coverage provided by some feature i
>>> gpc.feature_coverage(i)
>>> # Maximum possible coverage for evey class pair
>>> gpc.max_coverage()
>>> # Pairs that could not be covered to the desired `coverage`
>>> gpc.pairs_with_incomplete_cover_

phenotype-cover's People

Contributors

euxhenh avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

phenotype-cover's Issues

ValueError in example

I tried using your method but running the example code provided in the readme,

X = np.log1p(np.random.randint(0, 1000, (1000, 200)))
y = np.random.randint(0, 5, 1000)
gpc = GreedyPC()
gpc.fit(X, y)
features = gpc.select(100)

produces the following error:

Traceback (most recent call last):
  File ".../gpc_test.py", line 17, in <module>
    features = gpc.select(100)
  File ".../.local/lib/python3.10/site-packages/phenotype_cover/_phenotype_cover.py", line 169, in select
    self.multiplier = self._multiplier
  File ".../.local/lib/python3.10/site-packages/phenotype_cover/_phenotype_cover.py", line 291, in multiplier
    self._gci_wrapper.fit(self.M_)
  File ".../.local/lib/python3.10/site-packages/phenotype_cover/_gci_wrapper.py", line 98, in fit
    raise ValueError(
ValueError: No sets were selected. This means your data matrix consists of only zeros. Please use higher multiplicity.

Python version 3.10 on Ubuntu Ubuntu 22.04.2 LTS.

Could You please help me with this issue?

Thank You in advance,
Bartol

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.