Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix CI issues #114

Merged
merged 4 commits into from
Jul 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install dependencies
Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ Thanks to Whit Athey, Ryan Dale, Binh Bui, Jeff Gill, Gopal Vashishtha,
`CS50 <https://cs50.harvard.edu>`_, and `openSNP <https://opensnp.org>`_.

``lineage`` incorporates code and concepts generated with the assistance of
`OpenAI's <https://openai.com>`_ `ChatGPT <https://chat.openai.com>`_ (GPT-3.5). ✨
`OpenAI's <https://openai.com>`_ `ChatGPT <https://chatgpt.com>`_ . ✨

.. https://github.com/rtfd/readthedocs.org/blob/master/docs/badges.rst
.. |ci| image:: https://github.com/apriha/lineage/actions/workflows/ci.yml/badge.svg?branch=master
Expand Down
12 changes: 12 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#
import os
import sys
from unittest.mock import MagicMock

# http://docs.readthedocs.io/en/latest/faq.html#i-get-import-errors-on-libraries-that-depend-on-c-modules
autodoc_mock_imports = [
Expand All @@ -31,6 +32,17 @@

sys.path.insert(0, os.path.abspath("../"))


class Mock(MagicMock):
@classmethod
def __getattr__(cls, name):
return MagicMock()


# Apply the mock for each module
for mod_name in autodoc_mock_imports:
sys.modules[mod_name] = Mock()

import lineage

# https://samnicholls.net/2016/06/15/how-to-sphinx-readthedocs/
Expand Down
20 changes: 9 additions & 11 deletions src/lineage/visualization.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@

matplotlib.use("Agg")
from matplotlib import pyplot as plt
from matplotlib.collections import BrokenBarHCollection
from matplotlib import patches

logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -139,7 +138,8 @@ def plot_chromosomes(one_chrom_match, two_chrom_match, cytobands, path, title, b

# Now all we have to do is call our function for the chromosome data...
for collection in _chromosome_collections(df, chrom_ybase, chrom_height):
ax.add_collection(collection)
xranges, yrange, colors = collection
ax.broken_barh(xranges, yrange, facecolors=colors)

# Axes tweaking
ax.set_yticks([chrom_centers[i] for i in chromosome_list])
Expand Down Expand Up @@ -184,8 +184,8 @@ def plot_chromosomes(one_chrom_match, two_chrom_match, cytobands, path, title, b
def _chromosome_collections(df, y_positions, height, **kwargs):
"""

Yields BrokenBarHCollection of features that can be added to an Axes
object.
Yields data for features that can be added to an Axes
object using ax.broken_barh.

Parameters
----------
Expand All @@ -195,13 +195,12 @@ def _chromosome_collections(df, y_positions, height, **kwargs):
column 'width', it will be calculated from start/end.

y_positions : dict
Keys are chromosomes, values are y-value at which to anchor the
BrokenBarHCollection
Keys are chromosomes, values are y-value at which to anchor the bars

height : float
Height of each BrokenBarHCollection
Height of each bar

Additional kwargs are passed to BrokenBarHCollection
Additional kwargs are passed to ax.broken_barh
"""
del_width = False
if "width" not in df.columns:
Expand All @@ -210,9 +209,8 @@ def _chromosome_collections(df, y_positions, height, **kwargs):
for chrom, group in df.groupby("chrom"):
yrange = (y_positions["chr" + chrom], height)
xranges = group[["start", "width"]].values
yield BrokenBarHCollection(
xranges, yrange, facecolors=group["colors"], **kwargs
)
colors = group["colors"].values
yield xranges, yrange, colors
if del_width:
del df["width"]

Expand Down