Skip to content

Commit 5809075

Browse files
siebrenfJGASmits
andauthored
Develop (#212)
* update setup.py for v0.4.1 * regex * pin black & flake versions * whitelist & cleanup (#205) * influence whitelist & cleanup * fix: drop axis=1 * fix pyarrow Exception in ANANSE network * Update setup.py * Update CHANGELOG.md * Update README.md (#203) (#206) * Update README.md Added text regarding the scANANSE publication & links --------- Co-authored-by: Jos Smits <J.Smits@science.ru.nl> * updated changelog for v0.5 * fix Unable to determine Axes to steal space for Colorbar * fix ANANSE influence whitelists * deprecationWarning pd.iloc[] * update installation process (#213) --------- Co-authored-by: Jos Smits <J.Smits@science.ru.nl>
1 parent e256350 commit 5809075

9 files changed

Lines changed: 26 additions & 24 deletions

File tree

.github/workflows/continuousintegration.yml

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,10 @@ on:
1010

1111
jobs:
1212
test:
13-
runs-on: ubuntu-latest # ${{ matrix.os }}
13+
runs-on: ubuntu-latest
1414
defaults:
1515
run:
1616
shell: bash -l {0}
17-
# strategy:
18-
# matrix:
19-
# python-version: [3.8]
20-
# os: [ubuntu-latest] # [ubuntu-latest, macos-latest]
21-
# fail-fast: false
2217

2318
env:
2419
TARGETS: "setup.py ananse/ tests/"
@@ -28,11 +23,11 @@ jobs:
2823
uses: actions/checkout@v2
2924

3025
- name: Install dependencies 🔨
31-
uses: conda-incubator/setup-miniconda@v2
26+
uses: conda-incubator/setup-miniconda@v3
3227
with:
33-
# python-version: ${{ matrix.python-version }}
34-
mamba-version: "*"
35-
channels: conda-forge,bioconda,defaults
28+
miniforge-version: latest
29+
use-mamba: true
30+
channels: conda-forge,bioconda
3631
channel-priority: true
3732
activate-environment: ananse
3833
environment-file: requirements.yaml
@@ -51,7 +46,7 @@ jobs:
5146
--cov=./ --cov-report=xml
5247
5348
- name: Upload code coverage ☂️
54-
uses: paambaati/codeclimate-action@v3.0.0
49+
uses: paambaati/codeclimate-action@v5
5550
# if: github.repository_owner == 'vanheeringen-lab'
5651
env:
5752
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
66

77
## [Unreleased]
88

9+
### Fixed
10+
- ANANSE influence (with whitelists) AttributeError: 'numpy.ndarray' object has no attribute 'index'
11+
- ANANSE plot ValueError: Unable to determine Axes to steal space for Colorbar.
12+
- ANANSE network pandas.iloc[] deprecationWarning
13+
914
## [0.5.0] - 2023-10-15
1015

1116
### Added

ananse/influence.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,8 @@ def _filter_network_edges(df, sort_by: str, n_edges: int, whitelist: tuple = Non
188188
df = df.sort_values(sort_by).tail(n_edges)
189189
else:
190190
df.sort_values(sort_by, inplace=True)
191-
tfs = set(df.index.str.startswith(whitelist).index)
192-
targets = set(df.index.str.endswith(whitelist).index)
191+
tfs = set(df[df.index.str.startswith(whitelist)].index)
192+
targets = set(df[df.index.str.endswith(whitelist)].index)
193193
tail = set(df.tail(n_edges).index)
194194
df = df[df.index.isin(tfs | targets | tail)]
195195
return df

ananse/network.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,11 @@ def _load_pyranges(self, up=1e5, down=1e5):
7676
"""
7777
genes = pr.read_bed(self.gene_bed)
7878
genes.columns = [col.capitalize() for col in genes.columns]
79-
# Convert to DataFrame & we don't need intron/exon information
80-
genes = genes.as_df().iloc[:, :6]
79+
# Convert to DataFrame
80+
genes = genes.as_df()
81+
82+
# Drop intron/exon information
83+
genes = genes[genes.columns[:6]]
8184

8285
# Drop genes found on >1 contig
8386
genes = genes.drop_duplicates(subset=["Name"], keep=False)

ananse/peakpredictor.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1142,7 +1142,9 @@ def predict_peaks(
11421142
proba = p.predict_proba(factor, jaccard_cutoff=jaccard_cutoff)
11431143
hdf.put(
11441144
key=factor,
1145-
value=proba.iloc[:, -1].reset_index(drop=True).astype(np.float16),
1145+
value=proba[proba.columns[-1]]
1146+
.reset_index(drop=True)
1147+
.astype(np.float16),
11461148
format="table",
11471149
)
11481150
except ValueError as e:

ananse/plot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ def plot_grn(
186186
)
187187
# plot the node colour legend:
188188
sm = plt.cm.ScalarMappable(cmap=cmap, norm=plt.Normalize(vmin=vmin, vmax=vmax))
189-
cbar = plt.colorbar(sm)
189+
cbar = plt.colorbar(sm, ax=plt.gca())
190190
cbar.ax.set_ylabel("outdegree (regulation other TFs)", rotation=270, labelpad=25)
191191
# plot the TF-TF edges:
192192
nx.draw_networkx_edges(

ananse/utils.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -158,19 +158,18 @@ def parse_regions(regionfiles, *args, **kwargs):
158158
if bool(re.match(r"^.*:\d+-\d+$", test)):
159159
# it's a regions list
160160
# or it's a Seq2science counts table
161-
regions = df.iloc[:, 0].tolist()
161+
regions = df[df.columns[0]].astype(str).tolist()
162162

163163
elif df.shape[1] >= 3:
164164
# it's a BED file
165165
regions = (
166166
# For Ensembl genome names, make sure it's a string
167-
df.iloc[:, 0].astype(str)
167+
df[df.columns[0]].astype(str)
168168
+ ":"
169-
+ df.iloc[:, 1].astype(str)
169+
+ df[df.columns[1]].astype(str)
170170
+ "-"
171-
+ df.iloc[:, 2].astype(str)
171+
+ df[df.columns[2]].astype(str)
172172
).tolist()
173-
174173
else:
175174
raise TypeError("Cannot identify regions file(s) type.")
176175

docs/installation.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ Activate the [bioconda](https://bioconda.github.io/) channel if you haven't used
1111
You only have to do this once.
1212

1313
``` bash
14-
$ conda config --add channels defaults
1514
$ conda config --add channels bioconda
1615
$ conda config --add channels conda-forge
1716
```

requirements.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ name: ananse
22
channels:
33
- conda-forge
44
- bioconda
5-
- defaults
65
dependencies:
76
- python >=3.7
87
- adjusttext

0 commit comments

Comments
 (0)