Skip to content

Commit

Permalink
Merge pull request #398 from Proteobench/proline-fix
Browse files Browse the repository at this point in the history
Proline fix
  • Loading branch information
RobbinBouwmeester authored Sep 6, 2024
2 parents 5cddb1e + 9cba91a commit fa89466
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 13 deletions.
10 changes: 5 additions & 5 deletions proteobench/github/gh.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,22 +72,22 @@ def create_branch(self, branch_name):
current_branch.checkout()
return current_branch

def commit(self, commit_message):
def commit(self, commit_name, commit_message):
# Stage all changes, commit, and push to the new branch
self.repo.git.add(A=True)
self.repo.index.commit(commit_message)
self.repo.index.commit("\n".join([commit_name, commit_message]))
self.repo.git.push("--set-upstream", "origin", self.repo.active_branch)

def create_pull_request(self, commit_message):
def create_pull_request(self, commit_name, commit_message):
# Create a pull request using PyGithub
g = Github(self.token)
repo = g.get_repo(self.proteobot_repo_name)
base = repo.get_branch("master")
head = f"{self.username}:{self.repo.active_branch.name}"

pr = repo.create_pull(
title=commit_message,
body="Pull request body",
title=commit_name,
body=commit_message,
base=base.name,
head=head,
)
Expand Down
2 changes: 1 addition & 1 deletion proteobench/io/params/proline.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def extract_params(fname) -> ProteoBenchParameters:
assert all(stats.loc["unique", cols] == 1), "Not all columns are unique"
sheet = sheet[cols].drop_duplicates().reset_index(drop=True)
# Extract
params.software_name = "Proline Studio"
params.software_name = "ProlineStudio"
params.search_engine = sheet.loc[0, "software_name"]
params.search_engine_version = sheet.loc[0, "software_version"]
params.enzyme = sheet.loc[0, "enzymes"]
Expand Down
31 changes: 27 additions & 4 deletions proteobench/modules/quant_base/quant_base_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,16 @@
)
from proteobench.github.gh import GithubProteobotRepo
from proteobench.io.params import ProteoBenchParameters
from proteobench.io.params.alphadia import extract_params as extract_params_alphadia
from proteobench.io.params.alphapept import extract_params as extract_params_alphapept
from proteobench.io.params.diann import extract_params as extract_params_diann
from proteobench.io.params.fragger import extract_params as extract_params_fragger
from proteobench.io.params.i2masschroq import (
extract_params as extract_params_i2masschroq,
)
from proteobench.io.params.maxquant import extract_params as extract_params_maxquant
from proteobench.io.params.proline import extract_params as extract_params_proline
from proteobench.io.params.sage import extract_params as extract_params_sage
from proteobench.io.parsing.parse_ion import load_input_file
from proteobench.io.parsing.parse_settings_ion import ParseSettingsBuilder
from proteobench.score.quant.quantscores import QuantScores
Expand Down Expand Up @@ -52,6 +62,18 @@ def __init__(self, token: str = None, proteobench_repo_name: str = "", proteobot

self.precursor_name = ""

EXTRACT_PARAMS_DICT = {
"MaxQuant": extract_params_maxquant,
"ProlineStudio": extract_params_proline,
"AlphaPept": extract_params_alphapept,
"Sage": extract_params_sage,
"FragPipe": extract_params_fragger,
"i2MassChroQ": extract_params_i2masschroq,
"DIA-NN": extract_params_diann,
"AlphaDIA": extract_params_alphadia,
# "Spectronaut": extract_params_spectronaut
}

def is_implemented(self) -> bool:
"""Returns whether the module is fully implemented."""
return True
Expand Down Expand Up @@ -267,12 +289,13 @@ def clone_pr(
all_datapoints.to_json(f, orient="records", indent=2)

f.close()
commit_message = f"Added new run with id {branch_name} \n user comments: {submission_comments}"
commit_name = f"Added new run with id {branch_name}"
commit_message = f"User comments: {submission_comments}"

try:
self.github_repo.create_branch(branch_name)
self.github_repo.commit(commit_message)
pr_id = self.github_repo.create_pull_request(commit_message)
self.github_repo.commit(commit_name, commit_message)
pr_id = self.github_repo.create_pull_request(commit_name, commit_message)
except Exception as e:
logging.error(f"Error in PR: {e}")
return "Unable to create PR. Please check the logs."
Expand Down Expand Up @@ -365,6 +388,6 @@ def load_params_file(self, input_file: list[str], input_format: str) -> ProteoBe

# ! adapted to be able to parse more than one file.
# ! how to ensure orrect order?
params = self.extract_params_dict[input_format](*input_file)
params = self.EXTRACT_PARAMS_DICT[input_format](*input_file)
params.software_name = input_format
return params
2 changes: 1 addition & 1 deletion test/params/ProlineStudio_withMBR.csv
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
,0
software_name,Proline Studio
software_name,ProlineStudio
software_version,
search_engine,Mascot
search_engine_version,2.8.3
Expand Down
2 changes: 1 addition & 1 deletion test/params/Proline_example_2.csv
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
,0
software_name,Proline Studio
software_name,ProlineStudio
software_version,
search_engine,XTandem
search_engine_version,X! Tandem Vengeance (2015.12.15.2)
Expand Down
2 changes: 1 addition & 1 deletion test/params/Proline_example_w_Mascot_wo_proteinSets.csv
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
,0
software_name,Proline Studio
software_name,ProlineStudio
software_version,
search_engine,Mascot
search_engine_version,2.8.0.1
Expand Down

0 comments on commit fa89466

Please sign in to comment.