Skip to content

Commit 2268404

Browse files
authored
Merge pull request #114 from apriha/hotfix/fix-ci-issues
Fix CI issues
2 parents e90058a + 6b3a697 commit 2268404

File tree

4 files changed

+24
-14
lines changed

4 files changed

+24
-14
lines changed

.github/workflows/deploy.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ jobs:
1313
runs-on: ubuntu-latest
1414

1515
steps:
16-
- uses: actions/checkout@v2
16+
- uses: actions/checkout@v4
1717
- name: Set up Python
18-
uses: actions/setup-python@v2
18+
uses: actions/setup-python@v5
1919
with:
2020
python-version: '3.x'
2121
- name: Install dependencies

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ Thanks to Whit Athey, Ryan Dale, Binh Bui, Jeff Gill, Gopal Vashishtha,
247247
`CS50 <https://cs50.harvard.edu>`_, and `openSNP <https://opensnp.org>`_.
248248

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

252252
.. https://github.com/rtfd/readthedocs.org/blob/master/docs/badges.rst
253253
.. |ci| image:: https://github.com/apriha/lineage/actions/workflows/ci.yml/badge.svg?branch=master

docs/conf.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#
2020
import os
2121
import sys
22+
from unittest.mock import MagicMock
2223

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

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

35+
36+
class Mock(MagicMock):
37+
@classmethod
38+
def __getattr__(cls, name):
39+
return MagicMock()
40+
41+
42+
# Apply the mock for each module
43+
for mod_name in autodoc_mock_imports:
44+
sys.modules[mod_name] = Mock()
45+
3446
import lineage
3547

3648
# https://samnicholls.net/2016/06/15/how-to-sphinx-readthedocs/

src/lineage/visualization.py

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@
7070

7171
matplotlib.use("Agg")
7272
from matplotlib import pyplot as plt
73-
from matplotlib.collections import BrokenBarHCollection
7473
from matplotlib import patches
7574

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

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

144144
# Axes tweaking
145145
ax.set_yticks([chrom_centers[i] for i in chromosome_list])
@@ -184,8 +184,8 @@ def plot_chromosomes(one_chrom_match, two_chrom_match, cytobands, path, title, b
184184
def _chromosome_collections(df, y_positions, height, **kwargs):
185185
"""
186186
187-
Yields BrokenBarHCollection of features that can be added to an Axes
188-
object.
187+
Yields data for features that can be added to an Axes
188+
object using ax.broken_barh.
189189
190190
Parameters
191191
----------
@@ -195,13 +195,12 @@ def _chromosome_collections(df, y_positions, height, **kwargs):
195195
column 'width', it will be calculated from start/end.
196196
197197
y_positions : dict
198-
Keys are chromosomes, values are y-value at which to anchor the
199-
BrokenBarHCollection
198+
Keys are chromosomes, values are y-value at which to anchor the bars
200199
201200
height : float
202-
Height of each BrokenBarHCollection
201+
Height of each bar
203202
204-
Additional kwargs are passed to BrokenBarHCollection
203+
Additional kwargs are passed to ax.broken_barh
205204
"""
206205
del_width = False
207206
if "width" not in df.columns:
@@ -210,9 +209,8 @@ def _chromosome_collections(df, y_positions, height, **kwargs):
210209
for chrom, group in df.groupby("chrom"):
211210
yrange = (y_positions["chr" + chrom], height)
212211
xranges = group[["start", "width"]].values
213-
yield BrokenBarHCollection(
214-
xranges, yrange, facecolors=group["colors"], **kwargs
215-
)
212+
colors = group["colors"].values
213+
yield xranges, yrange, colors
216214
if del_width:
217215
del df["width"]
218216

0 commit comments

Comments
 (0)