Closed YuanningEric closed 1 week ago
Hello YuanningEric, sorry for the late reply.
Can you try the following code chunk:
spata_object <- runCnvAnalysis(object = spata_object, gene_pos_df = SPATA2::gene_pos_df)
Does that work?
Hi, thank you for the package :)
I faced the same issue as YuanningEric and your code allowed the CNV analysis to proceed
The output is the following with a warning at the end :
13:31:53 Checking input for reference data. 13:31:53 Combining input and reference data. 13:31:54 Getting gene positions. 13:31:54 Starting analysis pipeline. INFO [2022-07-19 13:31:53] ::order_reduce:Start. INFO [2022-07-19 13:31:53] .order_reduce(): expr and order match. INFO [2022-07-19 13:31:56] ::process_data:order_reduce:Reduction from positional data, new dimensions (r,c) = 21827,4825 Total=38947386 Min=0 Max=4373. INFO [2022-07-19 13:31:56] num genes removed taking into account provided gene ordering list: 5528 = 25.3264305676456% removed. INFO [2022-07-19 13:31:56] -filtering out cells < 100 or > Inf, removing 0.145078 % of cells INFO [2022-07-19 13:31:57] validating infercnv_obj 13:31:57 Removing genes from matrix with mean expression below threshold. INFO [2022-07-19 13:31:57] ::above_min_mean_expr_cutoff:Start INFO [2022-07-19 13:31:57] Removing 6430 genes from matrix as below mean expr threshold: 0.1 INFO [2022-07-19 13:31:57] validating infercnv_obj INFO [2022-07-19 13:31:57] There are 9869 genes and 4818 cells remaining in the expr matrix. 13:31:58 Removing low quality barcode spots. INFO [2022-07-19 13:32:01] no genes removed due to min cells/gene filter 13:32:01 Normalizing counts by sequencing depth. INFO [2022-07-19 13:32:01] normalizing counts matrix by depth INFO [2022-07-19 13:32:03] Computed total sum normalization factor as median libsize: 3928.000000 13:32:04 Conducting anscombe and logarithmic transformation. INFO [2022-07-19 13:32:04] transforming log2xplus1() 13:32:06 Applying maximal threshold bounds. INFO [2022-07-19 13:32:11] ::process_data:setting max centered expr, threshold set to: +/-: 2.6 13:32:13 Smoothing by chromosome. INFO [2022-07-19 13:32:12] smooth_by_chromosome: chr: 0 INFO [2022-07-19 13:32:16] smooth_by_chromosome: chr: 1 INFO [2022-07-19 13:32:21] smooth_by_chromosome: chr: 2 INFO [2022-07-19 13:32:26] smooth_by_chromosome: chr: 3 INFO [2022-07-19 13:32:31] smooth_by_chromosome: chr: 4 INFO [2022-07-19 13:32:35] smooth_by_chromosome: chr: 5 INFO [2022-07-19 13:32:40] smooth_by_chromosome: chr: 6 INFO [2022-07-19 13:32:44] smooth_by_chromosome: chr: 7 INFO [2022-07-19 13:32:49] smooth_by_chromosome: chr: 8 INFO [2022-07-19 13:32:53] smooth_by_chromosome: chr: 9 INFO [2022-07-19 13:32:58] smooth_by_chromosome: chr: 10 INFO [2022-07-19 13:33:02] smooth_by_chromosome: chr: 11 INFO [2022-07-19 13:33:07] smooth_by_chromosome: chr: 12 INFO [2022-07-19 13:33:12] smooth_by_chromosome: chr: 13 INFO [2022-07-19 13:33:16] smooth_by_chromosome: chr: 14 INFO [2022-07-19 13:33:20] smooth_by_chromosome: chr: 15 INFO [2022-07-19 13:33:24] smooth_by_chromosome: chr: 16 INFO [2022-07-19 13:33:28] smooth_by_chromosome: chr: 17 INFO [2022-07-19 13:33:34] smooth_by_chromosome: chr: 18 INFO [2022-07-19 13:33:37] smooth_by_chromosome: chr: 19 INFO [2022-07-19 13:33:42] smooth_by_chromosome: chr: 20 INFO [2022-07-19 13:33:46] smooth_by_chromosome: chr: 21 INFO [2022-07-19 13:33:49] smooth_by_chromosome: chr: 22 INFO [2022-07-19 13:33:53] smooth_by_chromosome: chr: 23 13:33:59 Centering cell expression across chromosome. INFO [2022-07-19 13:33:59] ::center_smooth across chromosomes per cell 13:34:03 Subtracting reference expression from observed expression. INFO [2022-07-19 13:34:02] ::subtract_ref_expr_from_obs:Start inv_log=TRUE, use_bounds=TRUE INFO [2022-07-19 13:34:02] subtracting mean(normal) per gene per cell across all data INFO [2022-07-19 13:34:06] -subtracting expr per gene, use_bounds=TRUE 13:34:09 Clearing noise via reference mean standard deviation. INFO [2022-07-19 13:34:09] invert_log2(), computing 2^x INFO [2022-07-19 13:34:10] denoising using mean(normal) +- sd_amplifier * sd(normal) per gene per cell across all data INFO [2022-07-19 13:34:10] :: clear_noise_via_ref_quantiles : removing noise between bounds: 0.967257138207395 - 1.0327428617926 13:34:11 Removing outliers. INFO [2022-07-19 13:34:11] ::remove_outlier_norm:Start out_method: average_bound lower_bound: NA upper_bound: NA INFO [2022-07-19 13:34:11] ::remove_outlier_norm:Start out_method: average_bound lower_bound: NA upper_bound: NA INFO [2022-07-19 13:34:11] ::remove_outlier_norm using method: average_bound for defining outliers. INFO [2022-07-19 13:34:15] outlier bounds defined between: 0.91917 - 1.12623 13:34:16 Defining significant tumor subclusters. INFO [2022-07-19 13:34:16] define_signif_tumor_subclusters(p_val=0.05 INFO [2022-07-19 13:34:16] define_signif_tumor_subclusters(), tumor: slide1 INFO [2022-07-19 13:38:31] cut height based on p_val(0.05) = 4.71875 and partition_method: qnorm INFO [2022-07-19 13:38:31] cut tree into: 30 groups INFO [2022-07-19 13:38:31] -processing slide1,slide1_s1 INFO [2022-07-19 13:38:31] -processing slide1,slide1_s2 INFO [2022-07-19 13:38:31] -processing slide1,slide1_s3 INFO [2022-07-19 13:38:31] -processing slide1,slide1_s4 INFO [2022-07-19 13:38:31] -processing slide1,slide1_s5 INFO [2022-07-19 13:38:31] -processing slide1,slide1_s6 INFO [2022-07-19 13:38:31] -processing slide1,slide1_s7 INFO [2022-07-19 13:38:31] -processing slide1,slide1_s8 INFO [2022-07-19 13:38:31] -processing slide1,slide1_s9 INFO [2022-07-19 13:38:31] -processing slide1,slide1_s10 INFO [2022-07-19 13:38:31] -processing slide1,slide1_s11 INFO [2022-07-19 13:38:31] -processing slide1,slide1_s12 INFO [2022-07-19 13:38:31] -processing slide1,slide1_s13 INFO [2022-07-19 13:38:31] -processing slide1,slide1_s14 INFO [2022-07-19 13:38:31] -processing slide1,slide1_s15 INFO [2022-07-19 13:38:31] -processing slide1,slide1_s16 INFO [2022-07-19 13:38:31] -processing slide1,slide1_s17 INFO [2022-07-19 13:38:31] -processing slide1,slide1_s18 INFO [2022-07-19 13:38:31] -processing slide1,slide1_s19 INFO [2022-07-19 13:38:31] -processing slide1,slide1_s20 INFO [2022-07-19 13:38:31] -processing slide1,slide1_s21 INFO [2022-07-19 13:38:31] -processing slide1,slide1_s22 INFO [2022-07-19 13:38:31] -processing slide1,slide1_s23 INFO [2022-07-19 13:38:31] -processing slide1,slide1_s24 INFO [2022-07-19 13:38:31] -processing slide1,slide1_s25 INFO [2022-07-19 13:38:31] -processing slide1,slide1_s26 INFO [2022-07-19 13:38:31] -processing slide1,slide1_s27 INFO [2022-07-19 13:38:31] -processing slide1,slide1_s28 INFO [2022-07-19 13:38:31] -processing slide1,slide1_s29 INFO [2022-07-19 13:38:31] -processing slide1,slide1_s30 INFO [2022-07-19 13:38:31] define_signif_tumor_subclusters(), tumor: ref INFO [2022-07-19 13:41:14] cut height based on p_val(0.05) = 3.12634 and partition_method: qnorm INFO [2022-07-19 13:41:14] cut tree into: 94 groups INFO [2022-07-19 13:41:14] -processing ref,ref_s1 INFO [2022-07-19 13:41:14] -processing ref,ref_s2 INFO [2022-07-19 13:41:14] -processing ref,ref_s3 INFO [2022-07-19 13:41:14] -processing ref,ref_s4 INFO [2022-07-19 13:41:14] -processing ref,ref_s5 INFO [2022-07-19 13:41:14] -processing ref,ref_s6 INFO [2022-07-19 13:41:14] -processing ref,ref_s7 INFO [2022-07-19 13:41:14] -processing ref,ref_s8 INFO [2022-07-19 13:41:14] -processing ref,ref_s9 INFO [2022-07-19 13:41:14] -processing ref,ref_s10 INFO [2022-07-19 13:41:14] -processing ref,ref_s11 INFO [2022-07-19 13:41:14] -processing ref,ref_s12 INFO [2022-07-19 13:41:14] -processing ref,ref_s13 INFO [2022-07-19 13:41:14] -processing ref,ref_s14 INFO [2022-07-19 13:41:14] -processing ref,ref_s15 INFO [2022-07-19 13:41:14] -processing ref,ref_s16 INFO [2022-07-19 13:41:14] -processing ref,ref_s17 INFO [2022-07-19 13:41:14] -processing ref,ref_s18 INFO [2022-07-19 13:41:14] -processing ref,ref_s19 INFO [2022-07-19 13:41:14] -processing ref,ref_s20 INFO [2022-07-19 13:41:14] -processing ref,ref_s21 INFO [2022-07-19 13:41:14] -processing ref,ref_s22 INFO [2022-07-19 13:41:14] -processing ref,ref_s23 INFO [2022-07-19 13:41:14] -processing ref,ref_s24 INFO [2022-07-19 13:41:14] -processing ref,ref_s25 INFO [2022-07-19 13:41:14] -processing ref,ref_s26 INFO [2022-07-19 13:41:14] -processing ref,ref_s27 INFO [2022-07-19 13:41:14] -processing ref,ref_s28 INFO [2022-07-19 13:41:14] -processing ref,ref_s29 INFO [2022-07-19 13:41:14] -processing ref,ref_s30 INFO [2022-07-19 13:41:14] -processing ref,ref_s31 INFO [2022-07-19 13:41:14] -processing ref,ref_s32 INFO [2022-07-19 13:41:14] -processing ref,ref_s33 INFO [2022-07-19 13:41:14] -processing ref,ref_s34 INFO [2022-07-19 13:41:14] -processing ref,ref_s35 INFO [2022-07-19 13:41:14] -processing ref,ref_s36 INFO [2022-07-19 13:41:14] -processing ref,ref_s37 INFO [2022-07-19 13:41:14] -processing ref,ref_s38 INFO [2022-07-19 13:41:14] -processing ref,ref_s39 INFO [2022-07-19 13:41:14] -processing ref,ref_s40 INFO [2022-07-19 13:41:14] -processing ref,ref_s41 INFO [2022-07-19 13:41:14] -processing ref,ref_s42 INFO [2022-07-19 13:41:14] -processing ref,ref_s43 INFO [2022-07-19 13:41:14] -processing ref,ref_s44 INFO [2022-07-19 13:41:14] -processing ref,ref_s45 INFO [2022-07-19 13:41:14] -processing ref,ref_s46 INFO [2022-07-19 13:41:14] -processing ref,ref_s47 INFO [2022-07-19 13:41:14] -processing ref,ref_s48 INFO [2022-07-19 13:41:14] -processing ref,ref_s49 INFO [2022-07-19 13:41:14] -processing ref,ref_s50 INFO [2022-07-19 13:41:14] -processing ref,ref_s51 INFO [2022-07-19 13:41:14] -processing ref,ref_s52 INFO [2022-07-19 13:41:14] -processing ref,ref_s53 INFO [2022-07-19 13:41:14] -processing ref,ref_s54 INFO [2022-07-19 13:41:14] -processing ref,ref_s55 INFO [2022-07-19 13:41:14] -processing ref,ref_s56 INFO [2022-07-19 13:41:14] -processing ref,ref_s57 INFO [2022-07-19 13:41:14] -processing ref,ref_s58 INFO [2022-07-19 13:41:14] -processing ref,ref_s59 INFO [2022-07-19 13:41:14] -processing ref,ref_s60 INFO [2022-07-19 13:41:14] -processing ref,ref_s61 INFO [2022-07-19 13:41:14] -processing ref,ref_s62 INFO [2022-07-19 13:41:14] -processing ref,ref_s63 INFO [2022-07-19 13:41:14] -processing ref,ref_s64 INFO [2022-07-19 13:41:14] -processing ref,ref_s65 INFO [2022-07-19 13:41:14] -processing ref,ref_s66 INFO [2022-07-19 13:41:14] -processing ref,ref_s67 INFO [2022-07-19 13:41:14] -processing ref,ref_s68 INFO [2022-07-19 13:41:14] -processing ref,ref_s69 INFO [2022-07-19 13:41:14] -processing ref,ref_s70 INFO [2022-07-19 13:41:14] -processing ref,ref_s71 INFO [2022-07-19 13:41:14] -processing ref,ref_s72 INFO [2022-07-19 13:41:14] -processing ref,ref_s73 INFO [2022-07-19 13:41:14] -processing ref,ref_s74 INFO [2022-07-19 13:41:14] -processing ref,ref_s75 INFO [2022-07-19 13:41:14] -processing ref,ref_s76 INFO [2022-07-19 13:41:14] -processing ref,ref_s77 INFO [2022-07-19 13:41:14] -processing ref,ref_s78 INFO [2022-07-19 13:41:14] -processing ref,ref_s79 INFO [2022-07-19 13:41:14] -processing ref,ref_s80 INFO [2022-07-19 13:41:14] -processing ref,ref_s81 INFO [2022-07-19 13:41:14] -processing ref,ref_s82 INFO [2022-07-19 13:41:14] -processing ref,ref_s83 INFO [2022-07-19 13:41:14] -processing ref,ref_s84 INFO [2022-07-19 13:41:14] -processing ref,ref_s85 INFO [2022-07-19 13:41:14] -processing ref,ref_s86 INFO [2022-07-19 13:41:14] -processing ref,ref_s87 INFO [2022-07-19 13:41:14] -processing ref,ref_s88 INFO [2022-07-19 13:41:14] -processing ref,ref_s89 INFO [2022-07-19 13:41:14] -processing ref,ref_s90 INFO [2022-07-19 13:41:14] -processing ref,ref_s91 INFO [2022-07-19 13:41:14] -processing ref,ref_s92 INFO [2022-07-19 13:41:14] -processing ref,ref_s93 INFO [2022-07-19 13:41:14] -processing ref,ref_s94 13:41:14 Copy number variation pipeline completed. 13:41:14 Saving infercnv-object under 'test_cnv/infercnv-obj.RDS'. 13:41:27 Plotting results. INFO [2022-07-19 13:41:26] ::plot_cnv:Start INFO [2022-07-19 13:41:26] ::plot_cnv:Current data dimensions (r,c)=9869,4818 Total=47653086.2879817 Min=0.919170051016159 Max=1.12623258696454. INFO [2022-07-19 13:41:27] ::plot_cnv:Depending on the size of the matrix this may take a moment. INFO [2022-07-19 13:41:27] plot_cnv(): auto thresholding at: (0.873767 , 1.126233) INFO [2022-07-19 13:41:28] plot_cnv_observation:Start INFO [2022-07-19 13:41:28] Observation data size: Cells= 2704 Genes= 9869 INFO [2022-07-19 13:41:28] plot_cnv_observation:Writing observation groupings/color. INFO [2022-07-19 13:41:28] plot_cnv_observation:Done writing observation groupings/color. INFO [2022-07-19 13:41:28] plot_cnv_observation:Writing observation heatmap thresholds. INFO [2022-07-19 13:41:28] plot_cnv_observation:Done writing observation heatmap thresholds. INFO [2022-07-19 13:41:32] Colors for breaks: #00008B,#24249B,#4848AB,#6D6DBC,#9191CC,#B6B6DD,#DADAEE,#FFFFFF,#EEDADA,#DDB6B6,#CC9191,#BC6D6D,#AB4848,#9B2424,#8B0000 INFO [2022-07-19 13:41:32] Quantiles of plotted data range: 0.919170051016159,1,1,1,1.12623258696454 INFO [2022-07-19 13:41:34] plot_cnv_observations:Writing observation data to test_cnv/infercnv.outliers_removed.observations.txt INFO [2022-07-19 13:41:59] plot_cnv_references:Start INFO [2022-07-19 13:41:59] Reference data size: Cells= 2114 Genes= 9869 INFO [2022-07-19 13:44:49] plot_cnv_references:Number reference groups= 1 INFO [2022-07-19 13:44:49] plot_cnv_references:Plotting heatmap. INFO [2022-07-19 13:44:52] Colors for breaks: #00008B,#24249B,#4848AB,#6D6DBC,#9191CC,#B6B6DD,#DADAEE,#FFFFFF,#EEDADA,#DDB6B6,#CC9191,#BC6D6D,#AB4848,#9B2424,#8B0000 INFO [2022-07-19 13:44:52] Quantiles of plotted data range: 0.919170051016159,1,1,1,1.12623258696454 INFO [2022-07-19 13:44:53] plot_cnv_references:Writing reference data to test_cnv/infercnv.outliers_removed.references.txt 13:45:23 Summarizing cnv-results by chromosome. 13:45:25 Adding results to the spata-object's feature data. 13:45:25 Computing PCA based on cnv results. 13:45:32 Scaling data. 13:45:32 Done. 13:45:32 Done. Warning message: In addFeatures(object = object, feature_df = ordered_cnv_df2, overwrite = TRUE) : Only 2704 barcode-spots of 2706 were found in 'feature_df'. Not found barcode-spots obtain NAs for all features to be joined.
However the function getCnvResults(spata_obj) returns NULL
Good day to you
Hi @Dantferno, sorry for the long delay. In case this is still of interest, please retry with our updated SPATA2 v3 and the novel CNV analysis tutorial.
Hi,
When running the CNV analysis on tumor #T275 using the
runCnvAnalysis
function, an error message occurred:"13:24:54 Checking input for reference data. 13:24:54 Combining input and reference data. 13:24:55 Getting gene positions. Error in base::is.data.frame(gene_pos_df) : promise already under evaluation: recursive default argument reference or earlier problems?"
What may cause this problem?