-
Notifications
You must be signed in to change notification settings - Fork 0
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
Add a small system test for sage2lib #9
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,7 +24,11 @@ def read_peptides(peptides, qvalue): | |
polars.DataFrame | ||
The parsed and filtered peptides. | ||
""" | ||
peptide_df = pl.read_csv(peptides, separator="\t") | ||
try: | ||
peptide_df = pl.read_parquet(peptides) | ||
except pl.exceptions.ComputeError: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. R: Can we add a check of the error to make sure the compute error comes from the parsing and not anywhere else? |
||
peptide_df = pl.read_csv(peptides, separator="\t") | ||
|
||
peptide_df.columns = [c.lower() for c in peptide_df.columns] | ||
if "mokapot q-value" in peptide_df.columns: | ||
qval_col = "mokapot q-value" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
filename scannr peptide stripped_peptide proteins num_proteins rank is_decoy expmass calcmass charge peptide_len missed_cleavages isotope_error precursor_ppm fragment_ppm hyperscore delta_next delta_best rt aligned_rt predicted_rt delta_rt_model matched_peaks longest_b longest_y longest_y_pct matched_intensity_pct scored_candidates poisson sage_discriminant_score posterior_error spectrum_q peptide_q protein_q | ||
LQSRPAAPPAPGPGQLTLR.mzML controllerType=0 controllerNumber=1 scan=30069 LQSRPAAPPAPGPGQLTLR LQSRPAAPPAPGPGQLTLR sp|Q99536|VAT1_HUMAN 1 1 false 1926.0815 1926.08 3 19 0 0.0 0.8239083 0.503857 72.265915 72.265915 0.0 108.2854 0.993444 0.0 0.993444 22 9 12 0.6315789 64.770966 1 -1.9562812 1.2944585 1.0 1.0 1.0 1.0 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
"""Test building a dlib""" | ||
import sqlite3 | ||
import subprocess | ||
|
||
import pytest | ||
|
||
|
||
@pytest.mark.parametrize("ftype", ["parquet", "csv"]) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note: Since the whole XZ situation ive become a bit more paranoid ... we whould make a PR so the .parquet is generated from a .csv ... just to have no binaries in source control. |
||
def test_simpole_speclib_generation(data_path, tmp_path, ftype): | ||
"""Test spectral library generation""" | ||
psms = data_path / f"results.sage.{ftype}" | ||
mzml = data_path / "LQSRPAAPPAPGPGQLTLR.mzML" | ||
outfile = tmp_path / "results.sage.dlib" | ||
cmd = [ | ||
"petasus", | ||
"sage2lib", | ||
"--qvalue", | ||
"1", | ||
f"{psms}", | ||
f"{mzml}", | ||
] | ||
|
||
subprocess.run(cmd, check=True) | ||
|
||
con = sqlite3.Connection(str(outfile)) | ||
cur = con.cursor() | ||
res = cur.execute("select PeptideModSeq from entries;") | ||
res = [x[0] for x in res.fetchall()] | ||
assert len(res) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Request: Could we add an error/warning message saying the fallback is occurring?