Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

major changes in mztab for large datasets #43

Merged
merged 4 commits into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion quantmsutils/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.0.17"
__version__ = "0.0.18"
23 changes: 13 additions & 10 deletions quantmsutils/diann/diann2mztab.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
@click.option("--charge", "-c")
@click.option("--missed_cleavages", "-m")
@click.option("--qvalue_threshold", "-q", type=float)
@click.option("--enable_diann2mztab", "-e", is_flag=True)
@click.pass_context
def diann2mztab(
ctx,
Expand All @@ -55,6 +56,7 @@ def diann2mztab(
charge,
missed_cleavages,
qvalue_threshold,
enable_diann2mztab
):
"""
Convert DIA-NN output to MSstats, Triqler or mzTab.
Expand Down Expand Up @@ -177,16 +179,17 @@ def diann2mztab(
logger.info(f"Triqler input file is saved as {exp_out_prefix}_triqler_in.tsv")
del out_triqler

mztab_out = f"{Path(exp_design).stem}_out.mzTab"
# Convert to mzTab
diann_directory.convert_to_mztab(
report=report,
f_table=f_table,
charge=charge,
missed_cleavages=missed_cleavages,
dia_params=dia_params,
out=mztab_out,
)
if enable_diann2mztab:
mztab_out = f"{Path(exp_design).stem}_out.mzTab"
# Convert to mzTab
diann_directory.convert_to_mztab(
report=report,
f_table=f_table,
charge=charge,
missed_cleavages=missed_cleavages,
dia_params=dia_params,
out=mztab_out,
Comment on lines +185 to +191
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Improve error handling in convert_to_mztab

The function should handle potential errors during file operations and data processing.

 diann_directory.convert_to_mztab(
     report=report,
     f_table=f_table,
     charge=charge,
     missed_cleavages=missed_cleavages,
     dia_params=dia_params,
     out=mztab_out,
+    try:
+        diann_directory.convert_to_mztab(
+            report=report,
+            f_table=f_table,
+            charge=charge,
+            missed_cleavages=missed_cleavages,
+            dia_params=dia_params,
+            out=mztab_out,
+        )
+    except Exception as e:
+        logger.error(f"Failed to convert to mzTab format: {str(e)}")
+        raise

Committable suggestion skipped: line range outside the PR's diff.

)


def _true_stem(x):
Expand Down
Loading