@@ -33,7 +33,7 @@ def getArgs():
33
33
dataZip = ZipFile (args .dataFile )
34
34
nameList = dataZip .namelist ()
35
35
subsampleIndices = sorted ({int (name .split ("/" )[0 ]) for name in nameList })
36
- neededArrays = {arrayName : [] for arrayName in ["correlationCoefficients" , "combinedCorrelationPValues" , "correctedCorrelationPValues" ]}
36
+ neededArrays = {arrayName : [] for arrayName in ["correlationCoefficients" , "combinedCorrelationPValues" , "correctedCorrelationPValues" , "edges" ]}
37
37
for index in subsampleIndices :
38
38
for arrayName , arrayList in neededArrays .items ():
39
39
fileName = "{}/{}" .format (index , arrayName )
@@ -76,6 +76,7 @@ def getArgs():
76
76
rVals = xarray .concat (dataArrays ["correlationCoefficients" ], dim = "subsample" )
77
77
combinedPVals = xarray .concat (dataArrays ["combinedCorrelationPValues" ], dim = "subsample" )
78
78
correctedPVals = xarray .concat (dataArrays ["correctedCorrelationPValues" ], dim = "subsample" )
79
+ edges = xarray .concat (dataArrays ["edges" ], dim = "subsample" )
79
80
80
81
if args .singlecell :
81
82
nodeDims = ["measurableAndCellType1" , "measurableAndCellType2" ]
@@ -85,9 +86,11 @@ def getArgs():
85
86
combinedPValMedians = combinedPVals .median (dim = "subsample" )
86
87
correctedPValMedians = correctedPVals .median (dim = "subsample" )
87
88
88
- combinedData = rVals .mean (dim = "metatreatment" )
89
- percentInclusions = combinedData .count (dim = "subsample" ) / combinedData .sizes ["subsample" ]
89
+ edgeIncluded = edges != 0
90
+ subsampleAxis = edgeIncluded .get_axis_num ("subsample" )
91
+ percentInclusions = xarray .apply_ufunc (numpy .count_nonzero , edgeIncluded , input_core_dims = [edgeIncluded .dims ], output_core_dims = [nodeDims ], kwargs = dict (axis = subsampleAxis )) / edgeIncluded .sizes ["subsample" ]
90
92
93
+ combinedData = rVals .mean (dim = "metatreatment" )
91
94
medians = combinedData .median (dim = "subsample" )
92
95
maxs = combinedData .max (dim = "subsample" )
93
96
mins = combinedData .min (dim = "subsample" )
0 commit comments