spacr 0.0.70__py3-none-any.whl → 0.0.80__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- spacr/__init__.py +4 -1
- spacr/__main__.py +0 -7
- spacr/annotate_app.py +75 -61
- spacr/core.py +39 -246
- spacr/foldseek.py +6 -6
- spacr/get_alfafold_structures.py +3 -3
- spacr/io.py +53 -116
- spacr/measure.py +46 -59
- spacr/plot.py +117 -81
- spacr/sequencing.py +508 -491
- spacr/sim.py +24 -29
- spacr/utils.py +487 -260
- {spacr-0.0.70.dist-info → spacr-0.0.80.dist-info}/METADATA +10 -8
- spacr-0.0.80.dist-info/RECORD +36 -0
- spacr/graph_learning_lap.py +0 -84
- spacr/train.py +0 -667
- spacr/umap.py +0 -0
- spacr-0.0.70.dist-info/RECORD +0 -39
- {spacr-0.0.70.dist-info → spacr-0.0.80.dist-info}/LICENSE +0 -0
- {spacr-0.0.70.dist-info → spacr-0.0.80.dist-info}/WHEEL +0 -0
- {spacr-0.0.70.dist-info → spacr-0.0.80.dist-info}/entry_points.txt +0 -0
- {spacr-0.0.70.dist-info → spacr-0.0.80.dist-info}/top_level.txt +0 -0
spacr/sim.py
CHANGED
@@ -204,16 +204,12 @@ def power_law_dist_gen(df, avg, well_ineq_coeff):
|
|
204
204
|
Generate a power-law distribution for wells.
|
205
205
|
|
206
206
|
Parameters:
|
207
|
-
- df: DataFrame
|
208
|
-
|
209
|
-
-
|
210
|
-
The average value for the distribution.
|
211
|
-
- well_ineq_coeff: float
|
212
|
-
The inequality coefficient for the power-law distribution.
|
207
|
+
- df: DataFrame: The input DataFrame containing the wells.
|
208
|
+
- avg: float: The average value for the distribution.
|
209
|
+
- well_ineq_coeff: float: The inequality coefficient for the power-law distribution.
|
213
210
|
|
214
211
|
Returns:
|
215
|
-
- dist: ndarray
|
216
|
-
The generated power-law distribution for the wells.
|
212
|
+
- dist: ndarray: The generated power-law distribution for the wells.
|
217
213
|
"""
|
218
214
|
# Generate a power-law distribution for wells
|
219
215
|
distribution = generate_power_law_distribution(len(df), well_ineq_coeff)
|
@@ -405,8 +401,7 @@ def compute_roc_auc(cell_scores):
|
|
405
401
|
- cell_scores (DataFrame): DataFrame containing cell scores with columns 'is_active' and 'score'.
|
406
402
|
|
407
403
|
Returns:
|
408
|
-
- cell_roc_dict (dict): Dictionary containing the ROC curve information, including the threshold, true positive rate (TPR),
|
409
|
-
false positive rate (FPR), and ROC AUC.
|
404
|
+
- cell_roc_dict (dict): Dictionary containing the ROC curve information, including the threshold, true positive rate (TPR), false positive rate (FPR), and ROC AUC.
|
410
405
|
|
411
406
|
"""
|
412
407
|
fpr, tpr, thresh = roc_curve(cell_scores['is_active'], cell_scores['score'], pos_label=1)
|
@@ -567,11 +562,11 @@ def regression_roc_auc(results_df, active_gene_list, control_gene_list, alpha =
|
|
567
562
|
|
568
563
|
Returns:
|
569
564
|
tuple: A tuple containing the following:
|
570
|
-
|
571
|
-
|
572
|
-
|
573
|
-
|
574
|
-
|
565
|
+
- results_df (DataFrame): Updated DataFrame with additional columns.
|
566
|
+
- reg_roc_dict_df (DataFrame): DataFrame containing regression ROC curve data.
|
567
|
+
- reg_pr_dict_df (DataFrame): DataFrame containing precision-recall curve data.
|
568
|
+
- reg_cm (ndarray): Confusion matrix.
|
569
|
+
- sim_stats (DataFrame): DataFrame containing simulation statistics.
|
575
570
|
"""
|
576
571
|
results_df = results_df.rename(columns={"P>|t|": "p"})
|
577
572
|
|
@@ -737,20 +732,20 @@ def run_simulation(settings):
|
|
737
732
|
|
738
733
|
Returns:
|
739
734
|
tuple: A tuple containing the simulation results and distances.
|
740
|
-
|
741
|
-
|
742
|
-
|
743
|
-
|
744
|
-
|
745
|
-
|
746
|
-
|
747
|
-
|
748
|
-
|
749
|
-
|
750
|
-
|
751
|
-
|
752
|
-
|
753
|
-
|
735
|
+
- cell_scores (DataFrame): Scores for each cell.
|
736
|
+
- cell_roc_dict_df (DataFrame): ROC AUC scores for each cell.
|
737
|
+
- cell_pr_dict_df (DataFrame): Precision-Recall AUC scores for each cell.
|
738
|
+
- cell_cm (DataFrame): Confusion matrix for each cell.
|
739
|
+
- well_score (DataFrame): Scores for each well.
|
740
|
+
- gene_fraction_map (DataFrame): Fraction of genes for each well.
|
741
|
+
- metadata (DataFrame): Metadata for each well.
|
742
|
+
- results_df (DataFrame): Results of the regression analysis.
|
743
|
+
- reg_roc_dict_df (DataFrame): ROC AUC scores for each gene.
|
744
|
+
- reg_pr_dict_df (DataFrame): Precision-Recall AUC scores for each gene.
|
745
|
+
- reg_cm (DataFrame): Confusion matrix for each gene.
|
746
|
+
- sim_stats (dict): Additional simulation statistics.
|
747
|
+
- genes_per_well_df (DataFrame): Number of genes per well.
|
748
|
+
- wells_per_gene_df (DataFrame): Number of wells per gene.
|
754
749
|
dists (list): List of distances.
|
755
750
|
"""
|
756
751
|
#try:
|