Releases: BHM-Bob/BA_PY
v0.9.1
2024/8/31 08:51:09
Focus on
- 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
v0.9.0
2024/8/29 21:51:09
Focus on
- Fix bugs in scripts
- Add more class and function in HPLC and Mass Spectrum
- 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 parametersearch_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 functionget_dir
in thembapy/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 anIS_PDA
boolean attribute to theHplcData
class to indicate if the
high-performance liquid chromatography (HPLC) data is from a Photodiode Array (PDA)
detector. This attribute defaults toFalse
until specifically set toTrue
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 ofauthor_name
that was causing
an issue with the parsing of author names in theparse_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
2024/7/16 7:43:49
Focus on
- Fix bugs in scripts
What's New
- feat(stats): add linea_reg_OLS function for OLS regression in reg.py
Implement a new functionlinea_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 thembapy
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 usingattrib -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 < 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
2024/7/4 16:06:49
Focus on
- imporve scripts/peptide: mmw
- 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 ay_scale
parameter in theprocess_raw_data
method ofSciInstrumentData
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 inSCIEX.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 thecalcu_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 assplit_list
,TaskPool
,AnimoAcid
, andMutationOpts
, to support the batch calculation and to enhance the modularity and maintainability of the codebase.
BREAKING CHANGE: Thecalcu_peptide_mutations
function signature has been changed to accommodate the newMutationOpts
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
2024/6/30 17:23:26
Focus on
- Fix scripts bug in v0.8.6
- 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 thefit_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 theplot_mass
class ofmass.py
was adjusted to ensure proper execution flow. Previously, the call tofilter_peaks
was not properly indented, causing it to execute outside of the intended block. This fix aligns the call tofilter_peaks
with the precedingsearch_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
2024/6/21 15:26:13
Focus on
- 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
v0.8.5
2024/6/19 21:29:28
Focus on
- Fix bugs in bio.Peptide function assembly
- Fix code in web.utils.TaskPool function assembly
What's New
- addon: add mbapy\bio\high_level.py as sub-module
Minor Addon
- minor addon: mbapy\bio\high_level.py: add calcu_peptide_mutations
- minor addon: mbapy\sci_instrument\mass_base.py: MassData: add add_match_record
- minor addon: mbapy\file.py: write_sheets: add writer_kwgs and kwargs
- minor addon: mbapy\sci_instrument\mass_base.py: MassData: ESI_IRON_MODE: add [M+2H]2+ and [M+3H]3+
- minor addon: mbapy\sci_instrument\mass_base.py: MassData: add_match_record: add charge
- minor addon: mbapy\scripts\mass.py: plot-mass: add legend_bbox arg
- minor-addon: mbapy\sci_instrument\mass_utils.py:plot_mass: support plot match_df tag
- minor addon: mbapy\sci_instrument\hplc_base.py: HplcData: add method: calcu_single_peak_area
- minor addon: mbapy\scripts\hplc.py: explore-hplc: add manual peak area integrate
BUG-FIX
- fix-bug: mbapy\sci_instrument_base.py: SciInstrumentData: save_processed_data: do not save index now
- fix-bug: mbapy\sci_instrument\hplc\waters.py: WatersData: save_processed_data: do not save index now
- fix-bug: mbapy\sci_instrument\mass_base.py: MassData: save_processed_data: do not save index now
- fix-bug: mbapy\sci_instrument\hplc\waters.py: WatersData: get_abs_data: return refined_abs_data if need
CODE-FIX
- fix-code: mbapy\sci_instrument\mass_base.py: MassData: add match_df
- fix-code: mbapy\sci_instrument\mass\SCIEX.py: SciexPeakListData: process_raw_data: Monoisotopic as bool
- fix-code: mbapy\scripts\peptide.py: fit_mass: use match_df
- fix-code: mbapy\scripts\peptide.py: fit_mass: only fit Monoisotopic now
- fix-code: mbapy\scripts\peptide.py: fit_mass: minor changes
- fix-code: mbapy\sci_instrument\hplc_utils.py: plot_hplc: use refined_abs_data to get abs data
- fix-code: mbapy\sci_instrument\hplc_utils.py: plot_hplc: minus refine number now
- fix-code: mbapy\scripts\hplc.py: explore-hplc: _ui_refinment_numbers use tag2label now
Remove
None or a little.
Other Changes
- fix-code: requirements.json: matplotlib requires version >=3.7.5
Details
完整的更新日志: https://gitee.com/bhm-bob/BA_PY/commits/v0.8.5
Full Changelog: v0.8.4...v0.8.5
v0.8.4
2024-06-16 10:54:32
Focus on
- Fix bugs in bio.Peptide function assembly
- Fix code in web.utils.TaskPool function assembly
What's New
None or a little.
Minor Addon
- minor add: mbapy\web_utils\task.py: TaskPool: add method: query_single_task_from_tasks
- minor addon: mbapy\bio\peptide.py: add eq for AnimoAcid and Peptide
BUG-FIX
- fix-bug: mbapy\sci_instrument\mass_utils.py & mbapy\scripts\mass.py: handle is_y_log rightly
- fix-bug: mbapy\scripts\peptide.py: fit_mass: make_args: add missing argument 'mass'
- fix-bug: mbapy\scripts\peptide.py: fit_mass: process_args: only extend unique seq now
CODE-FIX
- fix-code: mbapy\scripts\mass.py: plot_mass: load_suffix_data: using task_pool.query_single_task_from_tasks instead of task_pool.query_task
- fix-code: mbapy\scripts\mass.py: explore_mass: main_process: using Thread to load data in background
- fix-code: mbapy\sci_instrument_utils.py: add all
Remove
None or a little.
Other Changes
None or a little.
Details
v0.8.3
2024/6/13 10:30:34
Focus on
- Fix bugs in Mass function assembly
- Add new command: fit-mass
What's New
- addon: mbapy\scripts_script_utils_.py: add _print
- addon: mbapy\scripts\peptide.py: add new command: fit-mass
Minnor Addon
- minnor-addon: mbapy\sci_instrument\mass_base.py: MassData: add ESI_IRON_MODE attr fix-bug: mbapy\sci_instrument\mass_base.py: MassData.search_peaks: consider egde when concatenate y_list_r
BUG-FIX
- fix-bug: mbapy\web_utils\task.py: TaskPool: query_task: now block when block param is true and task is not returned by the query and is not timeout
- fix-bug: mbapy\scripts\mass.py: plot-mass: set CHARGE_HEADER depend on mass and X_M_HEADER
- fix-bug: mbapy\sci_instrument\hplc_utils.py: recover x, y offset is right now
- fix-bug: mbapy\scripts\hplc.py: args.file_labels now add default labels when no file labels given
CODE-FIX
- fix-code: mbapy\sci_instrument\mass_utils.py & mbapy\scripts\mass.py: support is_y_log option
- fix-code: mbapy\file.py: opts_file: add gzip option for pkl
- fix-code: mbapy\scripts\peptide.py: re-construct the function calcu_mw_of_mutations to Command class
Remove
None or a little.
Other Changes
Storage
- fix-code: requirements.json: add tqdm into 'std'
Details
v0.8.2
2024-06-10 21:58:55
Focus on
- Fix bugs in HPLC and Mass function assembly
What's New
None or a little.
BUG-FIX
- fix-bug: mbapy\web_utils\task.py: TaskPool: query_task: now block when block param is true and task is not returned by the query and is not timeout
- fix-bug: mbapy\scripts\mass.py: plot-mass: set CHARGE_HEADER depend on mass and X_M_HEADER
- fix-bug: mbapy\sci_instrument\hplc_utils.py: recover x, y offset is right now
- fix-bug: mbapy\scripts\hplc.py: args.file_labels now add default labels when no file labels given
CODE-FIX
- fix-code: mbapy\scripts_main_.py: forword scripts exec name to scripts name
- mbapy\scripts: rename some scripts' name
- fix-code: mbapy\sci_instrument\mass_base.py: MassData: add CHARGE_HEADER attr
- fix-code: mbapy\sci_instrument\mass\SCIEX.py: SciexPeakListData: add attr: CHARGE_HEADER
- fix-code: mbapy\sci_instrument\mass_utils.py: plot_mass: support plot charge text
- fix-code: mbapy\scripts\hplc.py: plot-hplc: support multi-process plotting
- fix-code: mbapy\sci_instrument\hplc_utils.py: plot_hplc: change default fig size
- fix-code: mbapy\sci_instrument\mass_utils.py: add dev-code
- fix-code: mbapy\scripts\mass.py: fix import
Remove
None or a little.
Other Changes
Storage
- fix-code: mbapy\storage\mbapy-cli-scripts-list.json: add copy_file for cp as a new exec_name
Details
完整的更新日志: https://gitee.com/bhm-bob/BA_PY/commits/v0.8.2
Full Changelog: v0.8.1...v0.8.2