@@ -2587,8 +2587,8 @@ def summary_pair(
2587
2587
Summarize differential expression results of single pairwose comparison
2588
2588
into an output table.
2589
2589
2590
- :param groups0 : First set of groups in pair-wise comparison.
2591
- :param groups1 : Second set of groups in pair-wise comparison.
2590
+ :param group0 : First set of groups in pair-wise comparison.
2591
+ :param group1 : Second set of groups in pair-wise comparison.
2592
2592
:param qval_thres: Upper bound of corrected p-values for gene to be included.
2593
2593
:param fc_upper_thres: Upper bound of fold-change for gene to be included.
2594
2594
:param fc_lower_thres: Lower bound of fold-change p-values for gene to be included.
@@ -2970,7 +2970,7 @@ def log_fold_change(self, base=np.e, genes=None, nonnumeric=False):
2970
2970
else :
2971
2971
genes = self ._idx_genes (genes )
2972
2972
2973
- fc = self .max (genes = genes , nonnumeric = nonnumeric ) - self .min (genes = genes , nonnumeric = nonnumeric )
2973
+ fc = self .max (genes = genes , non_numeric = nonnumeric ) - self .min (genes = genes , non_numeric = nonnumeric )
2974
2974
fc = np .nextafter (0 , 1 , out = fc , where = fc == 0 )
2975
2975
2976
2976
return np .log (fc ) / np .log (base )
@@ -3031,75 +3031,75 @@ def _spline_par_loc_idx(self, intercept=True):
3031
3031
idx = np .concatenate ([np .where ([[x == 'Intercept' for x in par_loc_names ]])[0 ], idx ])
3032
3032
return idx
3033
3033
3034
- def _continuous_model (self , idx , nonnumeric = False ):
3034
+ def _continuous_model (self , idx , non_numeric = False ):
3035
3035
"""
3036
3036
Recover continuous fit for a gene.
3037
3037
3038
3038
:param idx: Index of genes to recover fit for.
3039
- :param nonnumeric : Whether to include non-numeric covariates in fit.
3039
+ :param non_numeric : Whether to include non-numeric covariates in fit.
3040
3040
:return: Continuuos fit for each cell for given gene.
3041
3041
"""
3042
3042
idx = np .asarray (idx )
3043
- if nonnumeric :
3043
+ if non_numeric :
3044
3044
mu = np .matmul (self ._model_estim .design_loc .values ,
3045
3045
self ._model_estim .par_link_loc [:, idx ])
3046
3046
if self ._size_factors is not None :
3047
3047
mu = mu + self ._size_factors
3048
3048
else :
3049
3049
idx_basis = self ._spline_par_loc_idx (intercept = True )
3050
- mu = np .matmul (self ._model_estim .design_loc [:,idx_basis ].values ,
3050
+ mu = np .matmul (self ._model_estim .design_loc [:, idx_basis ].values ,
3051
3051
self ._model_estim .par_link_loc [idx_basis , idx ])
3052
3052
3053
3053
mu = np .exp (mu )
3054
3054
return mu
3055
3055
3056
- def max (self , genes , nonnumeric = False ):
3056
+ def max (self , genes , non_numeric = False ):
3057
3057
"""
3058
3058
Return maximum fitted expression value by gene.
3059
3059
3060
3060
:param genes: Genes for which to return maximum fitted value.
3061
- :param nonnumeric : Whether to include non-numeric covariates in fit.
3061
+ :param non_numeric : Whether to include non-numeric covariates in fit.
3062
3062
:return: Maximum fitted expression value by gene.
3063
3063
"""
3064
3064
genes = self ._idx_genes (genes )
3065
- return np .array ([np .max (self ._continuous_model (idx = i , nonnumeric = nonnumeric ))
3065
+ return np .array ([np .max (self ._continuous_model (idx = i , non_numeric = non_numeric ))
3066
3066
for i in genes ])
3067
3067
3068
- def min (self , genes , nonnumeric = False ):
3068
+ def min (self , genes , non_numeric = False ):
3069
3069
"""
3070
3070
Return minimum fitted expression value by gene.
3071
3071
3072
3072
:param genes: Genes for which to return maximum fitted value.
3073
- :param nonnumeric : Whether to include non-numeric covariates in fit.
3073
+ :param non_numeric : Whether to include non-numeric covariates in fit.
3074
3074
:return: Maximum fitted expression value by gene.
3075
3075
"""
3076
3076
genes = self ._idx_genes (genes )
3077
- return np .array ([np .min (self ._continuous_model (idx = i , nonnumeric = nonnumeric ))
3077
+ return np .array ([np .min (self ._continuous_model (idx = i , non_numeric = non_numeric ))
3078
3078
for i in genes ])
3079
3079
3080
- def argmax (self , genes , nonnumeric = False ):
3080
+ def argmax (self , genes , non_numeric = False ):
3081
3081
"""
3082
3082
Return maximum fitted expression value by gene.
3083
3083
3084
3084
:param genes: Genes for which to return maximum fitted value.
3085
- :param nonnumeric : Whether to include non-numeric covariates in fit.
3085
+ :param non_numeric : Whether to include non-numeric covariates in fit.
3086
3086
:return: Maximum fitted expression value by gene.
3087
3087
"""
3088
3088
genes = self ._idx_genes (genes )
3089
- idx = np .array ([np .argmax (self ._continuous_model (idx = i , nonnumeric = nonnumeric ))
3089
+ idx = np .array ([np .argmax (self ._continuous_model (idx = i , non_numeric = non_numeric ))
3090
3090
for i in genes ])
3091
3091
return self ._continuous_coords [idx ]
3092
3092
3093
- def argmin (self , genes , nonnumeric = False ):
3093
+ def argmin (self , genes , non_numeric = False ):
3094
3094
"""
3095
3095
Return minimum fitted expression value by gene.
3096
3096
3097
3097
:param genes: Genes for which to return maximum fitted value.
3098
- :param nonnumeric : Whether to include non-numeric covariates in fit.
3098
+ :param non_numeric : Whether to include non-numeric covariates in fit.
3099
3099
:return: Maximum fitted expression value by gene.
3100
3100
"""
3101
3101
genes = self ._idx_genes (genes )
3102
- idx = np .array ([np .argmin (self ._continuous_model (idx = i , nonnumeric = nonnumeric ))
3102
+ idx = np .array ([np .argmin (self ._continuous_model (idx = i , non_numeric = non_numeric ))
3103
3103
for i in genes ])
3104
3104
return self ._continuous_coords [idx ]
3105
3105
@@ -3109,7 +3109,7 @@ def plot_genes(
3109
3109
hue = None ,
3110
3110
size = 1 ,
3111
3111
log = True ,
3112
- nonnumeric = False ,
3112
+ non_numeric = False ,
3113
3113
save = None ,
3114
3114
show = True ,
3115
3115
ncols = 2 ,
@@ -3124,7 +3124,7 @@ def plot_genes(
3124
3124
:param hue: Confounder to include in plot.
3125
3125
:param size: Point size.
3126
3126
:param log: Whether to log values.
3127
- :param nonnumeric :
3127
+ :param non_numeric :
3128
3128
:param save: Path+file name stem to save plots to.
3129
3129
File will be save+"_genes.png". Does not save if save is None.
3130
3130
:param show: Whether to display plot.
@@ -3169,7 +3169,7 @@ def plot_genes(
3169
3169
axs .append (ax )
3170
3170
3171
3171
y = self .X [:, g ]
3172
- yhat = self ._continuous_model (idx = g , nonnumeric = nonnumeric )
3172
+ yhat = self ._continuous_model (idx = g , non_numeric = non_numeric )
3173
3173
if log :
3174
3174
y = np .log (y + 1 )
3175
3175
yhat = np .log (yhat + 1 )
@@ -3251,7 +3251,7 @@ def plot_heatmap(
3251
3251
# Build heatmap matrix.
3252
3252
# Add in data.
3253
3253
data = np .array ([
3254
- self ._continuous_model (idx = g , nonnumeric = False )
3254
+ self ._continuous_model (idx = g , non_numeric = False )
3255
3255
for i , g in enumerate (gene_idx )
3256
3256
])
3257
3257
# Order columns by continuous covariate.
0 commit comments