Skip to content

Commit

Permalink
Merge pull request #39 from AlexandrovLab/u56_m2
Browse files Browse the repository at this point in the history
U56 m2
  • Loading branch information
mdbarnesUCSD authored Aug 11, 2023
2 parents 2a4103f + 4832589 commit 7bb8876
Show file tree
Hide file tree
Showing 79 changed files with 30,847 additions and 98 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,8 @@ share/python-wheels/
.installed.cfg
*.egg
MANIFEST


# test output
tests/input/*/output/*
sigProfilerPlotting/examples/output/
9 changes: 6 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ python:

install:
- pip install -q matplotlib
- pip install . -v

script: python3 plot_example.py
- pip install .[tests]

script:
# run integration test
- python3 sigProfilerPlotting/examples/plot_example.py
# run unit tests
- pytest -s -rw tests
5 changes: 3 additions & 2 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
include fonts/*
include reference_formats/*
include sigProfilerPlotting/fonts/*
include sigProfilerPlotting/reference_formats/*
include tests/*
11 changes: 5 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,9 @@ sigPlt.plotID(matrix_path, output_path, project, plot_type, percentage=False)
```python
import sigProfilerPlotting as sigPlt

matrix_path = "./input/examples/samples/breast_cancer_samples_example.CNV48.all" #Output of CNVMatrixGenerator
output_path = "./output/examples/samples/"
matrix_path = "./sigProfilerPlotting/examples/input/breast_cancer_samples_example.CNV48.all" #Output of CNVMatrixGenerator
output_path = "./sigProfilerPlotting/examples/output/"
project = "Breast"

```

**AVAILABLE FUNCTIONS**
Expand Down Expand Up @@ -106,12 +105,12 @@ sP.samplePortrait(sample_matrices_path, output_path, project, percentage=False)

**EXAMPLE**

This package comes with an example test for each plot type. Run the script plot_example.py from within the downloaded repo after installation:
This package comes with an example test for each plot type. Run the script plot_example.py from within the examples directory in the downloaded repo after installation:
```python
python3 plot_example.py
python3 sigProfilerPlotting/examples/plot_example.py
```

This example will create plots for each context for each of the included four samples. These plots will be saved within the BRCA_plot/plots/ folder.
This example will create plots for each context for each of the included four samples. These plots will be saved within the `sigProfilerPlotting/examples/output/` folder.

**CITATION**

Expand Down
64 changes: 18 additions & 46 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import os
import shutil
import warnings

from setuptools import setup
from setuptools.command.install import install
Expand All @@ -15,7 +14,7 @@ def readme():
return f.read()


VERSION = "1.3.14"
VERSION = "1.3.15"


def write_version_py(filename="sigProfilerPlotting/version.py"):
Expand All @@ -28,54 +27,17 @@ def write_version_py(filename="sigProfilerPlotting/version.py"):
"""
fh = open(filename, "w")
fh.write(
cnt % {"version": VERSION,}
cnt
% {
"version": VERSION,
}
)
fh.close()


write_version_py()


# Set up the machinery to install custom fonts. Subclass the setup tools install
# class in order to run custom commands during installation.
class move_ttf(install):
def run(self):
"""
Performs the usual install process and then copies the True Type fonts
that come with clearplot into matplotlib's True Type font directory,
and deletes the matplotlib fontList.cache
"""
# Perform the usual install process
install.run(self)
# Try to install custom fonts
try:
import os, shutil
import matplotlib
import matplotlib.font_manager

# Find where matplotlib stores its True Type fonts
mpl_data_dir = os.path.dirname(matplotlib.matplotlib_fname())
mpl_ttf_dir = os.path.join(mpl_data_dir, "fonts", "ttf")
cp_ttf_dir = os.path.dirname(os.path.realpath(__file__))

file_names = [
"Times New Roman.ttf",
"Arial.ttf",
"Courier New.ttf",
"Courier New Bold.ttf",
"Arial Bold.ttf",
"Times New Roman Bold.ttf",
]
for file in file_names:
old_path = os.path.join(cp_ttf_dir, "fonts/" + file)
new_path = os.path.join(mpl_ttf_dir, file)
shutil.copyfile(old_path, new_path)
matplotlib.font_manager._rebuild()

except:
warnings.warn("WARNING: An issue occured while installing the fonts.")


with open("README.md") as f:
readme = f.read()

Expand All @@ -89,15 +51,25 @@ def run(self):
author="Erik Bergstrom",
author_email="[email protected]",
license="UCSD",
packages=["sigProfilerPlotting"],
packages=[
"sigProfilerPlotting",
"sigProfilerPlotting.reference_formats",
"sigProfilerPlotting.fonts",
],
install_requires=[
"matplotlib>=3.4.3",
"pandas>=1.2.4,<2.0.0",
"scikit-learn>=1.1.3",
"pillow>=10.0.0",
],
extras_require={
"tests": [
"pytest",
"scikit-image>=0.21.0",
"numpy>=1.21.2",
],
},
package_data={"": ["fonts/*.ttf"]},
include_package_data=True,
# Specify the custom install class
cmdclass={"install": move_ttf},
zip_safe=False,
)
File renamed without changes.
11 changes: 4 additions & 7 deletions plot_example.py → sigProfilerPlotting/examples/plot_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

import sigProfilerPlotting as sigPlt

matrix_path = "input/examples/samples/"
output_path = "output/examples/"
SPP_EXAMPLE_PATH = os.path.dirname(os.path.abspath(__file__))

matrix_path = os.path.join(SPP_EXAMPLE_PATH, "input/")
output_path = os.path.join(SPP_EXAMPLE_PATH, "output/")

# matrix_path = ''
# output_path = ''
if not os.path.exists(output_path):
os.makedirs(output_path)

Expand Down Expand Up @@ -39,6 +39,3 @@
percentage=False,
aggregate=False,
) # plotting of SV counts

# sigPlt.plotDBS(matrix_path + "breast_cancer_samples_example.DBS78.all", output_path, "BRCA_example", "78")
# sigPlt.plotID(matrix_path + "breast_cancer_samples_example.ID94.all", output_path, "BRCA_example", "94")
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 7bb8876

Please sign in to comment.