Skip to content

Releases: BHM-Bob/BA_PY

v0.10.5

12 Jan 12:58
Compare
Choose a tag to compare

2025-01-12 20:45:13

Focus on

  1. add more control for plotting in HPLC and Mass
  2. add more functionality and fix bugs in dl_torch

What's New

  • addon: mbapy\web_utils\request.py: Browser: add wait_text method to Browser class
  • addon: mbapy\sci_instrument\hplc: add plot_params attribute and plot control
  • addon: mbapy\sci_instrument\mass: add min_tag_lim parameter for peak tag filtering

Minor Addon

  • minor-addon: mbapy\file.py: filetype2opts: add support for csv and excel file types
  • minor-addon: mbapy\file.py: opts_file: support tar file processing
  • minor-addon: My_Progs/BA_PY/mbapy/dl_torch/utils.py: save_checkpoint: add return value to save_checkpoint function
  • minor-addon: dl_torch/bb.py: add attention return option for MultiHeadAttentionLayer and related modules

BUG-FIX

  • fix-bug: mbapy/sci_instrument/hplc/_base.py: HplcData: calcu_single_peak_area: correct keyword for simpson integration
  • fix-bug: mbapy\scripts\hplc.py: explore-hplc: make_fig: add file_labels and peak_labels check if there are None
  • fix-bug: mbapy\web_utils\request.py: Browser: send_key: correct method call for sending keys in Browser class
  • fix-bug: mbapy\dl_torch\data.py: DataSetRAM: update dataset initialization

CODE-FIX

  • fix-code: mbapy\sci_instrument\hplc_base.py: fix scipy.integrate.simps import err
  • fix-code: mbapy\sci_instrument\mass_base.py: MassData: update ESI_IRON_MODE with precise ion masses
  • fix-code: mbapy\sci_instrument\mass_utils.py: _plot_tag_by_match_df: handle marker shortage for mass peaks

Remove

None or a little.

Other Changes

None or a little.

mbapy_lite

update to ee5e584

v0.10.2

30 Nov 13:01
Compare
Choose a tag to compare

2024-11-30 20:55:04

Focus on

  1. fix bugs

What's New

None or a little.

Minor Addon

  • minor-addon: mbapy\stats_init_.py: add normalization option to pca function
    Added 'norm' parameter to pca function for data normalization
    Implemented StandardScaler for normalization when norm=True
    Updated function signature to include norm parameter and return type
    Added docstring to explain function behavior
  • minor-addon: enhance PCA functionality and flexibility
    Rename parameter 'norm' to 'scale' for better clarity
    Add 'return_model' option to allow returning PCA model
    Update function documentation for improved understanding
    Refactor code to make it more maintainable
    minor-addon: mbapy\base.py: add exit option to put_err function
    Add _exit parameter to put_err function in both mbapy/base.py and mbapy_lite/base.py
    If _exit is True or an integer, the program will exit after printing the error message
    This feature allows for more flexible error handling in different environments

BUG-FIX

  • fix-bug: mbapy\file.py: opts_file: when way is pkl and data is None, opts_file read and write None now
  • fix-bug: mbapy\stats\test.py: auto_ind_test: fix fac_name generation, avoid using df first two sub-factors only
  • fix-bug: mbapy\plot.py: adjust_cmap_midpoint: fix step=0 err when max_len < min_len
  • fix-bug: mbapy\plot.py: adjust_cmap_midpoint: apply scale to value beforing compare to avoid vmax is 0.1 to trigger vmax <= v0 error
  • fix-bug: mbapy\plot.py: adjust_cmap_midpoint: Fix scale application for v0 in adjust_cmap_midpoint function in plot

CODE-FIX

  • fix-code: mbapy\scripts\hplc.py: explore_hplc: Update file legend bounding box
  • fix-code: mbapy\scripts\hplc.py: explore_hplc: make_pda_heatmap: disable this function

Remove

None or a little.

Other Changes

  • update min python_requires from 3.7 to 3.8 #8698f89b011bca315a0d3e68402ca80007da8bbf

mbapy_lite

v0.10.1

05 Nov 14:09
Compare
Choose a tag to compare

2024-11-05 21:57:11

Focus on

  1. add sci_instrument: WatersPDA: plot functionality.
  2. fix stats: cluster: Kmeans, add more data shape support

What's New

  • addon: mbapy\sci_instrument\hplc_utils.py: add plot_pda_heatmap
  • addon: mbapy\scripts\hplc.py: add plot_pda as a new sub command

Minor Addon

  • minor-addon: mbapy\sci_instrument\hplc_utils.py: plot_pda_heatmap: Add parameters colormap and tick labels plot_pda_heatmap, update the documentation to. Also, the function returns the object.
  • minor-addon: mbapy\sci_instrument\hplc_utils.py: plot_pda_heatmap: add return value for ax_topx
  • minor-addon: mbapy\scripts\hplc.py: explore_hplc: add pda heatmap fig panel

BUG-FIX

  • fix-bug: mbapy\sci_instrument\hplc_utils.py: plot_pda_heatmap: df.set_index use hplc_data not data now
  • fix-bug: mbapy\sci_instrument\hplc_utils.py: plot_pda_heatmap: make sure top-x and bottom x axis has same ticks now
  • fix-bug: mbapy\scripts\hplc.py: explore_hplc: add title

CODE-FIX

  • fix-code: mbapy\sci_instrument\hplc\waters.py: WatersData: make_tag: add exist check for tag name
  • fix-code: mbapy\stats\cluster.py: move KMeans.BackEnd to KMeansBackend
  • fix-code: mbapy\stats\cluster.py: KMeans: add suport for data more than 2 dimensions

Remove

None or a little.

Other Changes

  • build: update setup.py for python version compatibility
    Remove support for Python 3.7 due to matplotlib version requirements
    Update last edited time to 2024-10-19

mbapy_lite

Full Changelog: v0.10.0...v0.10.1

v0.10.0

17 Oct 09:02
Compare
Choose a tag to compare

2024/10/14 17:22:31

Focus on

  1. add mbapy_lite as anthor main package for quick access

What's New

  • addon: add mbapy_lite as anthor main package for quick access

Minor Addon

None or a little.

BUG-FIX

None or a little.

CODE-FIX

None or a little.

Remove

None or a little.

Other Changes

None or a little.

v0.9.1

31 Aug 00:54
Compare
Choose a tag to compare

2024/8/31 08:51:09

Focus on

  1. Fix bugs in mass script and requiremnts in 0.9.0

What's New

None or a little.

Minor Addon

  • minor-addon: mbapy\scripts\mass.py: plot_mass: process_args: suport labels as text file path

BUG-FIX

  • fix-bug: mbapy\scripts\mass.py: plot_mass: main_process: type-error: self.args.tag_monoisotopic_only instead of self.tag_monoisotopic_only

CODE-FIX

None or a little.

Remove

None or a little.

Other Changes

  • add deprecated package to std

Details

完整的更新日志: https://gitee.com/bhm-bob/BA_PY/commits/v0.9.1

v0.9.0

29 Aug 14:23
Compare
Choose a tag to compare

2024/8/29 21:51:09

Focus on

  1. Fix bugs in scripts
  2. Add more class and function in HPLC and Mass Spectrum
  3. other fix

What's New

  • addon(mbapy/scripts): add 'find-file' script
    A new script named 'find-file' has been added to the mbapy-cli.
    This script is designed to find files with specific suffixes or substrings in their
    names, utilizing the argparse library for command-line argument parsing.
  • addon: mbapy\sci_instrument\hplc\waters.py: add WatersPdaData class
  • addon: mbapy\scripts\hplc.py: add extract_pda

Minor Addon

  • feat(mbapy/file): add search_name_in_dir option to get_paths_with_extension
    Introduce a new optional parameter search_name_in_dir in the
    get_paths_with_extension function to allow users to specify whether
    file names should be searched within directories. This enhancement
    increases the flexibility and usability of the function for cases
    where directory names contain the desired search string.
  • feat(mbapy/scripts): add include_dir_name option and refine file move logic
    Introduce an additional argument '--include-dir-name' in the move_file script
    to allow the inclusion of directory names in the search process. This
    enhances the functionality of the script, providing more flexibility in file
    searching and moving operations.
    Refactor the file moving logic to gracefully handle permission issues on
    Windows and Linux systems, ensuring smoother operation across different
    platforms.
  • feat(mbapy): add get_dir function and update all
    Implement a new function get_dir in the mbapy/file.py module. This function
    allows for filtering directories based on various criteria such as minimum and
    maximum item numbers, file extensions, and directory/sub-item name substrings.
    The implementation enhances the module's capabilities in directory scanning and
    filtering.
    Additionally, update the __all__ list to include the newly added function,
    ensuring that it is documented and accessible to users of the module.
  • feat(scripts/main.py): add version and help print functions
  • refactor(utils): move seed setting into separate function for reuse
    By extracting the random seed setting logic into its own function,
    we improve code modularity and enable easier reuse of this functionality
    across different parts of the application. This helps to ensure that
    results are reproducible and that the codebase is easier to maintain.
  • minor-addon: mbapy/dl_torch/utils.py: init_model_parameter: add nn.Embedding support with xavier_normal_
  • minor-addon: mbapy\web_utils\task.py: TaskPool: add start and deprecate run method
  • minor-addon: mbapy\sci_instrument\hplc_base.py: add IS_PDA attribute to HplcData class
    Added an IS_PDA boolean attribute to the HplcData class to indicate if the
    high-performance liquid chromatography (HPLC) data is from a Photodiode Array (PDA)
    detector. This attribute defaults to False until specifically set to True for PDA
    detector data analysis.
  • minor-addon: mbapy\sci_instrument\mass_utils.py: add tag_monoisotopic_only option

BUG-FIX

  • fix(mbapy/scripts/avif): ensure progress bar updates for completed and in-doing batches
    Add a sleep function during task execution in avif.py to allow the progress
    bar to update properly for completed and ongoing tasks, preventing the
    interface from appearing stuck due to a backlog of unprocessed tasks.
  • fix-bug: file: opts_file: when use yaml, now make sure Loader is in kwgs
  • fix-bug: mbapy/file.py: opts_file: kwgs now defaults to None to aoid default-kwargs-keep-alive bug
  • fix-bug: mbapy\scripts\mass.py: explore-mass: save fig name can be user define now
  • fix-bug: mbapy\scripts\mass.py: explore-mass: fig card now make right label
  • fix-bug: mbapy\web_utils\spider.py: DownloadPage: parse: get_valid_file_path before makedir to avoid parent folder name invalid error
  • fix-bug: mbapy\sci_utils\paper_search.py: search_by_pubmed: check article_info['KeywordList'] is empty now

CODE-FIX

  • fix(sci_utils): remove redundant author_name assignment in parse_grobid
    This change removes an unnecessary assignment of author_name that was causing
    an issue with the parsing of author names in the parse_grobid function.
  • fix(mbapy/scripts/avif): improve progress bar update mechanism for task completion
    Refactor the task execution loop in avif.py to ensure the progress bar accurately
    reflects the completion status of tasks. This is achieved by updating the progress
    bar only when tasks are actually done, in contrast to the previous approach which
    could give the impression of stalling when the pool had more tasks than processors.
  • fix(mbapy/test/dl_t/optim): update import and iteration syntax for clarity
    Refactor the import statement _str2scheduleF to str2scheduleF
  • fix-comment: mbapy\stats\test.py: pearsonr: fix comment
  • fix-code: change TaskPool.run to TaskPool.start

Remove

None or a little.

Other Changes

  • fix(setup): update Python version support in setup.py
    Extend support for Python 3.12 and adjust the python_requires constraint
    to include version 3.12 while still excluding version 3.13 and above.
  • feat(requirements): add openpyxl to dependencies
    Added openpyxl to the requirements.json file to ensure compatibility with
    Excel file handling. This library is necessary for reading and writing
    Excel workbooks using Python.

Details

完整的更新日志: https://gitee.com/bhm-bob/BA_PY/commits/v0.9.0
Full Changelog: v0.8.9...v0.9.0

v0.8.9

15 Jul 23:54
Compare
Choose a tag to compare

2024/7/16 7:43:49

Focus on

  1. Fix bugs in scripts

What's New

  • feat(stats): add linea_reg_OLS function for OLS regression in reg.py
    Implement a new function linea_reg_OLS for performing ordinary least squares
    (OLS) regression. This function simplifies the process of conducting OLS analysis
    on a given DataFrame by handling the addition of a constant and the extraction
    of regression results. It returns a dictionary containing the regression model,
    coefficients, intercept, R-squared value, and p-value.
    The addition of this function enhances the statistical capabilities of the
    mbapy/stats module and provides a more Pythonic way to perform OLS regressions
    compared to directly using statsmodels API.

Minor Addon

  • feat(mbapy-scripts): add just_name option for original file name usage
    Add a new flag '--just-name' to the move_file script which allows users to
    use the original name of the files instead of the sub-path when generating the
    output path. This provides more flexibility in how files are renamed and moved.
  • feat(mbapy-scripts): add --pause-after-exec option in the top-level arguments processing of mbapy-cli
    Introduce a new command-line argument --pause-after-exec in the mbapy scripts. This
    option allows the user to pause the execution after running the script, which is
    particularly useful for debugging and inspecting the results manually before the
    command-line window closes automatically.

BUG-FIX

  • fix-bug: mbapy\scripts\avif.py: remove readonly attribute before deleting original file
    Ensure the original file can be removed by removing the read-only attribute
    before attempting to delete it. This fixes an issue where the script would fail
    to delete the file if it was set as read-only.
  • fix-bug: mbapy\scripts\remove_file.py: remove readonly attribute before deleting files in remove_file.py
    Files were failing to delete if they were set as read-only. This fix adds a step
    to remove the read-only attribute using attrib -r before attempting to delete
    the file, ensuring that all files can be successfully removed.
  • fix-bug: mbapy\scripts: ensure file permissions are set correctly for delete operations upon windows and linux platforms.
    Modify file permission handling to support cross-platform operations.
    The updates check the system type and apply the appropriate command to
    remove the read-only attribute on Windows or change permissions on Linux
    before attempting to delete a file. This fix prevents failures when files
    are marked as read-only.
  • fix(mbapy-scripts): correct script name in mbapy-cli-scripts-list.json
    Update the script name entry for the 'remove file' command in the
    mbapy-cli-scripts-list.json file to match the actual script name
    used in the codebase. This change ensures the documentation and
    configuration are in sync, preventing potential confusion for users
    referencing the script names.
  • fix(mbapy-scripts): handle file path correctly in move_file script
    Correct the logic to check if the sub_path starts with the os path separator instead of
    the platform string. This ensures that the file path is handled correctly across
    different operating systems. Additionally, enhance the exception handling to include
    the error message for better diagnostics when a file move operation fails.
  • fix-bug(mbapy-scripts/avif.py): use web.TaskPool instead of multiprocessing.Pool to avoid no-response bug when $batch_size * num_workers &lt; num_files$

CODE-FIX

  • feat(avif.py): show 'batch' parameter
  • feat(mass.py): rename 'Refresh' button to 'Plot' and remove 'use_peaks_cache' option
    Change the button label from 'Refresh' to 'Plot' to better reflect its function in the
    user interface. Additionally, remove the 'use_peaks_cache' checkbox and associated argument
    from the mass data explorer, simplifying the interface and command-line options.
  • fix(mbapy/web_utils): specify return type for TaskPool.add_task

Remove

None or a little.

Other Changes

None or a little.

Details

完整的更新日志: https://gitee.com/bhm-bob/BA_PY/commits/v0.8.9
Full Changelog: v0.8.8...v0.8.9

v0.8.8

12 Jul 03:34
Compare
Choose a tag to compare

2024/7/4 16:06:49

Focus on

  1. imporve scripts/peptide: mmw
  2. Improve HPLC data processing

What's New

  • addon: mbapy\sci_instrument\hplc\Easychrom.py: add Easychrom data processing functionality
    Implement EasychromData class for processing raw HPLC data, extending the SciexData
    class. This includes parsing raw data files, scaling y-axis data, and handling of
    data frames. Also, integrate EasychromData into the hplc module and initiate
    unit tests for validation.
  • feat(tests): add unit tests for Sciex data processing in HPLC module
    Extend the unittest suite for the HPLC SCIEX data processing functionalities.
    This includes the addition of tests for loading raw data files and processed data
    files, ensuring the correctness of data loading and processing mechanisms.

Minor Addon

  • minor addon: mbapy\bio\peptide.py: AnimoAcid: implement hash method for AnimoAcid class
    Added a custom hash method to the AnimoAcid class to enable its instances to be used as keys in dictionaries. The hash function combines the hashes of the
    individual properties (N_protect, animo_acid, C_protect, R_protect) to produce a unique hash for each instance.
  • minor addon: mbapy\bio\peptide.py: Peptide: add hash method to Peptide class for dictionary usage
    Implement a custom hash method for the Peptide class to allow its instances to be used as keys in dictionaries. The hash function is based on the peptide's representation, ensuring a unique hash for each instance.
  • minor-adon: mbapy\sci_instrument_base.py: SciInstrumentData: process_raw_data: add y_scale parameter for scaling y-axis data
    Introduce a y_scale parameter in the process_raw_data method of SciInstrumentData class to allow for calibration of the y-axis data. This feature is particularly useful when the data needs to be scaled before further processing or analysis.
    Additionally, updated the import order in SCIEX.py for consistency and applied a minor code cleanup.
  • minor-addon: mbapy\scripts\hplc.py: add support for Easychrom data processing
    Extend the HplcData model to include EasychromData and update the plot_hplc class
    to support the new system in data processing and suffix mapping. This
    enhancement allows for the handling of additional HPLC data formats and
    improves the module's compatibility with various instruments.
  • feat(bio): implement len method for Peptide class
    Add the len method to the Peptide class to enable len() function support
    on peptide instances. This method returns the length of the peptide by
    calculating the number of amino acids (AAs) it contains.

BUG-FIX

  • fix-bug: mbapy\sci_instrument\mass\SCIEX.py: SciexMZMine: load_processed_data_file: add peak_df to avoid None error when saving processed_data
  • fix-bug: mbapy/scripts/peptide.py: fit-mass: check 'Monoisotopic' column existence in peak_df
    Add a check to confirm the presence of the 'Monoisotopic' column in the peak_df dataframe. If the column is missing, a log message is generated and the script continues using all peaks instead of just monoisotopic ones. This prevents runtime errors when the expected column is not present.
  • fix-bug: mbapy/sci_instrument/mass/_utils.py: _plot_tag_by_match_df: correct mass calculation for iron-tagged peptides
    The mass calculation for iron-tagged peptides has been updated to account for the iron mode specifics. Now the x-coordinate for plotting is adjusted based on the charge and iron mode parameters, ensuring accurate mass representation.
  • fix-bug: mbapy\scripts\hplc.py: improve supported systems display in HPLC scripts
    Update the help message for the '--system' argument in 'plot_hplc' and
    'explore_hplc' classes to list supported systems as a comma-separated
    string. This change clarifies the available options and improves the
    readability of the argument's description.
  • fix(bio): return empty string for empty seq in Peptide.repr
    Peptide's representation now returns an empty string when the sequence is empty,
    ensuring consistent behavior and avoiding representation errors.

CODE-FIX

  • fix-code: C:\Users\BHMfly\Documents\My_Progs\BA\Python\BA_PY\mbapy\scripts\mass.py: plot-mass: feat(mass): add x and y axis labels to mass spectra plots
    Plot now includes customizable x and y axis labels derived from the
    data headers, enhancing the readability and usability of the generated
    mass spectra plots.
  • feat(bio): add MutationOpts and MutationTree classes for peptide mutations
    Implement new classes MutationOpts and MutationTree to facilitate peptide
    mutation operations. This extends the functionality of the Peptide class by
    allowing for more complex manipulations and optimizations in the mutation
    process. The classes provide options for AA deletion, repetition, and
    replacement, as well as management of N/C/R-protect group deletions.
  • feat(scripts): optimize mutation weight calculation for peptides
    Refactor the mutation_weight command to support new options such as
    max_repeat, each_repeat, replace_aa, max_replace, and more. Simplify
    the code by removing redundant functions and utilizing the new
    MutationOpts and MutationTree classes. Prepare for multi-process
    execution and handle output file writing more efficiently.
  • feat(bio): optimize batch mutation weight calculation for peptides
    Refactor the calcu_mutations_mw_in_batch function to support batch processing of peptide mutations. This change improves performance by reducing the overhead of repetitive calculations and sets the stage for parallel processing implementations. The function now accepts a list of peptides and returns a tuple of dictionaries mapping peptide representations to their indexes and molecular weights (or masses) to lists of peptides with those properties.
    Additionally, introduced new utility functions and classes, such as split_list, TaskPool, AnimoAcid, and MutationOpts, to support the batch calculation and to enhance the modularity and maintainability of the codebase.
    BREAKING CHANGE: The calcu_peptide_mutations function signature has been changed to accommodate the new MutationOpts parameter and to remove deprecated ones. This may affect existing clients of this function who have not yet updated their code to use the new signature.

Remove

None or a little.

Other Changes

None or a little.

Details

完整的更新日志: https://gitee.com/bhm-bob/BA_PY/commits/v0.8.8
Full Changelog: v0.8.7...v0.8.8

v0.8.7

30 Jun 09:36
Compare
Choose a tag to compare

2024/6/30 17:23:26

Focus on

  1. Fix scripts bug in v0.8.6
  2. Improve HPLC and Mass scripts

What's New

None or a little.

Minor Addon

  • minor-addon: mbapy\scripts\peptide.py: feat(peptide): add option to retain old match records in mass data
    Introduce a new command-line argument --remain-old-match in the fit_mass command to allow users to keep previous match records when processing mass data. This option defaults to False, meaning old matches are cleared by default, but can be enabled to maintain the historic match data.
  • minor-addon: mbapy\scripts_main_.py: feat(mba-scripts): add functionality to load session from file
    Introduce new capability to the main script execution path that allows loading a session from a .mpss file. This enhances the mbapy CLI by providing a way to resume previous sessions directly from the command line.
  • minor-addon: mbapy\sci_instrument\mass\SCIEX.py: feat(sciex): implement SciexMZMine class for MZMine data processing
    Add a new subclass SciexMZMine in the SCIEX module, designed for handling data files with MZMine soft. This subclass extends SciexOriData, incorporating specific data loading and processing methods tailored for MZMine data format.

BUG-FIX

  • fix-bug: mbapy\scripts_script_utils_.py: The script has been updated to correctly show the total_size in bytes, resolving an issue where the incorrect variable was being printed.
  • fix-bug: mbapy\sci_instrument\hplc_base.py: HplcData: search_peaks: self.peaks_idx get right value when ed is not None
  • fix-bug: mbapy\scripts_script_utils_.py: excute_command: put issubclass check into a try block.

CODE-FIX

  • fix-code: mbapy\scripts\hplc.py: explore-hplc: improve manual peaking
  • fix-code: mbapy\sci_instrument\hplc_base.py: HplcData: search_peaks: st and ed minus t0 now to fit refined x, so peaks works in refined x-axis now
  • fix-code: mbapy\scripts\mass.py: fix(mass.py): ensure legend fits in figure by adjusting size dynamically
    When the legend size exceeds the figure size, the plot is resized to accommodate the legend, preventing fig resized. This improvement checks the legend's size and adjusts the figure dimensions accordingly, making sure that the legend is fully visible within the plot area.
  • mbapy\scripts\mass.py: fix(mass.py): correct indentation for peak filtering logic
    Indentation in the plot_mass class of mass.py was adjusted to ensure proper execution flow. Previously, the call to filter_peaks was not properly indented, causing it to execute outside of the intended block. This fix aligns the call to filter_peaks with the preceding search_peaks call, guaranteeing that peak filtering occurs as expected after peak search.

Remove

None or a little.

Other Changes

None or a little.

Details

完整的更新日志: https://gitee.com/bhm-bob/BA_PY/commits/v0.8.7
Full Changelog: v0.8.6...v0.8.7

v0.8.6

21 Jun 07:35
Compare
Choose a tag to compare

2024/6/21 15:26:13

Focus on

  1. Fix bugs for type hint error in v0.8.5

What's New

None or a little.

Minor Addon

  • minor-addon: mbapy\scripts\peptide.py: fit-mass: add --repr-w and --disable-repr-dash opion

BUG-FIX

  • fix-bug: fix type hint error fix-code: fix import

CODE-FIX

  • fix-code: mbapy\bio\peptide.py: Peptide: repr: add code to handle terminal Acid with no pg
  • fix-code: mbapy\scripts\mass.py: plot_single_mass_data: legend_pos='lower right'

Remove

None or a little.

Other Changes

  • fix-code: requirements.json: add highcharts option to nicegui

Details

完整的更新日志: https://gitee.com/bhm-bob/BA_PY/commits/v0.8.6