@@ -616,9 +616,9 @@ def zfpkm_filter(
616616 filtering_options : _FilteringOptions ,
617617 calculate_fpkm : bool ,
618618 force_zfpkm_plot : bool ,
619- peak_parameters : PeakIdentificationParameters ,
620- bandwidth : float ,
621- output_png_filepath : Path | None ,
619+ min_peak_height : float ,
620+ min_peak_distance : int ,
621+ output_png_dirpath : Path | None ,
622622) -> NamedMetrics :
623623 """Apply zFPKM filtering to the FPKM matrix for a given sample.
624624
@@ -627,9 +627,9 @@ def zfpkm_filter(
627627 filtering_options: Options for filtering the count matrix.
628628 calculate_fpkm: Whether to calculate FPKM from counts.
629629 force_zfpkm_plot: Whether to force plotting of zFPKM results even if there are many samples.
630- peak_parameters: Parameters for peak identification in zFPKM calculation .
631- bandwidth: The bandwidth for kernel density estimation in zFPKM calculation .
632- output_png_filepath : Optional filepath to save the zFPKM plot .
630+ min_peak_height: Minimum peak height for zFPKM peak identification .
631+ min_peak_distance: Minimum peak distance for zFPKM peak identification .
632+ output_png_dirpath : Optional directory path to save zFPKM plots .
633633
634634 Returns:
635635 A dictionary of filtered study metrics.
@@ -643,9 +643,15 @@ def zfpkm_filter(
643643 metric : _StudyMetrics
644644 # if fpkm was not calculated, the normalization matrix will be empty; collect the count matrix instead
645645 matrix = metric .count_matrix if metric .normalization_matrix .empty else metric .normalization_matrix
646- matrix = matrix [matrix .sum (axis = 1 ) > 0 ] # remove rows (genes) that have no counts across all samples
647646
648- results , zfpkm_df = zfpkm_transform (matrix , peak_parameters = peak_parameters , bandwidth = bandwidth )
647+ # TODO: 2025-OCT-31: Re-evaluate whether to remove rows with all 0 counts
648+ # matrix = matrix[matrix.sum(axis=1) > 0] # remove rows (genes) that have no counts across all samples
649+
650+ results , zfpkm_df = zfpkm_transform (
651+ fpkm_df = matrix ,
652+ min_peak_height = min_peak_height ,
653+ min_peak_distance = min_peak_distance ,
654+ )
649655 zfpkm_df [(matrix == 0 ) | (zfpkm_df .isna ())] = - 4
650656
651657 if len (results ) > 10 and not force_zfpkm_plot :
@@ -683,8 +689,8 @@ def filter_counts(
683689 filtering_options : _FilteringOptions ,
684690 prep : RNAType ,
685691 force_zfpkm_plot : bool ,
686- peak_parameters : PeakIdentificationParameters ,
687- bandwidth : float ,
692+ zfpkm_min_peak_height : float ,
693+ zfpkm_min_peak_distance : int ,
688694 output_zfpkm_plot_dirpath : Path | None = None ,
689695) -> NamedMetrics :
690696 """Filter the count matrix based on the specified technique.
@@ -696,8 +702,8 @@ def filter_counts(
696702 filtering_options: Options for filtering the count matrix.
697703 prep: The RNA preparation type.
698704 force_zfpkm_plot: Whether to force plotting of zFPKM results even if there are many samples.
699- peak_parameters: Parameters for peak identification in zFPKM calculation .
700- bandwidth: The bandwidth for kernel density estimation in zFPKM calculation .
705+ zfpkm_min_peak_height: Minimum peak height for zFPKM peak identification .
706+ zfpkm_min_peak_distance: Minimum peak distance for zFPKM peak identification .
701707 output_zfpkm_plot_dirpath: Optional filepath to save the zFPKM plot.
702708
703709 Returns:
@@ -714,8 +720,8 @@ def filter_counts(
714720 filtering_options = filtering_options ,
715721 calculate_fpkm = True ,
716722 force_zfpkm_plot = force_zfpkm_plot ,
717- peak_parameters = peak_parameters ,
718- bandwidth = bandwidth ,
723+ min_peak_height = zfpkm_min_peak_height ,
724+ min_peak_distance = zfpkm_min_peak_distance ,
719725 output_png_dirpath = output_zfpkm_plot_dirpath ,
720726 )
721727 case FilteringTechnique .UMI :
@@ -725,8 +731,8 @@ def filter_counts(
725731 filtering_options = filtering_options ,
726732 calculate_fpkm = False ,
727733 force_zfpkm_plot = force_zfpkm_plot ,
728- peak_parameters = peak_parameters ,
729- bandwidth = bandwidth ,
734+ min_peak_height = zfpkm_min_peak_height ,
735+ min_peak_distance = zfpkm_min_peak_distance ,
730736 output_png_dirpath = output_zfpkm_plot_dirpath ,
731737 )
732738 case _:
@@ -751,8 +757,8 @@ async def _process(
751757 technique : FilteringTechnique ,
752758 cut_off : int | float ,
753759 force_zfpkm_plot : bool ,
754- peak_parameters : PeakIdentificationParameters ,
755- bandwidth : float ,
760+ zfpkm_min_peak_height : float ,
761+ zfpkm_min_peak_distance : int ,
756762 output_boolean_activity_filepath : Path ,
757763 output_zscore_normalization_filepath : Path ,
758764 output_zfpkm_plot_dirpath : Path | None ,
@@ -792,8 +798,8 @@ async def _process(
792798 filtering_options = filtering_options ,
793799 prep = prep ,
794800 force_zfpkm_plot = force_zfpkm_plot ,
795- peak_parameters = peak_parameters ,
796- bandwidth = bandwidth ,
801+ zfpkm_min_peak_height = zfpkm_min_peak_height ,
802+ zfpkm_min_peak_distance = zfpkm_min_peak_distance ,
797803 output_zfpkm_plot_dirpath = output_zfpkm_plot_dirpath ,
798804 )
799805
0 commit comments