Error in .plot_cnv_references(infercnv_obj = infercnv_obj, ref_data = ref_data_t, : Error

R version 4.0.2 (2020-06-22) -- "Taking Off Again"
Copyright (C) 2020 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64 (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> dir.create("plot_out/inferCNV_output2")#
Warning message:
In dir.create("plot_out/inferCNV_output2") :
  'plot_out\inferCNV_output2' already exists
> rm(list=ls())
> options(stringsAsFactors = F)
> library(Seurat)

Seurat v4 will be going to CRAN in the near future;
 for more details, please visit https://satijalab.org/seurat/v4_changes

Warning message:
程辑包‘Seurat’是用R版本4.0.3 来建造的 
> library(ggplot2)
> library(infercnv)
Warning message:
程辑包‘infercnv’是用R版本4.0.3 来建造的 
> expFile='expFile.txt'
> groupFiles='groupFiles.txt'
> geneFile='geneFile.txt'
> infercnv_obj = CreateInfercnvObject(raw_counts_matrix=expFile,
+                                     annotations_file=groupFiles,
+                                     delim="\t",
+                                     gene_order_file= geneFile,
+                                     ref_group_names=c('ref-endo' ,'ref-fib'))  ## 这个取决于自己的分组信息里面的
INFO [2021-03-10 23:45:35] Parsing matrix: expFile.txt
INFO [2021-03-10 23:47:03] Parsing gene order file: geneFile.txt
INFO [2021-03-10 23:47:03] Parsing cell annotations file: groupFiles.txt
INFO [2021-03-10 23:47:03] ::order_reduce:Start.
INFO [2021-03-10 23:47:04] .order_reduce(): expr and order match.
INFO [2021-03-10 23:47:04] ::process_data:order_reduce:Reduction from positional data, new dimensions (r,c) = 23449,6903 Total=9940369717 Min=0 Max=10408713.
INFO [2021-03-10 23:47:05] num genes removed taking into account provided gene ordering list: 1102 = 4.69956074885923% removed.
INFO [2021-03-10 23:47:05] -filtering out cells < 100 or > Inf, removing 0 % of cells
INFO [2021-03-10 23:47:09] validating infercnv_obj
> dir.create("plot_out/inferCNV_output2")#
Warning message:
In dir.create("plot_out/inferCNV_output2") :
  'plot_out\inferCNV_output2' already exists
> start_time <- Sys.time()
> infercnv_obj2 = infercnv::run(infercnv_obj,
+                              cutoff=1,  
+                              out_dir=  'plot_out/inferCNV_output2' , 
+                              cluster_by_groups=F,   # cluster
+                               hclust_method="ward.D2", 
+                              plot_steps=F,
+                              denoise=F,
+                              HMM=F) 
INFO [2021-03-10 23:47:20] ::process_data:Start
INFO [2021-03-10 23:47:20] Checking for saved results.
INFO [2021-03-10 23:47:20] Trying to reload from step 15
INFO [2021-03-10 23:47:29] Trying to reload from step 14
INFO [2021-03-10 23:47:37] Trying to reload from step 12
INFO [2021-03-10 23:47:45] Trying to reload from step 11
INFO [2021-03-10 23:47:53] Trying to reload from step 10
INFO [2021-03-10 23:48:01] Trying to reload from step 9
INFO [2021-03-10 23:48:08] Trying to reload from step 8
INFO [2021-03-10 23:48:16] Trying to reload from step 4
INFO [2021-03-10 23:48:22] Trying to reload from step 3
INFO [2021-03-10 23:48:27] Trying to reload from step 2
INFO [2021-03-10 23:48:31] Using backup from step 2
INFO [2021-03-10 23:48:31] 
STEP 1: incoming data

INFO [2021-03-10 23:48:31]

STEP 02: Removing lowly expressed genes

INFO [2021-03-10 23:48:31]

STEP 03: normalization by sequencing depth

INFO [2021-03-10 23:48:31] normalizing counts matrix by depth
INFO [2021-03-10 23:48:40] Computed total sum normalization factor as median libsize: 956458.000000
INFO [2021-03-10 23:49:29]

STEP 04: log transformation of data

INFO [2021-03-10 23:49:29] transforming log2xplus1()
INFO [2021-03-10 23:50:18]

STEP 08: removing average of reference data (before smoothing)

INFO [2021-03-10 23:50:18] ::subtract_ref_expr_from_obs:Start inv_log=FALSE, use_bounds=TRUE
INFO [2021-03-10 23:50:18] subtracting mean(normal) per gene per cell across all data
INFO [2021-03-10 23:50:40] -subtracting expr per gene, use_bounds=TRUE
INFO [2021-03-10 23:52:02]

STEP 09: apply max centered expression threshold: 3

INFO [2021-03-10 23:52:02] ::process_data:setting max centered expr, threshold set to: +/-: 3
INFO [2021-03-10 23:53:11]

STEP 10: Smoothing data per cell by chromosome

INFO [2021-03-10 23:53:11] smooth_by_chromosome: chr: chr1
INFO [2021-03-10 23:53:23] smooth_by_chromosome: chr: chr10
INFO [2021-03-10 23:53:32] smooth_by_chromosome: chr: chr11
INFO [2021-03-10 23:53:42] smooth_by_chromosome: chr: chr12
INFO [2021-03-10 23:53:52] smooth_by_chromosome: chr: chr13
INFO [2021-03-10 23:54:01] smooth_by_chromosome: chr: chr14
INFO [2021-03-10 23:54:09] smooth_by_chromosome: chr: chr15
INFO [2021-03-10 23:54:18] smooth_by_chromosome: chr: chr16
INFO [2021-03-10 23:54:27] smooth_by_chromosome: chr: chr17
INFO [2021-03-10 23:54:37] smooth_by_chromosome: chr: chr18
INFO [2021-03-10 23:54:45] smooth_by_chromosome: chr: chr19
INFO [2021-03-10 23:54:56] smooth_by_chromosome: chr: chr2
INFO [2021-03-10 23:55:07] smooth_by_chromosome: chr: chr20
INFO [2021-03-10 23:55:15] smooth_by_chromosome: chr: chr21
INFO [2021-03-10 23:55:22] smooth_by_chromosome: chr: chr22
INFO [2021-03-10 23:55:31] smooth_by_chromosome: chr: chr3
INFO [2021-03-10 23:55:41] smooth_by_chromosome: chr: chr4
INFO [2021-03-10 23:55:50] smooth_by_chromosome: chr: chr5
INFO [2021-03-10 23:56:00] smooth_by_chromosome: chr: chr6
INFO [2021-03-10 23:56:09] smooth_by_chromosome: chr: chr7
INFO [2021-03-10 23:56:20] smooth_by_chromosome: chr: chr8
INFO [2021-03-10 23:56:29] smooth_by_chromosome: chr: chr9
INFO [2021-03-10 23:57:53]

STEP 11: re-centering data across chromosome after smoothing

INFO [2021-03-10 23:57:53] ::center_smooth across chromosomes per cell
INFO [2021-03-10 23:59:44]

STEP 12: removing average of reference data (after smoothing)

INFO [2021-03-10 23:59:44] ::subtract_ref_expr_from_obs:Start inv_log=FALSE, use_bounds=TRUE
INFO [2021-03-10 23:59:44] subtracting mean(normal) per gene per cell across all data
INFO [2021-03-11 00:00:02] -subtracting expr per gene, use_bounds=TRUE
INFO [2021-03-11 00:01:23]

STEP 14: invert log2(FC) to FC

INFO [2021-03-11 00:01:23] invert_log2(), computing 2^x
INFO [2021-03-11 00:02:47]

STEP 15: Clustering samples (not defining tumor subclusters)

INFO [2021-03-11 00:02:47] define_signif_tumor_subclusters(p_val=0.1
INFO [2021-03-11 00:02:47] define_signif_tumor_subclusters(), tumor: all_observations
INFO [2021-03-11 04:16:28] cut tree into: 1 groups
INFO [2021-03-11 04:16:28] -processing all_observations,all_observations_s1
INFO [2021-03-11 04:16:28] define_signif_tumor_subclusters(), tumor: all_references
INFO [2021-03-11 04:21:47] cut tree into: 1 groups
INFO [2021-03-11 04:21:48] -processing all_references,all_references_s1
INFO [2021-03-11 04:26:45]

Making the final infercnv heatmap

INFO [2021-03-11 04:26:46] ::plot_cnv:Start
INFO [2021-03-11 04:26:46] ::plot_cnv:Current data dimensions (r,c)=15034,6903 Total=104935060.812655 Min=0.274614818050265 Max=3.47381304931877.
INFO [2021-03-11 04:26:47] ::plot_cnv:Depending on the size of the matrix this may take a moment.
INFO [2021-03-11 04:35:09] plot_cnv(): auto thresholding at: (0.478067 , 1.521933)
INFO [2021-03-11 04:35:14] plot_cnv_observation:Start
INFO [2021-03-11 04:35:14] Observation data size: Cells= 5903 Genes= 15034
INFO [2021-03-11 04:35:16] plot_cnv_observation:Writing observations by grouping.
INFO [2021-03-11 04:42:19] plot_cnv_observation:Writing observation groupings/color.
INFO [2021-03-11 04:42:19] plot_cnv_observation:Done writing observation groupings/color.
INFO [2021-03-11 04:42:20] plot_cnv_observation:Writing observation heatmap thresholds.
INFO [2021-03-11 04:42:20] plot_cnv_observation:Done writing observation heatmap thresholds.
INFO [2021-03-11 04:43:17] Colors for breaks: #00008B,#24249B,#4848AB,#6D6DBC,#9191CC,#B6B6DD,#DADAEE,#FFFFFF,#EEDADA,#DDB6B6,#CC9191,#BC6D6D,#AB4848,#9B2424,#8B0000
INFO [2021-03-11 04:43:17] Quantiles of plotted data range: 0.478066971720371,0.917554531504774,1,1.08606377720558,1.52193302827963
INFO [2021-03-11 04:43:37] plot_cnv_observations:Writing observation data to plot_out/inferCNV_output2/infercnv.observations.txt
INFO [2021-03-11 04:50:50] plot_cnv_references:Start
INFO [2021-03-11 04:50:50] Reference data size: Cells= 1000 Genes= 15034
ERROR [2021-03-11 04:50:50] Unexpected error, should not happen.
R version 4.0.2 (2020-06-22) -- "Taking Off Again"
Copyright (C) 2020 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64 (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> dir.create("plot_out/inferCNV_output2")#
Warning message:
In dir.create("plot_out/inferCNV_output2") :
  'plot_out\inferCNV_output2' already exists
> rm(list=ls())
> options(stringsAsFactors = F)
> library(Seurat)

Seurat v4 will be going to CRAN in the near future;
 for more details, please visit https://satijalab.org/seurat/v4_changes

Warning message:
程辑包‘Seurat’是用R版本4.0.3 来建造的 
> library(ggplot2)
> library(infercnv)
Warning message:
程辑包‘infercnv’是用R版本4.0.3 来建造的 
> expFile='expFile.txt'
> groupFiles='groupFiles.txt'
> geneFile='geneFile.txt'
> infercnv_obj = CreateInfercnvObject(raw_counts_matrix=expFile,
+                                     annotations_file=groupFiles,
+                                     delim="\t",
+                                     gene_order_file= geneFile,
+                                     ref_group_names=c('ref-endo' ,'ref-fib'))  ## 这个取决于自己的分组信息里面的
INFO [2021-03-10 23:45:35] Parsing matrix: expFile.txt
INFO [2021-03-10 23:47:03] Parsing gene order file: geneFile.txt
INFO [2021-03-10 23:47:03] Parsing cell annotations file: groupFiles.txt
INFO [2021-03-10 23:47:03] ::order_reduce:Start.
INFO [2021-03-10 23:47:04] .order_reduce(): expr and order match.
INFO [2021-03-10 23:47:04] ::process_data:order_reduce:Reduction from positional data, new dimensions (r,c) = 23449,6903 Total=9940369717 Min=0 Max=10408713.
INFO [2021-03-10 23:47:05] num genes removed taking into account provided gene ordering list: 1102 = 4.69956074885923% removed.
INFO [2021-03-10 23:47:05] -filtering out cells < 100 or > Inf, removing 0 % of cells
INFO [2021-03-10 23:47:09] validating infercnv_obj
> dir.create("plot_out/inferCNV_output2")#
Warning message:
In dir.create("plot_out/inferCNV_output2") :
  'plot_out\inferCNV_output2' already exists
> start_time <- Sys.time()
> infercnv_obj2 = infercnv::run(infercnv_obj,
+                              cutoff=1,  
+                              out_dir=  'plot_out/inferCNV_output2' , 
+                              cluster_by_groups=F,   # cluster
+                               hclust_method="ward.D2", 
+                              plot_steps=F,
+                              denoise=F,
+                              HMM=F) 
INFO [2021-03-10 23:47:20] ::process_data:Start
INFO [2021-03-10 23:47:20] Checking for saved results.
INFO [2021-03-10 23:47:20] Trying to reload from step 15
INFO [2021-03-10 23:47:29] Trying to reload from step 14
INFO [2021-03-10 23:47:37] Trying to reload from step 12
INFO [2021-03-10 23:47:45] Trying to reload from step 11
INFO [2021-03-10 23:47:53] Trying to reload from step 10
INFO [2021-03-10 23:48:01] Trying to reload from step 9
INFO [2021-03-10 23:48:08] Trying to reload from step 8
INFO [2021-03-10 23:48:16] Trying to reload from step 4
INFO [2021-03-10 23:48:22] Trying to reload from step 3
INFO [2021-03-10 23:48:27] Trying to reload from step 2
INFO [2021-03-10 23:48:31] Using backup from step 2
INFO [2021-03-10 23:48:31] 
STEP 1: incoming data

INFO [2021-03-10 23:48:31]

STEP 02: Removing lowly expressed genes

INFO [2021-03-10 23:48:31]

STEP 03: normalization by sequencing depth

INFO [2021-03-10 23:48:31] normalizing counts matrix by depth
INFO [2021-03-10 23:48:40] Computed total sum normalization factor as median libsize: 956458.000000
INFO [2021-03-10 23:49:29]

STEP 04: log transformation of data

INFO [2021-03-10 23:49:29] transforming log2xplus1()
INFO [2021-03-10 23:50:18]

STEP 08: removing average of reference data (before smoothing)

INFO [2021-03-10 23:50:18] ::subtract_ref_expr_from_obs:Start inv_log=FALSE, use_bounds=TRUE
INFO [2021-03-10 23:50:18] subtracting mean(normal) per gene per cell across all data
INFO [2021-03-10 23:50:40] -subtracting expr per gene, use_bounds=TRUE
INFO [2021-03-10 23:52:02]

STEP 09: apply max centered expression threshold: 3

INFO [2021-03-10 23:52:02] ::process_data:setting max centered expr, threshold set to: +/-: 3
INFO [2021-03-10 23:53:11]

STEP 10: Smoothing data per cell by chromosome

INFO [2021-03-10 23:53:11] smooth_by_chromosome: chr: chr1
INFO [2021-03-10 23:53:23] smooth_by_chromosome: chr: chr10
INFO [2021-03-10 23:53:32] smooth_by_chromosome: chr: chr11
INFO [2021-03-10 23:53:42] smooth_by_chromosome: chr: chr12
INFO [2021-03-10 23:53:52] smooth_by_chromosome: chr: chr13
INFO [2021-03-10 23:54:01] smooth_by_chromosome: chr: chr14
INFO [2021-03-10 23:54:09] smooth_by_chromosome: chr: chr15
INFO [2021-03-10 23:54:18] smooth_by_chromosome: chr: chr16
INFO [2021-03-10 23:54:27] smooth_by_chromosome: chr: chr17
INFO [2021-03-10 23:54:37] smooth_by_chromosome: chr: chr18
INFO [2021-03-10 23:54:45] smooth_by_chromosome: chr: chr19
INFO [2021-03-10 23:54:56] smooth_by_chromosome: chr: chr2
INFO [2021-03-10 23:55:07] smooth_by_chromosome: chr: chr20
INFO [2021-03-10 23:55:15] smooth_by_chromosome: chr: chr21
INFO [2021-03-10 23:55:22] smooth_by_chromosome: chr: chr22
INFO [2021-03-10 23:55:31] smooth_by_chromosome: chr: chr3
INFO [2021-03-10 23:55:41] smooth_by_chromosome: chr: chr4
INFO [2021-03-10 23:55:50] smooth_by_chromosome: chr: chr5
INFO [2021-03-10 23:56:00] smooth_by_chromosome: chr: chr6
INFO [2021-03-10 23:56:09] smooth_by_chromosome: chr: chr7
INFO [2021-03-10 23:56:20] smooth_by_chromosome: chr: chr8
INFO [2021-03-10 23:56:29] smooth_by_chromosome: chr: chr9
INFO [2021-03-10 23:57:53]

STEP 11: re-centering data across chromosome after smoothing

INFO [2021-03-10 23:57:53] ::center_smooth across chromosomes per cell
INFO [2021-03-10 23:59:44]

STEP 12: removing average of reference data (after smoothing)

INFO [2021-03-10 23:59:44] ::subtract_ref_expr_from_obs:Start inv_log=FALSE, use_bounds=TRUE
INFO [2021-03-10 23:59:44] subtracting mean(normal) per gene per cell across all data
INFO [2021-03-11 00:00:02] -subtracting expr per gene, use_bounds=TRUE
INFO [2021-03-11 00:01:23]

STEP 14: invert log2(FC) to FC

INFO [2021-03-11 00:01:23] invert_log2(), computing 2^x
INFO [2021-03-11 00:02:47]

STEP 15: Clustering samples (not defining tumor subclusters)

INFO [2021-03-11 00:02:47] define_signif_tumor_subclusters(p_val=0.1
INFO [2021-03-11 00:02:47] define_signif_tumor_subclusters(), tumor: all_observations
INFO [2021-03-11 04:16:28] cut tree into: 1 groups
INFO [2021-03-11 04:16:28] -processing all_observations,all_observations_s1
INFO [2021-03-11 04:16:28] define_signif_tumor_subclusters(), tumor: all_references
INFO [2021-03-11 04:21:47] cut tree into: 1 groups
INFO [2021-03-11 04:21:48] -processing all_references,all_references_s1
INFO [2021-03-11 04:26:45]

Making the final infercnv heatmap

INFO [2021-03-11 04:26:46] ::plot_cnv:Start
INFO [2021-03-11 04:26:46] ::plot_cnv:Current data dimensions (r,c)=15034,6903 Total=104935060.812655 Min=0.274614818050265 Max=3.47381304931877.
INFO [2021-03-11 04:26:47] ::plot_cnv:Depending on the size of the matrix this may take a moment.
INFO [2021-03-11 04:35:09] plot_cnv(): auto thresholding at: (0.478067 , 1.521933)
INFO [2021-03-11 04:35:14] plot_cnv_observation:Start
INFO [2021-03-11 04:35:14] Observation data size: Cells= 5903 Genes= 15034
INFO [2021-03-11 04:35:16] plot_cnv_observation:Writing observations by grouping.
INFO [2021-03-11 04:42:19] plot_cnv_observation:Writing observation groupings/color.
INFO [2021-03-11 04:42:19] plot_cnv_observation:Done writing observation groupings/color.
INFO [2021-03-11 04:42:20] plot_cnv_observation:Writing observation heatmap thresholds.
INFO [2021-03-11 04:42:20] plot_cnv_observation:Done writing observation heatmap thresholds.
INFO [2021-03-11 04:43:17] Colors for breaks: #00008B,#24249B,#4848AB,#6D6DBC,#9191CC,#B6B6DD,#DADAEE,#FFFFFF,#EEDADA,#DDB6B6,#CC9191,#BC6D6D,#AB4848,#9B2424,#8B0000
INFO [2021-03-11 04:43:17] Quantiles of plotted data range: 0.478066971720371,0.917554531504774,1,1.08606377720558,1.52193302827963
INFO [2021-03-11 04:43:37] plot_cnv_observations:Writing observation data to plot_out/inferCNV_output2/infercnv.observations.txt
INFO [2021-03-11 04:50:50] plot_cnv_references:Start
INFO [2021-03-11 04:50:50] Reference data size: Cells= 1000 Genes= 15034
ERROR [2021-03-11 04:50:50] Unexpected error, should not happen.
Error in .plot_cnv_references(infercnv_obj = infercnv_obj, ref_data = ref_data_t, :
Error

end_time <- Sys.time()
end_time - start_time
Time difference of 5.058306 hours

end_time <- Sys.time()
end_time - start_time
Time difference of 5.058306 hours

cluster_by_groups=T
will solve the problem

你可能感兴趣的:(Error in .plot_cnv_references(infercnv_obj = infercnv_obj, ref_data = ref_data_t, : Error)