Skip to content

Commit

Permalink
Merge pull request #24 from faridrashidi:release/v0.0.11
Browse files Browse the repository at this point in the history
release v0.0.11
  • Loading branch information
faridrashidi authored Jul 4, 2021
2 parents 8ebf75e + 652adb5 commit 70969a5
Show file tree
Hide file tree
Showing 31 changed files with 150 additions and 144 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.10
current_version = 0.0.11
commit = True
tag = False
files = setup.py trisicell/__init__.py
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,10 @@ jobs:
path: dist

- name: Publish wheels to PyPI
uses: pypa/gh-action-pypi-publish@v1.4.2
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}
packages_dir: dist/artifact/
skip_existing: true
verbose: true
14 changes: 14 additions & 0 deletions .scripts/ci/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,23 @@ set -ev
echo "Installing APT dependencies"
if [[ "$OS" == "macos-latest" ]]; then
brew install R
# pip install rpy2>=3.3.0
# Rscript -e 'install.packages("devtools")'
# Rscript -e 'install.packages("BiocManager")'
# Rscript -e 'install.packages("tidyverse")'
# Rscript -e 'install.packages("cowplot")'
# Rscript -e 'devtools::install_github("YuLab-SMU/ggtree")'
# Rscript -e 'devtools::install_github("YuLab-SMU/aplot")'
# Rscript -e 'devtools::install_github("xiangpin/ggtreeExtra")'
# Rscript -e 'devtools::install_github("zhouzilu/DENDRO")'
# Rscript -e 'BiocManager::install("graph")'
# Rscript -e 'devtools::install_bitbucket("edith_ross/oncoNEM")'

brew install graphviz
pip install pygraphviz

brew install graph-tool

brew install mpich
pip install mpi4py
elif [[ "$OS" == "ubuntu-latest" ]]; then
Expand Down
10 changes: 10 additions & 0 deletions docs/source/release_notes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,16 @@ Release Notes
=============


Version 0.0.11 :small:`July 4, 2021`
-------------------------------------

This version includes:

- Fix some typos.
- Fix some bugs.
- Fix SCITE cythonizing issue.


Version 0.0.10 :small:`July 3, 2021`
-------------------------------------

Expand Down
43 changes: 22 additions & 21 deletions 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.10"
__version__ = "0.0.11"

if platform == "linux" or platform == "linux2":
os.environ["CC"] = "g++"
Expand Down Expand Up @@ -56,26 +56,26 @@
extra_compile_args=["-O3", "-std=c++11", "-c"],
language="c++",
),
# Extension(
# "trisicell.external._scite",
# sources=[
# "trisicell/external/_scite.pyx",
# "trisicell/external/scite/matrices.cpp",
# "trisicell/external/scite/mcmcBinTreeMove.cpp",
# "trisicell/external/scite/mcmc.cpp",
# "trisicell/external/scite/mcmcTreeMove.cpp",
# "trisicell/external/scite/output.cpp",
# "trisicell/external/scite/rand.cpp",
# "trisicell/external/scite/scoreBinTree.cpp",
# "trisicell/external/scite/scoreTree.cpp",
# "trisicell/external/scite/treelist.cpp",
# "trisicell/external/scite/trees.cpp",
# "trisicell/external/scite/findBestTrees.cpp",
# ],
# include_dirs=["trisicell/external/scite"],
# extra_compile_args=["-std=c++11"],
# language="c++",
# ),
Extension(
"trisicell.external._scite",
sources=[
"trisicell/external/_scite.pyx",
"trisicell/external/scite/matrices.cpp",
"trisicell/external/scite/mcmcBinTreeMove.cpp",
"trisicell/external/scite/mcmc.cpp",
"trisicell/external/scite/mcmcTreeMove.cpp",
"trisicell/external/scite/output.cpp",
"trisicell/external/scite/rand.cpp",
"trisicell/external/scite/scoreBinTree.cpp",
"trisicell/external/scite/scoreTree.cpp",
"trisicell/external/scite/treelist.cpp",
"trisicell/external/scite/trees.cpp",
"trisicell/external/scite/findBestTrees.cpp",
],
include_dirs=["trisicell/external/scite"],
extra_compile_args=["-O3", "-std=c++11", "-c"],
language="c++",
),
]


Expand Down Expand Up @@ -136,6 +136,7 @@ def no_cythonize(extensions, **_ignore):
},
platforms=["Linux", "MacOSX"],
packages=find_packages(),
include_package_data=True,
author=__author__,
author_email=__email__,
email=__email__,
Expand Down
4 changes: 1 addition & 3 deletions tests/test_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ def test_scistree(self):
)
assert result.exit_code == 0

@pytest.mark.skip(reason="SCITE compilation issue!")
def test_scite(self):
runner = CliRunner()
result = runner.invoke(
Expand All @@ -37,7 +36,6 @@ def test_scite(self):
)
assert result.exit_code == 0

@pytest.mark.skip(reason="SCITE compilation issue!")
def test_scite_experiment(self):
runner = CliRunner()
result = runner.invoke(
Expand Down Expand Up @@ -68,7 +66,7 @@ def test_phiscsb(self):
)
assert result.exit_code == 0

@pytest.mark.skip(reason="PyTest issue with multithreading!")
@pytest.mark.skip(reason="PyTest issue with multithreading!") # TODO:
def test_booster(self):
runner = CliRunner()
result = runner.invoke(
Expand Down
23 changes: 20 additions & 3 deletions tests/test_solvers.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,13 @@ def test_simulate(self):
is_cf = tsc.ul.is_conflict_free_gusfield(df_in)
assert not is_cf

@pytest.mark.skip(reason="PyTest issue with redirecting the stdout!")
@pytest.mark.skip(reason="PyTest issue with redirecting the stdout!") # TODO:
def test_scistree(self):
df_in = tsc.datasets.test()
df_out = tsc.tl.scistree(df_in, alpha=0.0000001, beta=0.1)
is_cf = tsc.ul.is_conflict_free_gusfield(df_out)
assert is_cf

@pytest.mark.skip(reason="SCITE compilation issue!")
def test_scite(self):
df_in = tsc.datasets.test()
df_out = tsc.tl.scite(
Expand Down Expand Up @@ -69,7 +68,7 @@ def test_phiscs_bulk(self):
is_cf = tsc.ul.is_conflict_free_gusfield(df_out)
assert is_cf

def test_booster(self):
def test_booster_phiscs(self):
df_in = tsc.datasets.test()
df_out = tsc.tl.booster(
df_in,
Expand All @@ -81,6 +80,24 @@ def test_booster(self):
n_samples=20,
begin_index=0,
n_jobs=1,
time_out=120,
dep_weight=5,
)
is_cf = tsc.ul.is_conflict_free_gusfield(df_out)
assert is_cf

def test_booster_scite(self):
df_in = tsc.datasets.test()
df_out = tsc.tl.booster(
df_in,
alpha=0.0000001,
beta=0.1,
solver="SCITE",
sample_on="muts",
sample_size=10,
n_samples=20,
begin_index=0,
n_jobs=1,
n_iterations=10000,
dep_weight=5,
)
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.10"
__version__ = "0.0.11"
__all__ = (datasets, io, logg, pl, pp, settings, tl, ul)
7 changes: 1 addition & 6 deletions trisicell/datasets/_datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,6 @@ def example(kind):
-------
:class:`anndata.AnnData`
An object that cells are in `.obs` and mutations are in `.var`.
Raises
------
ValueError
If `kind` is not `genotype` or `expression`.
"""

if kind.lower() == "genotype":
Expand All @@ -31,7 +26,7 @@ def example(kind):
tsc.ul.get_file("trisicell.datasets/data/expression.h5ad.gz")
)
else:
raise ValueError("kind must be either genotype or expression")
tsc.logg.error("kind must be either genotype or expression")


def test():
Expand Down
6 changes: 3 additions & 3 deletions trisicell/datasets/_simulate.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def simulate(n_cells=10, n_muts=10, n_clones=3, alpha=0.00001, beta=0.1, missing
"BiocManager::install('graph')\ndevtools::install_bitbucket('edith_ross/oncoNEM')\n",
)
if onconem_is_not_imported:
raise RuntimeError("Unable to import a package!")
tsc.logg.error("Unable to import a package!")

import rpy2.robjects as ro
from rpy2.robjects import pandas2ri
Expand Down Expand Up @@ -73,7 +73,7 @@ def splatter(noisy, ground, seed=5):
"BiocManager::install('splatter')\n",
)
if splatter_is_not_imported:
raise RuntimeError("Unable to import a package!")
tsc.logg.error("Unable to import a package!")

import rpy2.robjects as ro

Expand Down Expand Up @@ -166,7 +166,7 @@ def create_splatter():
"BiocManager::install('splatter')\n",
)
if splatter_is_not_imported:
raise RuntimeError("Unable to import a package!")
tsc.logg.error("Unable to import a package!")

import rpy2.robjects as ro

Expand Down
Binary file removed trisicell/external/bin/scite
Binary file not shown.
6 changes: 3 additions & 3 deletions trisicell/external/scite/findBestTrees.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ int m; // number of samples
char scoreType = 'm';
int rep; // number of repetitions of the MCMC
int loops; // number of loops within a MCMC
double gamma = 1;
double gammaParam = 1;
double fd; // rate of false discoveries (false positives 0->1)
double ad1; // rate of allelic dropout (false negatives 1->0)
double ad2 = 0.0; // rate of allelic dropout (2->1)
Expand Down Expand Up @@ -105,7 +105,7 @@ int main_in_c(int argc, char **argv)
if(trueTreeComp==true){ trueParentVec = getParentVectorFromGVfile(trueTreeFileName, n); }

/** Find best scoring trees by MCMC **/
sampleOutput = runMCMCbeta(optimalTrees, errorRates, rep, loops, gamma, moveProbs, n, m, dataMatrix, scoreType, trueParentVec, sampleStep, sample, chi, priorSd, useTreeList, treeType);
sampleOutput = runMCMCbeta(optimalTrees, errorRates, rep, loops, gammaParam, moveProbs, n, m, dataMatrix, scoreType, trueParentVec, sampleStep, sample, chi, priorSd, useTreeList, treeType);


/*** output results ***/
Expand Down Expand Up @@ -274,7 +274,7 @@ int readParameters(int argc, char* argv[]){
} else if(strcmp(argv[i], "-l")==0) {
if (i + 1 < argc) { loops = atoi(argv[++i]);}
} else if(strcmp(argv[i], "-g")==0) {
if (i + 1 < argc) { gamma = atof(argv[++i]);}
if (i + 1 < argc) { gammaParam = atof(argv[++i]);}
} else if(strcmp(argv[i], "-fd")==0) {
if (i + 1 < argc) { fd = atof(argv[++i]);}
} else if(strcmp(argv[i],"-ad")==0) {
Expand Down
18 changes: 3 additions & 15 deletions trisicell/io/_genotype.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,23 +26,18 @@ def read(filepath):
-------
:class:`pandas.DataFrame` or :class:`anndata.AnnData`
Depends on the format of the input file the output type is different.
Raises
------
ValueError
If the extension is not one of the above.
"""

ext = os.path.splitext(filepath)[-1]
if ext in [".SC", ".CFMatrix", ".before_FP_FN_NA", ".tsv"]:
sc = pd.read_table(filepath, index_col=0)
if len(sc.columns) != len(set(sc.columns)):
raise RuntimeError("Mutation ids must be unique!")
tsc.logg.error("Mutation ids must be unique!")
return sc
elif ext in [".h5ad", ".gz"]:
return ad.read(filepath)
else:
raise ValueError("Extension is wrong!")
tsc.logg.error("Extension is wrong!")


def write(obj, filepath):
Expand All @@ -54,13 +49,6 @@ def write(obj, filepath):
The input object which is going to be written in a file.
filepath : :obj:`str`
The file path where the `obj` must be written in.
Raises
------
ValueError
If `obj` is not an instance of:
:class:`pandas.DataFrame`
:class:`anndata.AnnData`
"""

if isinstance(obj, pd.DataFrame):
Expand All @@ -69,7 +57,7 @@ def write(obj, filepath):
elif isinstance(obj, ad.AnnData):
obj.write(filepath + ".h5ad.gz", compression="gzip")
else:
raise ValueError("Object instance is wrong!")
tsc.logg.error("Object instance is wrong!")


def read_gatk(
Expand Down
11 changes: 6 additions & 5 deletions trisicell/logging/_logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def info(*args, **kwargs):
[type]
[description]
"""
return msg(*args, v="info", **kwargs)
msg(*args, v="info", **kwargs)


def error(*args, **kwargs):
Expand All @@ -30,7 +30,8 @@ def error(*args, **kwargs):
[description]
"""
args = ("Error:",) + args
return msg(*args, v="error", **kwargs)
msg(*args, v="error", **kwargs)
exit(1)


def warn(*args, **kwargs):
Expand All @@ -42,7 +43,7 @@ def warn(*args, **kwargs):
[description]
"""
args = ("WARNING:",) + args
return msg(*args, v="warn", **kwargs)
msg(*args, v="warn", **kwargs)


def hint(*args, **kwargs):
Expand All @@ -53,7 +54,7 @@ def hint(*args, **kwargs):
[type]
[description]
"""
return msg(*args, v="hint", **kwargs)
msg(*args, v="hint", **kwargs)


def debug(*args, **kwargs):
Expand All @@ -65,7 +66,7 @@ def debug(*args, **kwargs):
[description]
"""
args = ("DEBUG:",) + args
return msg(*args, v="debug", **kwargs)
msg(*args, v="debug", **kwargs)


def msg(*msg, v, time=False, end="\n"):
Expand Down
Loading

0 comments on commit 70969a5

Please sign in to comment.