@@ -1012,7 +1012,7 @@ def plot_classifier(self, trait, sample_subset=None,
1012
1012
** kwargs )
1013
1013
1014
1014
def modality_assignments (self , sample_subset = None , feature_subset = None ,
1015
- expression_thresh = - np .inf , min_samples = 10 ):
1015
+ expression_thresh = - np .inf , min_samples = 20 ):
1016
1016
"""Get modality assignments of splicing data
1017
1017
1018
1018
Parameters
@@ -1029,7 +1029,8 @@ def modality_assignments(self, sample_subset=None, feature_subset=None,
1029
1029
Minimum expression value, of the original input. E.g. if the
1030
1030
original input is already log-transformed, then this threshold is
1031
1031
on the log values.
1032
-
1032
+ min_samples : int, optional
1033
+ Minimum number of samples per event to calculate a modality
1033
1034
Returns
1034
1035
-------
1035
1036
modalities : pandas.DataFrame
@@ -1053,6 +1054,51 @@ def modality_assignments(self, sample_subset=None, feature_subset=None,
1053
1054
sample_ids , feature_ids , data = data ,
1054
1055
groupby = self .sample_id_to_phenotype , min_samples = min_samples )
1055
1056
1057
+ def modality_log2bf (self , sample_subset = None , feature_subset = None ,
1058
+ expression_thresh = - np .inf , min_samples = 20 ):
1059
+ """Get modality assignments of splicing data
1060
+
1061
+ Parameters
1062
+ ----------
1063
+ sample_subset : str or None, optional
1064
+ Which subset of the samples to use, based on some phenotype
1065
+ column in the experiment design data. If None, all samples are
1066
+ used.
1067
+ feature_subset : str or None, optional
1068
+ Which subset of the features to used, based on some feature type
1069
+ in the expression data (e.g. "variant"). If None, all features
1070
+ are used.
1071
+ expression_thresh : float, optional
1072
+ Minimum expression value, of the original input. E.g. if the
1073
+ original input is already log-transformed, then this threshold is
1074
+ on the log values.
1075
+ min_samples : int, optional
1076
+ Minimum number of samples per event to calculate a modality
1077
+
1078
+ Returns
1079
+ -------
1080
+ modalities : pandas.DataFrame
1081
+ A (n_phenotypes, n_events) shaped DataFrame of the assigned
1082
+ modality
1083
+ """
1084
+ min_expression = self .expression .data .min ().min ()
1085
+ if expression_thresh > - np .inf and expression_thresh > min_expression :
1086
+ data = self .filter_splicing_on_expression (
1087
+ expression_thresh = expression_thresh ,
1088
+ sample_subset = sample_subset )
1089
+ sample_ids = None
1090
+ feature_ids = None
1091
+ else :
1092
+ sample_ids = self .sample_subset_to_sample_ids (sample_subset )
1093
+ feature_ids = self .feature_subset_to_feature_ids (
1094
+ 'splicing' , feature_subset , rename = False )
1095
+ data = None
1096
+
1097
+ return self .splicing .modality_log2bf (
1098
+ sample_ids , feature_ids , data = data ,
1099
+ groupby = self .sample_id_to_phenotype , min_samples = min_samples )
1100
+
1101
+
1056
1102
def modality_counts (self , sample_subset = None , feature_subset = None ,
1057
1103
expression_thresh = - np .inf , min_samples = 10 ):
1058
1104
"""Get number of splicing events in modality categories
@@ -1071,6 +1117,8 @@ def modality_counts(self, sample_subset=None, feature_subset=None,
1071
1117
Minimum expression value, of the original input. E.g. if the
1072
1118
original input is already log-transformed, then this threshold is
1073
1119
on the log values.
1120
+ min_samples : int, optional
1121
+ Minimum number of samples per event to calculate a modality
1074
1122
1075
1123
Returns
1076
1124
-------
0 commit comments