Skip to main content

Anti-correlation based feature selection for single cell datasets

Project description

README

Tutorials

Anti-correlated genes as a method of feature selection

What is this repository for?

  • Unsupervised feature selection for single cell omics (or anything else!) that passes the null dataset test

How do I get set up?

python3 -m pip install anticor_features

You can also install using the setup.py script in the distribution like so: python3 setup.py install

How do I run use this package?

from anticor_features.anti_cor_features import get_anti_cor_genes

## Then feed in the expression matrix, with cells in columns, genes in rows
## and the feature names (all_features)
## and the species code (in gProfiler format, linked below)

anti_cor_table = get_anti_cor_genes(in_mat,
                                    all_features,
                                    species="hsapiens")

A list of the gProfiler accepted species codes is listed here: https://biit.cs.ut.ee/gprofiler/page/organism-list

The above call yields a pandas data frame that will give you the collected summary statistics, and let you filter based on the features annotated as "selected" in that column

>>> print(anti_cor_table.head())
     gene  pre_remove_feature  pre_remove_pathway  ...       FDR  num_sig_pos_cor  selected
0    Xkr4               False               False  ...       NaN              NaN       NaN
1     Rp1               False               False  ...       NaN              NaN       NaN
2   Sox17               False               False  ...  0.001883           3406.0      True
3  Mrpl15               False                True  ...       NaN              NaN       NaN
4  Lypla1               False                True  ...       NaN              NaN       NaN

The NaNs are produced where the gene was not assayed for anti-correlations either from pre-filtering (the default is to remove genes in pathways related to mitochondria, ribosomes, and hemoglobin).

If you want to customize which GO terms are removed, you can do that with the

anti_cor_table = get_anti_cor_genes(in_mat,
                                    all_features,
                                    species="hsapiens")

Command line interface

You can also use this tool at the command line, if you have either a .tsv or an hdf5 file, with the matrix under the key "infile"

python3 -m anticor_features.anticor_features -i exprs.tsv -species mmusculus

or something similar. This outputs the pandas table to a tsv in the same folder as the input file

See the help section for more detailed usage of the command line interface:

python3 -m anticor_features.anticor_features -h

License

This package is available via the AGPLv3 license.

Who do I talk to?

Project details


Download files

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

Source Distribution

anticor_features-0.1.0.tar.gz (18.7 kB view hashes)

Uploaded Source

Built Distribution

anticor_features-0.1.0-py3-none-any.whl (18.0 kB view hashes)

Uploaded Python 3

Supported by

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