Skip to content

Commit

Permalink
Merge pull request #146 from ypriverol/master
Browse files Browse the repository at this point in the history
Fixed some errors introduced before in #PR 44
  • Loading branch information
ypriverol committed Aug 15, 2023
2 parents adf9279 + accd8b9 commit f19d38c
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 10 deletions.
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ pandas_schema
pytest
requests
pyyaml
numpy
14 changes: 7 additions & 7 deletions sdrf_pipelines/maxquant/maxquant.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def guess_tmt(self, lt, label_list=None):
lt = lt + "TMT2plex-Lys" + i.replace("TMT", "") + ","
return lt

def extractTMT_info(self, label="TMT2", mods=None):
def extract_tmt_info(self, label="TMT2", mods=None):
lt = ""
label_list = sorted(label)
label_head = [re.search(r"TMT(\d+)plex-", i).group(1) for i in mods if "TMT" in i]
Expand Down Expand Up @@ -1350,7 +1350,7 @@ def maxquant_convert(
root.appendChild(intensityPredictionsFile)

minPepLen = doc.createElement("minPepLen")
if "min_peptide_length" in file2params and len(file2params["min_peptide_length"]) > 0::
if "min_peptide_length" in file2params and len(file2params["min_peptide_length"]) > 0:
tparam = file2params["min_peptide_length"]
first = list(tparam.values())[0]
minPepLen.appendChild(doc.createTextNode(first))
Expand All @@ -1368,7 +1368,7 @@ def maxquant_convert(
root.appendChild(psmFdrCrosslink)

peptideFdr = doc.createElement("peptideFdr")
if "ident_fdr_peptide" in file2params and len(file2params["ident_fdr_peptide"]) > 0::
if "ident_fdr_peptide" in file2params and len(file2params["ident_fdr_peptide"]) > 0:
tparam = file2params["ident_fdr_peptide"]
first = list(tparam.values())[0]
warning_message = "overwriting peptide FDR using the value in the sdrf file"
Expand All @@ -1382,7 +1382,7 @@ def maxquant_convert(
root.appendChild(peptideFdr)

proteinFdr = doc.createElement("proteinFdr")
if "ident_fdr_protein" in file2params and len(file2params["ident_fdr_protein"]) > 0::
if "ident_fdr_protein" in file2params and len(file2params["ident_fdr_protein"]) > 0:
tparam = file2params["ident_fdr_protein"]
first = list(tparam.values())[0]
warning_message = "overwriting protein FDR using the value in the sdrf file"
Expand All @@ -1396,7 +1396,7 @@ def maxquant_convert(
root.appendChild(proteinFdr)

siteFdr = doc.createElement("siteFdr")
if "ident_fdr_psm" in file2params and len(file2params["ident_fdr_psm"]) > 0::
if "ident_fdr_psm" in file2params and len(file2params["ident_fdr_psm"]) > 0:
tparam = file2params["ident_fdr_psm"]
first = list(tparam.values())[0]
warning_message = "overwriting PSM FDR using the value in the sdrf file"
Expand All @@ -1422,7 +1422,7 @@ def maxquant_convert(
root.appendChild(useNormRatiosForOccupancy)

minPeptides = doc.createElement("minPeptides")
if "min_num_peptides" in file2params and len(file2params["min_num_peptides"]) > 0::
if "min_num_peptides" in file2params and len(file2params["min_num_peptides"]) > 0:
tparam = file2params["min_num_peptides"]
first = list(tparam.values())[0]
minPeptides.appendChild(doc.createTextNode(first))
Expand Down Expand Up @@ -1504,7 +1504,7 @@ def maxquant_convert(
root.appendChild(compositionPrediction)

quantMode = doc.createElement("quantMode")
if "protein_inference" in file2params and len(file2params["protein_inference"]) > 0::
if "protein_inference" in file2params and len(file2params["protein_inference"]) > 0:
tparam = file2params["protein_inference"]
first = list(tparam.values())[0]
if first == "unique":
Expand Down
7 changes: 5 additions & 2 deletions sdrf_pipelines/openms/openms.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,10 +191,12 @@ def openms_convert(

# load sdrf file
sdrf = pd.read_table(sdrf_file)
null_cols = sdrf.columns[sdrf.isnull().any()]
if sdrf.isnull().values.any():
raise Exception(
"Encountered empty cells while reading SDRF."
" Please check your file, e.g. for too many column headers or empty fields"
"Please check your file, e.g. for too many column headers or empty fields"
"Columns with empty values: {}".format(list(null_cols))
)
sdrf = sdrf.astype(str)
sdrf.columns = map(str.lower, sdrf.columns) # convert column names to lower-case
Expand Down Expand Up @@ -968,7 +970,8 @@ def save_search_settings_to_file(self, output_filename, sdrf, f2c):
acquisition_method = "Data-Dependent Acquisition"
else:
acquisition_method = row["comment[proteomics data acquisition method]"]
acquisition_method = acquisition_method.split(";")[0].split("=")[1]
if len(acquisition_method.split(";")) > 1:
acquisition_method = acquisition_method.split(";")[0].split("=")[1]

if raw in raws:
continue
Expand Down
3 changes: 2 additions & 1 deletion sdrf_pipelines/parse_sdrf.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
@click.group(context_settings=CONTEXT_SETTINGS)
def cli():
"""
This is the main tool that gives access to all commands to convert SDRF files into pipelines specific configuration files
This is the main tool that gives access to all commands to convert SDRF files into pipelines specific configuration
files.
"""
pass

Expand Down

0 comments on commit f19d38c

Please sign in to comment.