Skip to main content

DBFE: Distribution-Based Feature Extractor

Python 3 License Discuss

DBFE is a Python library with feature extraction methods that facilitate classifier learning from distributions of genomic variants.

Installing dbfe

To install dbfe, just execute:

pip install dbfe

Quickstart

import pandas as pd

from sklearn.metrics import roc_auc_score
from sklearn.model_selection import train_test_split
from sklearn.pipeline import make_pipeline
from sklearn.preprocessing import StandardScaler
from sklearn.linear_model import LogisticRegression

import dbfe

# sample data
stat_vals = pd.read_csv(f"../experiments/data/ovarian/ovarian_cnv.csv.gz", index_col='SAMPLEID')
stat_vals = stat_vals.loc[stat_vals.SVCLASS == "DEL", :]
stat_vals = stat_vals.groupby(stat_vals.index)['LEN'].apply(list).to_frame()

labels = pd.read_csv(f"../experiments/data/ovarian/labels.tsv", sep='\t', index_col=0)
labels = (labels == "RES") * 1
stat_df = stat_vals.join(labels.CLASS_LABEL, how='inner')

# splitting into training and testing data
X = stat_df.loc[:, "LEN"]
y = stat_df.loc[:, "CLASS_LABEL"]
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.25, random_state=23, stratify=y)

# DBFE in a classification pipeline
extractor = dbfe.DistributionBasedFeatureExtractor(breakpoint_type='supervised', n_bins='auto', cv=10)
pipe = make_pipeline(extractor, StandardScaler(), LogisticRegression())
pipe.fit(X_train, y_train)

extractor.plot_data_with_breaks(X_train, y_train, plot_type='kde')
y_prob = pipe.predict_proba(X_test)
print("AUC on test data: {:.3}".format(roc_auc_score(y_test, y_prob[:, 1])))

License

  • This project is released under a permissive new BSD open source license (LICENSE-BSD3.txt) and commercially usable. There is no warranty; not even for merchantability or fitness for a particular purpose.
  • In addition, you may use, copy, modify and redistribute all artistic creative works (figures and images) included in this distribution under the directory according to the terms and conditions of the Creative Commons Attribution 4.0 International License. See the file LICENSE-CC-BY.txt for details. (Computer-generated graphics such as the plots produced by seaborn/matplotlib fall under the BSD license mentioned above).

Citing

If you use dbfe as part of your workflow in a scientific publication, please consider citing the associated paper:

  • Piernik, M. et al. (2022) DBFE: Distribution-based feature extraction from copy number and structural variants in whole-genome data.

Metadata

Release files for dbfe 0.2.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dbfe 0.2.2
File Size Uploaded Provenance Actions
dbfe-0.2.2.tar.gz 13.6 kB Without provenance Details for dbfe-0.2.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for dbfe 0.2.2
File Interpreter ABI Platform Actions
dbfe-0.2.2-py3-none-any.whl Python 3 none any Details for dbfe-0.2.2-py3-none-any.whl

Total release size: 28.4 kB

Release files / dbfe-0.2.2.tar.gz

Download URL dbfe-0.2.2.tar.gz
Size 13.6 kB
Tags Source
SHA-256 checksum
How to use checksums
0eedef6b0975e58726352f5db1d54fef8cc9e6bf20a0cb2999fa1b44f9cfccb9
BLAKE2b-256 checksum
How to use checksums
26faf08da1511511c3cea5c1e2fa6117f7e8f87dc7d1195c17b62cb465947ebc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.7.9

Release files / dbfe-0.2.2-py3-none-any.whl

Download URL dbfe-0.2.2-py3-none-any.whl
Size 14.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f15ac97838595bdb6e9cf6fdb479e4e079ce105533054ab00a20040a23b3f4f1
BLAKE2b-256 checksum
How to use checksums
3f0c57d0fcf9b6f79e9e5effa44051ecbf8094de5eb63f04e544ab3ba462b826
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.7.9

Security for dbfe 0.2.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.2 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page