Package: hplc-data-analysis
hplc_data_analysisA Python tool to manage multiple HPLC qualitative tables and automatically split chemicals into functional groups.An open-source Python tool that can automatically:handle multiple HPLC semi-quantitative data tables (obtained with different methods)duild a database of all identified compounds and their relevant properties using PubChemPysplit each compound into its functional groups using a published fragmentation algorithmproduce single file report, single replicate (intended as the sum of more methods applied to one vial), comprehensive multi-sample (average and deviation of replicates) reports and aggregated reports based on functional group mass fractions in the samplesprovides plotting capabilitiesNaming convention for samplesTo ensure the code handles replicates of the same sample correctly, names have to follow the convention:method_name-of-sample-with-dashes-only_replicatenumber(for now, method can either be 210 or 254, as the wavelenght analyzed using a UVvis detectorExamples that arecorrectlyhandled:210_Bio-oil-foodwaste-250C_1254_Bio-oil-foodwaste-250C_1210_FW_2254_FW_2Examples ofNON-ACCEPTABLEnames are210-bio_oil_1254-FW1ExampleA comprehensive example is provided on the GitHub repository to show how inputs should be formatted.
To test the module, install thehplc_data_analysismodule, download the example folder given in the repository, and run the example_hplc_data_analysis.py. The folder_path needs to be set to where your data folder is.The example code is shown here for convenience:# example of hplc_data_analysisimportpathlibasplibfromhplc_data_analysisimportProject# this has to be changed to where the _example/data folder isfolder_path=plib.Path(plib.Path.cwd().parent,'example/data')# folder_path = plib.Path(plib.Path(__file__).cwd(), 'data')# change this to folder_path = plib.Path(r"C:\Path\To\Your\Data") for your project# class methods need to be called at the beginning to influence all instancesProject.set_folder_path(folder_path)Project.set_plot_grid(False)Project.set_plot_font('Sans')# ('Times New Roman')p=Project(rebuild_compounds_properties=False)# %%# p.create_compounds_properties()# get files, replicates, and samples infofiles_info=p.files_inforeplicates_info=p.replicates_infosamples_info=p.samples_info# create files, replicates and samples dfsp.create_files_replicates_samples()#%%# example of fileFWCP250C1h1_1_210=p.files['210_FWCP250C1h1_1']# examples of replicates (merged files with diff. methods)FWCP250C1h1_1=p.replicates['FWCP250C1h1_1']FWCP250C1h1_2=p.replicates['FWCP250C1h1_2']# examples of samples (average of replicates)FWCP250C1h1=p.samples['FWCP250C1h1']FWCP250C1h1_std=p.samples_std['FWCP250C1h1']# add all statistics to info dfsp.update_all_info_statistics()# create report and aggrreports for different parameters# for files, replicates and samplesfiles_report_conc=\p.create_files_param_report(param='conc_vial_if_undiluted_mg_L')replicates_report_conc=\p.create_replicates_param_report(param='conc_vial_if_undiluted_mg_L')replicates_report_fr=\p.create_replicates_param_report(param='fraction_of_sample_fr')replicates_aggrrep_fr=\p.create_replicates_param_aggrrep(param='fraction_of_sample_fr')samples_report_fr,samples_report_fr_std=\p.create_samples_param_report(param='fraction_of_sample_fr')samples_aggrrep_fr,samples_report_fr_std=\p.create_samples_param_aggrrep(param='fraction_of_sample_fr')p.save_files_info()p.save_replicates_info()p.save_samples_param_report()p.save_samples_param_aggrrep()# %%p.plot_ave_std(param='conc_vial_mg_L',aggr=True,min_y_thresh=0,y_lim=[0,50000],legend_location='outside',color_palette='Set2')# %%p.plot_ave_std(param='conc_vial_if_undiluted_mg_L',replicates_or_samples='replicates',min_y_thresh=0,legend_location='outside',xlab_rot=20,# only_samples_to_plot=['FW250C1h1', 'FWCP250C1h1'],y_lim=[0,50000],annotate_outliers=True)# %%p.plot_ave_std(replicates_or_samples='samples',param='fraction_of_sample_fr',aggr=True,min_y_thresh=2000,legend_location='outside',xlab_rot=20,# only_samples_to_plot=['FW250C1h1', 'FWCP250C1h1'],y_lim=[0,50000],annotate_outliers=True)