Skip to content

Commit

Permalink
Merge pull request #111 from faridrashidi/develop
Browse files Browse the repository at this point in the history
release v0.0.21
  • Loading branch information
faridrashidi authored Apr 22, 2022
2 parents 4db89ed + 6020378 commit c5a6a0e
Show file tree
Hide file tree
Showing 55 changed files with 2,093 additions and 238 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.0.20
current_version = 0.0.21
commit = True
message = [skip ci] {current_version} → {new_version}
tag = False
Expand Down
13 changes: 13 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
*.py linguist-detectable=true
*Makefile linguist-detectable=false
*.md linguist-detectable=false
*.h linguist-detectable=false
*.cpp linguist-detectable=false
*.rst linguist-detectable=false
*.yaml linguist-detectable=false
*.yml linguist-detectable=false
*.cfg linguist-detectable=false
*.txt linguist-detectable=false
*.pyx linguist-detectable=false
*.R linguist-detectable=false
*.sh linguist-detectable=false
14 changes: 7 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ default_stages:
minimum_pre_commit_version: 2.9.3
repos:
- repo: https://github.com/psf/black
rev: 21.11b1
rev: 22.3.0
hooks:
- id: black
additional_dependencies: [toml]
Expand All @@ -19,7 +19,7 @@ repos:
additional_dependencies: [toml]
args: [--order-by-type, --profile, 'black']
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
rev: v4.2.0
hooks:
- id: detect-private-key
- id: check-merge-conflict
Expand All @@ -40,22 +40,22 @@ repos:
- id: check-toml
- id: requirements-txt-fixer
- repo: https://github.com/jumanjihouse/pre-commit-hooks
rev: 2.1.5
rev: 2.1.6
hooks:
- id: script-must-have-extension
name: Check executable files use .sh extension
types: [shell, executable]
- repo: https://github.com/myint/rstcheck
rev: 3f92957478422df87bd730abde66f089cc1ee19b
rev: v5.0.0
hooks:
- id: rstcheck
- repo: https://github.com/asottile/blacken-docs
rev: v1.12.0
rev: v1.12.1
hooks:
- id: blacken-docs
additional_dependencies: [black==20.8b1]
- repo: https://github.com/asottile/pyupgrade
rev: v2.29.1
rev: v2.32.0
hooks:
- id: pyupgrade
args: [--py3-plus, --py37-plus]
Expand All @@ -69,7 +69,7 @@ repos:
- id: rst-directive-colons
- id: rst-inline-touching-normal
- repo: https://github.com/PyCQA/doc8
rev: 0.10.1
rev: 0.11.1
hooks:
- id: doc8
args: [--max-line-length=88]
Expand Down
19 changes: 11 additions & 8 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
version: 2

build:
os: ubuntu-20.04
tools:
python: "3.9"
apt_packages:
- pandoc

sphinx:
builder: html
configuration: docs/source/conf.py
fail_on_warning: false

formats:
- htmlzip
- pdf

build:
image: latest

python:
version: 3.7
install:
- requirements: docs/requirements_rtfd.txt

formats:
- htmlzip
- pdf
3 changes: 1 addition & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ Please see our `preprint`_ on **bioRxiv** to learn more.

Support
-------
Feel free to submit an `issue <https://github.com/faridrashidi/trisicell/issues/new/choose>`_
or send us an `email <mailto:[email protected]>`_.
Feel free to submit an `issue <https://github.com/faridrashidi/trisicell/issues/new/choose>`_.
Your help to improve Trisicell is highly appreciated.

Trisicell was developed in collaboration between the `Cancer Data Science Laboratory (CDSL) <https://ccr.cancer.gov/staff-directory/s-cenk-sahinalp>`_ and the `Laboratory of Cancer Biology and Genetics (LCBG) <https://ccr.cancer.gov/staff-directory/glenn-merlino>`_ at the `National Cancer Institute (NCI) <https://www.cancer.gov>`_.
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/source/citing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ BibTeX
month = mar,
publisher = {Cold Spring Harbor Laboratory},
author = {Farid Rashidi Mehrabadi and Kerrie L. Marie and Eva Perez-Guijarro and Salem Malikic and Erfan Sadeqi Azer and Howard H. Yang and Can Kizilkale and Charli Gruen and Wells Robinson and Huaitian Liu and Michael C. Kelly and Christina Marcelus and Sandra Burkett and Aydin Buluc and Funda Ergun and Maxwell P. Lee and Glenn Merlino and Chi-Ping Day and S. Cenk Sahinalp},
title = {{Profiles of expressed mutations in single cells reveal subclonal expansion patterns and therapeutic impact of intratumor heterogeneity}}
title = {{Profiles of expressed mutations in single cells reveal subclonal expansion patterns and therapeutic impact of intratumor heterogeneity}},
journal = {bioRxiv}
}
3 changes: 1 addition & 2 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#
import os
import sys
from datetime import datetime
from pathlib import Path

from pybtex.plugin import register_plugin
Expand Down Expand Up @@ -46,7 +45,7 @@
title = (
"Scalable intratumor heterogeneity inference and validation from single-cell data"
)
copyright = f"{datetime.now():%Y}, {author}"
copyright = f"2021-2022, {author}"
release = "master"
version = f"master ({trisicell.__version__})"

Expand Down
1 change: 0 additions & 1 deletion docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
installation
release_notes
citing
references

.. toctree::
:caption: Docs
Expand Down
9 changes: 9 additions & 0 deletions docs/source/release_notes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@ Release Notes
=============


Version 0.0.21 :small:`April 22, 2022`
-----------------------------------------

This version includes:

- Fix some bugs.
- Improve the documentations.


Version 0.0.20 :small:`November 22, 2021`
-----------------------------------------

Expand Down
2 changes: 2 additions & 0 deletions examples/reconstruction/compute_booster.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

import trisicell as tsc

# sphinx_gallery_thumbnail_path = "_static/thumbnails/trisicell-boost.png"

# %%
# First, we load a binary test single-cell genotype data.
df_in = tsc.datasets.test()
Expand Down
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ ignore =
D107, # D107 Missing docstring in __init__
W503, # W503 line break before binary operator
D202, # D202 No blank lines allowed after function docstring
B020, # B020 Found for loop that reassigns the iterable it is iterating with each
B902, # B902 blind except Exception: statement
C400, # C400 Unnecessary generator - rewrite as a list comprehension
[tool:pytest]
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
__author__ = ", ".join(["Farid Rashidi"])
__maintainer__ = ", ".join(["Farid Rashidi"])
__email__ = ", ".join(["[email protected]"])
__version__ = "0.0.20"
__version__ = "0.0.21"

if platform == "linux" or platform == "linux2":
os.environ["CC"] = "g++"
Expand Down
5 changes: 2 additions & 3 deletions tests/test_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,9 @@ def test_scite_experiment(self):
tsc.ul.get_file("trisicell.datasets/test/test.tsv"),
"0.0000001",
"0.1",
"-r 3",
"-l 1000",
"-e",
"-h 0.005",
"-t 1",
"-s 1",
],
)
assert result.exit_code == 0
Expand Down
4 changes: 4 additions & 0 deletions tests/test_logging.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import pytest

import trisicell as tsc


Expand All @@ -9,4 +11,6 @@ def test_logging(self):
tsc.logg.info("INFO")
tsc.logg.warn("WARN")
tsc.logg.info("TIME", time=True, color="red")
with pytest.raises(RuntimeError):
tsc.logg.error("ERROR")
assert True
7 changes: 7 additions & 0 deletions tests/test_pp.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,10 @@ def test_readcount(self):
tsc.pp.remove_cell_by_list(adata, ["C15_1"])
tsc.pp.keep_cell_by_list(adata, ["C15_2", "C15_3"])
assert adata.shape == (2, 267)

def test_local_cluster_cells_then_merge_muts_pseudo_bulk(self):
geno = tsc.datasets.example()
geno_merged, geno = tsc.pp.local_cluster_cells_then_merge_muts_pseudo_bulk(
geno, by="mut", n_clusters=11, min_n_cells=2, attr="group"
)
assert geno_merged.shape == (11, 452)
4 changes: 4 additions & 0 deletions tests/test_tl_scores.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ def setup_method(self):
self.grnd = tsc.io.read(f1)
self.sol = tsc.io.read(f2)

def test_gs(self):
gs = tsc.tl.gs(self.grnd, self.sol)
assert np.abs(gs - 0.9895) < 0.0001

def test_ad(self):
ad = tsc.tl.ad(self.grnd, self.sol)
assert np.abs(ad - 0.9778) < 0.0001
Expand Down
12 changes: 6 additions & 6 deletions tests/test_tl_solvers.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ def test_phiscsb(self):
df_out = tsc.tl.phiscsb(self.df_in, alpha=0.0000001, beta=0.1)
assert tsc.ul.is_conflict_free_gusfield(df_out)

def test_huntress_both(self):
df_out = tsc.tl.huntress(self.df_in, alpha=0.0000001, beta=0.1, kind="both")
assert tsc.ul.is_conflict_free_gusfield(df_out)
# def test_huntress_both(self):
# df_out = tsc.tl.huntress(self.df_in, alpha=0.0000001, beta=0.1)
# assert tsc.ul.is_conflict_free_gusfield(df_out)

def test_huntress_fn(self):
df_out = tsc.tl.huntress(self.df_in, alpha=0, beta=0, kind="fn")
assert tsc.ul.is_conflict_free_gusfield(df_out)
# def test_huntress_fn(self):
# df_out = tsc.tl.huntress(self.df_in, alpha=0, beta=0.1)
# assert tsc.ul.is_conflict_free_gusfield(df_out)

@skip_rpy2
def test_onconem(self):
Expand Down
2 changes: 1 addition & 1 deletion trisicell/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
__author__ = ", ".join(["Farid Rashidi"])
__maintainer__ = ", ".join(["Farid Rashidi"])
__email__ = ", ".join(["[email protected]"])
__version__ = "0.0.20"
__version__ = "0.0.21"
__all__ = (datasets, io, logg, pl, pp, settings, tl, ul)
2 changes: 1 addition & 1 deletion trisicell/commands/_bnb.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def bnb(genotype_file, bounding, time_limit):
A fast branch and bound algorithm for
the perfect tumor phylogeny reconstruction problem :cite:`PhISCS-BnB`.
trisicell bnb input.SC 0.0001 0.1 -b real
trisicell bnb input.SC -b real
"""

outfile = os.path.splitext(genotype_file)[0]
Expand Down
115 changes: 115 additions & 0 deletions trisicell/commands/_gpps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
import os

import click

import trisicell as tsc


@click.command(short_help="Run gpps.")
@click.argument(
"genotype_file",
required=True,
type=click.Path(
exists=True, file_okay=True, dir_okay=False, readable=True, resolve_path=True
),
)
@click.argument(
"alpha",
required=True,
type=float,
)
@click.argument(
"beta",
required=True,
type=float,
)
@click.option(
"--k_dollo",
"-k",
default=0,
type=int,
show_default=True,
help="k-Dollo.",
)
@click.option(
"--max_del",
"-d",
default=-1,
type=int,
show_default=True,
help="Maximum number of deletion allowed.",
)
@click.option(
"--neighbor_size",
"-s",
default=30,
type=int,
show_default=True,
help="Hill climbing neighborhood size.",
)
@click.option(
"--n_iters",
"-l",
default=100,
type=int,
show_default=True,
help="Hill climbing maximum iterations.",
)
@click.option(
"--time_limit",
"-t",
default=86400,
type=int,
show_default=True,
help="Time limit of the program (in second).",
)
@click.option(
"--n_threads",
"-p",
default=1,
type=int,
show_default=True,
help="Number of threads.",
)
def gpps(
genotype_file,
alpha,
beta,
k_dollo,
max_del,
neighbor_size,
n_iters,
time_limit,
n_threads,
):
"""gpps.
an ILP-based approach for inferring cancer progression with mutation losses from
single cell data :cite:`gpps`.
trisicell gpps input.SC 0.0001 0.1 -k 0 -s 30 -l 100 -t 86400 -p 1
"""

outfile = os.path.splitext(genotype_file)[0]

tsc.settings.verbosity = "info"
tsc.settings.logfile = f"{outfile}.gpps.log"

df_in = tsc.io.read(genotype_file)

if alpha == 0:
alpha = 0.000000000001
df_out = tsc.tl.gpps(
df_in,
alpha=alpha,
beta=beta,
k_dollo=k_dollo,
max_del=max_del,
neighbor_size=neighbor_size,
n_iters=n_iters,
time_limit=time_limit,
n_threads=n_threads,
)
tsc.io.write(df_out, f"{outfile}.gpps.CFMatrix")

return None
Loading

0 comments on commit c5a6a0e

Please sign in to comment.