|
22 | 22 | from corems.transient.input.brukerSolarix import ReadBrukerSolarix |
23 | 23 | from corems.encapsulation.output import parameter_to_dict |
24 | 24 | import matplotlib as mpl |
| 25 | +mpl.use("TkAgg") |
25 | 26 | from matplotlib import pyplot as plt |
26 | 27 | from matplotlib import gridspec as gridspec |
27 | 28 | from tqdm import tqdm |
@@ -268,11 +269,14 @@ def create_plots(mass_spectrum, workflow_params, dirloc): |
268 | 269 |
|
269 | 270 | # Create QC plots |
270 | 271 | if workflow_params.plot_qc: |
271 | | - ms_df = mass_spectrum.to_dataframe() |
272 | | - qc_fig, qc_axes = create_qc_figure(mass_spectrum, ms_df, title=mass_spectrum.sample_name, hspace=0.25, wspace=0.35) |
273 | | - qc_fig.savefig(qc_plot_dirloc / "{}_qc.png".format(mass_spectrum.sample_name), dpi=100, bbox_inches='tight') |
274 | | - plt.close(qc_fig) |
275 | | - plt.close('all') |
| 272 | + if workflow_params.calibrate: |
| 273 | + ms_df = mass_spectrum.to_dataframe() |
| 274 | + qc_fig, qc_axes = create_qc_figure(mass_spectrum, ms_df, title=mass_spectrum.sample_name, hspace=0.25, wspace=0.35) |
| 275 | + qc_fig.savefig(qc_plot_dirloc / "{}_qc.png".format(mass_spectrum.sample_name), dpi=100, bbox_inches='tight') |
| 276 | + plt.close(qc_fig) |
| 277 | + plt.close('all') |
| 278 | + else: |
| 279 | + "QC plots rely on calibrated data, either enable calibration or disable QC plotting" |
276 | 280 |
|
277 | 281 |
|
278 | 282 | def create_qc_figure(msobj, msdf, title='QC Plot', figsize=(24, 10), nrows=2, ncols=4, hspace=0.22, wspace=0.22): |
@@ -479,7 +483,7 @@ def find_calibration_for_batch(workflow_params): |
479 | 483 | srfa_path = srfa_path[0] |
480 | 484 |
|
481 | 485 | # Remove the SRFA file you used from the file list so it's not in the output |
482 | | - workflow_params.file_paths.remove(srfa_path) |
| 486 | + #workflow_params.file_paths.remove(srfa_path) |
483 | 487 |
|
484 | 488 | # Determine data file type and read in the mass spectrum |
485 | 489 | mass_spectrum = read_fticr_raw_data(srfa_path, workflow_params) |
@@ -508,7 +512,10 @@ def find_calibration_for_batch(workflow_params): |
508 | 512 | mass_spectrum_by_classes = HeteroatomsClassification( |
509 | 513 | mass_spectrum, choose_molecular_formula=False |
510 | 514 | ) |
511 | | - mass_spectrum_by_classes.plot_mz_error() |
| 515 | + mzplot = mass_spectrum_by_classes.plot_mz_error() |
| 516 | + # scatter_plot = mzplot.collections[0] |
| 517 | + # scatter_plot.set_sizes([1]) |
| 518 | + # plt.show() |
512 | 519 | mz_error = mass_spectrum_by_classes.mz_error_all() |
513 | 520 |
|
514 | 521 | # Get 5th and 95th percentile of error to use as search error max/min |
|
0 commit comments