Skip to content

Commit

Permalink
Merge pull request #69 from MannLabs/development
Browse files Browse the repository at this point in the history
release 1.5.0
  • Loading branch information
GeorgWa authored Dec 11, 2023
2 parents 976f2cc + 73caf3b commit cae20d5
Show file tree
Hide file tree
Showing 35 changed files with 3,267 additions and 1,718 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/black.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Black linter

on:
pull_request:
paths:
- '**.py'

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}
token: ${{ secrets.GITHUB_TOKEN }}

- name: Install Black
run: pip install 'black[jupyter]==23.11.0'

- name: Run Black
id: black_check
run: |
black --check --verbose . || echo "CHANGES_NEEDED=true" >> $GITHUB_ENV
continue-on-error: true

- name: Apply Black reformatting
if: env.CHANGES_NEEDED=='true'
run: |
black .
git config --global user.name 'github-actions'
git config --global user.email '[email protected]'
git add -A
git diff --quiet && git diff --staged --quiet || (git commit -m "Apply Black formatting" && git push)
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion alphadia/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@


__project__ = "alphadia"
__version__ = "1.4.0"
__version__ = "1.5.0"
__license__ = "Apache"
__description__ = "An open-source Python package of the AlphaPept ecosystem"
__author__ = "Mann Labs"
Expand Down
20 changes: 19 additions & 1 deletion alphadia/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,23 @@
from alphadia.workflow import reporting
from alphadia import utils

from alphabase.constants import modification

modification.add_new_modifications(
{
"Dimethyl:d12@Protein N-term": {"composition": "H(-2)2H(8)13C(2)"},
"Dimethyl:d12@Any N-term": {
"composition": "H(-2)2H(8)13C(2)",
},
"Dimethyl:d12@R": {
"composition": "H(-2)2H(8)13C(2)",
},
"Dimethyl:d12@K": {
"composition": "H(-2)2H(8)13C(2)",
},
}
)

# alpha family imports

# third party imports
Expand Down Expand Up @@ -101,6 +118,7 @@ def gui():
"--config-update",
help="Dict which will be used to update the default config.",
type=str,
default={},
)
@click.option(
"--neptune-token",
Expand All @@ -124,7 +142,7 @@ def extract(**kwargs):
kwargs["neptune_tag"] = list(kwargs["neptune_tag"])

# load config file if specified
config_update = None
config_update = {}
if kwargs["config"] is not None:
with open(kwargs["config"], "r") as f:
config_update = yaml.safe_load(f)
Expand Down
8 changes: 5 additions & 3 deletions alphadia/fdr.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ def perform_fdr(
competetive: bool = False,
group_channels: bool = True,
figure_path: Optional[str] = None,
neptune_run=None,
):
"""Performs FDR calculation on a dataframe of PSMs
Expand Down Expand Up @@ -123,7 +124,7 @@ def perform_fdr(
classifier,
psm_df["qval"],
figure_path=figure_path,
# neptune_run=neptune_run
neptune_run=neptune_run,
)

return psm_df
Expand Down Expand Up @@ -339,6 +340,7 @@ def plot_fdr(
ax[0].set_ylabel("true positive rate")
ax[0].legend()

ax[1].set_xlim(0, 1)
ax[1].hist(
np.concatenate([y_test_proba[y_test == 0], y_train_proba[y_train == 0]]),
bins=50,
Expand Down Expand Up @@ -376,7 +378,7 @@ def plot_fdr(
if figure_path is not None:
fig.savefig(os.path.join(figure_path, "fdr.pdf"))

# if neptune_run is not None:
# neptune_run['eval/fdr'].log(fig)
if neptune_run is not None:
neptune_run["eval/fdr"].log(fig)

plt.close()
Loading

0 comments on commit cae20d5

Please sign in to comment.