Package: breathpy
BreathPyA python library for breath gas biomarker profilingInstallationBreathPydepends onpython >=3.6, but doesnot yetsupportpython==3.9, as several dependencies are not yet available for python 3.9. It is available throughpip. Make sure to activate your local virtual environment or use anaconda. To render decision trees we depend on thegraphvizexecutable. Either install into your current environment usingpip install breathpyor create, activate a new anaconda environment "breath" and installbreathpyandgraphviz:condacreate--namebreathpython=3.8pipgraphviz-y
condaactivatebreath
pipinstallbreathpyIf you want to use the tutorial jupyter notebooks - you also need to install jupyterconda install jupyter.Usage MCC-IMSFirst prepare the example dataset by creating a subdirectorydataand then linking the example files there.frompathlibimportPathfromurllib.requestimporturlretrievefromzipfileimportZipFile# download example zip-archiveurl='https://github.com/philmaweb/BreathAnalysis.github.io/raw/master/data/small_candy_anon.zip'zip_dst=Path("data/small_candy_anon.zip")dst_dir=Path("data/small_candy_anon/")dst_dir.mkdir(parents=True,exist_ok=True)urlretrieve(url,zip_dst)# unzip archive into data subdirectorywithZipFile(zip_dst,"r")asarchive_handle:archive_handle.extractall(Path(dst_dir))Then run the example analysis like so:# import required functionsfrombreathpy.model.BreathCoreimportconstruct_default_parameters,construct_default_processing_evaluation_stepsfrombreathpy.model.CoreTestimportrun_start_to_end_pipeline# define file prefix and default parametersfile_prefix=folder_name='small_candy_anon'# assuming the data directory is in the current directoryplot_parameters,file_parameters=construct_default_parameters(file_prefix,folder_name,make_plots=True)# create default parameters for preprocessing and evaluationpreprocessing_steps,evaluation_params_dict=construct_default_processing_evaluation_steps()# call startrun_start_to_end_pipeline(plot_parameters,file_parameters,preprocessing_steps,evaluation_params_dict)For more complete examples seehttps://github.com/philmaweb/breathpy/blob/master/breathpy/tutorial/binary_candy.ipynb,https://github.com/philmaweb/breathpy/blob/master/breathpy/tutorial/multiclass_mouthwash.ipynb' or 'CoreTest.run_start_to_end_pipelineandCoreTest.run_resume_analysis.
Example data is available athttps://github.com/philmaweb/BreathAnalysis.github.io/tree/master/data.Usage GC-MSNow with experimental support for GC/MS + LC/MS data through pyOpenMSDownload and extract the example datasets into the current data subdirectory:# handle importsfromurllib.requestimporturlretrievefrompathlibimportPathfromzipfileimportZipFile# download and extract data into data/algae directoryurl='https://github.com/philmaweb/BreathAnalysis.github.io/raw/master/data/algae.zip'zip_dst=Path("data/algae.zip")dst_dir=Path("data/algae/")dst_dir.mkdir(parents=True,exist_ok=True)urlretrieve(url,zip_dst)# unzip archive into data subdirectorywithZipFile(zip_dst,"r")asarchive_handle:archive_handle.extractall(Path(dst_dir))importosfrompathlibimportPathfrombreathpy.model.BreathCoreimportconstruct_default_parameters,construct_default_processing_evaluation_stepsfrombreathpy.model.ProcessingMethodsimportGCMSPeakDetectionMethod,PerformanceMeasurefrombreathpy.model.GCMSTestimportrun_gcms_platform_multicorefrombreathpy.generate_sample_dataimportgenerate_train_test_set_helper"""Runs analysis of the algae sample set (Sun M, Yang Z and Wawrik B (2018) Metabolomic Fingerprintsof Individual Algal Cells Using the Single-Probe Mass Spectrometry Technique.Front. Plant Sci. 9:571. doi: 10.3389/fpls.2018.00571)19 samples from four conditions - light, dark, nitrogen-limited and replete (post nitrogen-limited)Samples originated from single-probe mass spectrometry files - we import created featureXML files.:param cross_val_num::return:"""cross_val_num=3# or use your local path to a dataset heresource_dir=Path("data/algae")target_dir=Path("data")# will delete previous split and rewrite datatrain_df,test_df=generate_train_test_set_helper(source_dir,target_dir,cross_val_num=cross_val_num)train_dir=Path(target_dir)/"train_algae"# prepare analysisset_name="train_algae"make_plots=True# generate parametersplot_parameters,file_parameters=construct_default_parameters(set_name,set_name,make_plots=make_plots)preprocessing_params_dict={GCMSPeakDetectionMethod.ISOTOPEWAVELET:{"hr_data":True}}_,evaluation_params_dict=construct_default_processing_evaluation_steps(cross_val_num)# running the full analysis takes less than 30 minutes of computation time using 6 cores - in this example most if not all computations are single core thoughrun_gcms_platform_multicore(sample_dir=train_dir,preprocessing_params=preprocessing_params_dict,evaluation_parms=evaluation_params_dict,num_cores=6)Also seemodel/GCMSTest.pyfor reference.LicenseBreathPyis licensed under GPLv3, but contains binaries for PEAX, which is a free software for academic use only.
SeeA modular computational framework for automated peak extraction from ion mobility spectra, 2014, D’Addarioet. alContactIf you run into difficulties usingBreathPy, please open an issue at ourGitHubrepository. Alternatively you can write an email toPhilipp Weber.