forked from xxywmt/KS-account-codes
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path代码报错记录-KS科研分享与服务公众号团队整理记录.txt
More file actions
executable file
·800 lines (585 loc) · 36.4 KB
/
代码报错记录-KS科研分享与服务公众号团队整理记录.txt
File metadata and controls
executable file
·800 lines (585 loc) · 36.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
KS科研分享与服务公众号团队整理记录:
#==========================================================================
# R语言错误整理集合
#==========================================================================
#2023年3月
#Error1:Error in .Call.graphics(C_palette2, .Call(C_palette2, NULL)) : invalid graphics state
@解决:dev.off()
#重新输入代码即可
# Error2: Failed to install 'unknown package' from GitHub:
# Timeout was reached: [api.github.com] Connection timed out after 10001 milliseconds
#从devtools::install_github安装包的时候
@解决:稍安勿躁等待一下,多试几次,网络好了就可以,除非它的安装失效了(不要去弄乱七八糟的修改)
#github安装R包得时候
# Downloading GitHub repo zktuong/ktplots@HEAD
# Error: Failed to install 'ktplots' from GitHub:
# lazy-load database '/home/R/x86_64-pc-linux-gnu-library/4.2/pkgbuild/R/pkgbuild.rdb' is corrupt
@解决:.rs.restartR()#重启Rstudio。但是之前环境保留
#ERROR:加载R包时候出现的 library(iTALK)
# Error: package or namespace load failed for 'iTALK':
# Function found when exporting methods from the namespace 'DelayedArray' which is not S4 generic: 'aperm'
@解决:安装其他包:BiocManager::install('BiocGenerics',force = TRUE)
#Warning message:
#Removed 3 rows containing missing values (`geom_signif()`).
#ggplot作图使用geom_signif添加显著性,出现这个警告,图上没有显著性标注
@解决:这是因为y轴范围的问题
@解决:加上: scale_y_continuous()设置
#读取rds后缀的文件(直接双击打开)
#Error:Error in readRDS("~//Glia/Glia_inter.rds") : unknown input format
@解决:不用readRDS:使用load(就读取成功了):
load("~/Glia/Glia_inter.rds")
#这是一个莫名其妙出现的error,其实也是一个warning,不管运行什么,会出现一个(converted from warning)
#例子
# 'select()' returned 1:1 mapping between keys and columns
# Error in bitr(markers_MG_clear$gene, fromType = "SYMBOL", toType = "ENTREZID", :
# (converted from warning) 6.53% of input gene IDs are fail to map...
# 这个错误总是阻碍运行程序
@解决:设置一下就ok了:options(warn=0)
#使用par layout图的时候出现错误
#Error in plot.new() : figure margins too large
@解决:par(mfrow = c(5,3), mar=c(1,1,1,1))#加上mar=c(1,1,1,1)就ok
#==========================================================================
# R语言错误整理集合
#==========================================================================
#2023年6月
#ERROR=========================================================================================
#场景:服务器安装velocyto.R
#错误提示:
# /usr/bin/ld: cannot find -lboost_filesystem
# /usr/bin/ld: cannot find -lboost_system
# collect2: error: ld returned 1 exit status
# make: *** [/usr/share/R/share/make/shlib.mk:10: velocyto.R.so] Error 1
# ERROR: compilation failed for package ‘velocyto.R’
@解决办法:
##需要在终端安装两个包,然后返回重新安装就成功了,这也是这类错误的通用解决方式
# sudo apt-get install libboost-filesystem-dev
# sudo apt-get install libboost-system-dev
#ERROR=========================================================================================
#错误,install_github安装R包的时候,几次不成功,出现如下错误
# Error: Failed to install 'unknown package' from GitHub:
# HTTP error 403.
# API rate limit exceeded for 106.58.229.196. (But here's the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)
#
# Rate limit remaining: 0/60
# Rate limit reset at: 2023-04-17 07:11:53 UTC
#
# To increase your GitHub API rate limit
# - Use `usethis::create_github_token()` to create a Personal Access Token.
# - Use `usethis::edit_r_environ()` and add the token as `GITHUB_PAT`.
#其实解决办法已经给出来了,要么等事件,要么解决
@解决办法:需要你有github账号,没有就注册一个
#运行:usethis::create_github_token(),登录github
#然后在页面底部点击Generate token
#在返回的页面中复制Personal access tokens (classic),记得保存好
#在R里面运行:credentials::set_github_pat(), 在出现的框中粘贴你的Personal access tokens,点击ok
#然后继续安装install_github,就可以了
#ERROR=========================================================================================
#错误:scVelo运行RNA速率的时候
# AttributeError Traceback (most recent call last)
# Cell In[37], line 1
# ----> 1 scv.pl.velocity_embedding_stream(adata, basis='umap')
#
# File ~/miniconda3/envs/jupyter/lib/python3.8/site-packages/scvelo/plotting/velocity_embedding_stream.py:252, in velocity_embedding_stream(adata, basis, vkey, density, smooth, min_mass, cutoff_perc, arrow_color, arrow_size, arrow_style, max_length, integration_direction, linewidth, n_neighbors, recompute, color, use_raw, layer, color_map, colorbar, palette, size, alpha, perc, X, V, X_grid, V_grid, sort_order, groups, components, legend_loc, legend_fontsize, legend_fontweight, xlabel, ylabel, title, fontsize, figsize, dpi, frameon, show, save, ax, ncols, **kwargs)
# 249 ax.streamplot(X_grid[0], X_grid[1], V_grid[0], V_grid[1], **stream_kwargs)
# 251 size = 8 * default_size(adata) if size is None else size
# --> 252 ax = scatter(
# 253 adata,
# 254 layer=layer,
# 255 color=color,
# 256 size=size,
# 257 title=title,
# 258 ax=ax,
# 259 zorder=0,
# 260 **scatter_kwargs,
# 261 )
# 262 if save is True:
# 263 save = "embedding_stream"
#
# File ~/miniconda3/envs/jupyter/lib/python3.8/site-packages/scvelo/plotting/scatter.py:668, in scatter(adata, basis, x, y, vkey, color, use_raw, layer, color_map, colorbar, palette, size, alpha, linewidth, linecolor, perc, groups, sort_order, components, projection, legend_loc, legend_loc_lines, legend_fontsize, legend_fontweight, legend_fontoutline, legend_align_text, xlabel, ylabel, title, fontsize, figsize, xlim, ylim, add_density, add_assignments, add_linfit, add_polyfit, add_rug, add_text, add_text_pos, add_margin, add_outline, outline_width, outline_color, n_convolve, smooth, normalize_data, rescale_color, color_gradients, dpi, frameon, zorder, ncols, nrows, wspace, hspace, show, save, ax, **kwargs)
# 666 if not (add_outline is None or g_bool is None):
# 667 groups = add_outline
# --> 668 set_legend(
# 669 adata,
# 670 ax,
# 671 color,
# 672 legend_loc,
# 673 scatter_array,
# 674 legend_fontweight,
# 675 legend_fontsize,
# 676 legend_fontoutline,
# 677 legend_align_text,
# 678 groups,
# 679 )
# 680 if add_density:
# 681 plot_density(x, y, add_density, ax=ax)
#
# File ~/miniconda3/envs/jupyter/lib/python3.8/site-packages/scvelo/plotting/utils.py:555, in set_legend(adata, ax, value_to_plot, legend_loc, scatter_array, legend_fontweight, legend_fontsize, legend_fontoutline, legend_align_text, groups)
# 553 legend_fontoutline = 1
# 554 obs_vals = adata.obs[value_to_plot]
# --> 555 obs_vals.cat.categories = obs_vals.cat.categories.astype(str)
# 556 color_keys = adata.uns[f"{value_to_plot}_colors"]
# 557 if isinstance(color_keys, dict):
#
# File ~/miniconda3/envs/jupyter/lib/python3.8/site-packages/pandas/core/base.py:178, in NoNewAttributesMixin.__setattr__(self, key, value)
# 172 if getattr(self, "__frozen", False) and not (
# 173 key == "_cache"
# 174 or key in type(self).__dict__
# 175 or getattr(self, key, None) is not None
# 176 ):
# 177 raise AttributeError(f"You cannot add any new attribute '{key}'")
# --> 178 object.__setattr__(self, key, value)
#
# File ~/miniconda3/envs/jupyter/lib/python3.8/site-packages/pandas/core/accessor.py:99, in PandasDelegate._add_delegate_accessors.<locals>._create_delegator_property.<locals>._setter(self, new_values)
# 98 def _setter(self, new_values):
# ---> 99 return self._delegate_property_set(name, new_values)
#
# File ~/miniconda3/envs/jupyter/lib/python3.8/site-packages/pandas/core/arrays/categorical.py:2460, in CategoricalAccessor._delegate_property_set(self, name, new_values)
# 2459 def _delegate_property_set(self, name, new_values):
# -> 2460 return setattr(self._parent, name, new_values)
#
#!!!! AttributeError: can't set attribute
#原因:padans版本太高了,降低版本安装即可。之前的版本卸载
@解决办法:
pip uninstall pandas
pip install pandas==1.5.3 -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com
#ERROR=========================================================================================
#python:import scanpy报错
#可能是因为安装了别的包,在python import scanpy的时候报错
#TypeError: metaclass conflict: the metaclass of a derived class must be a (non-strict)
#原因是matplotlib的版本太高了,安装低于3.7的版本即可
pip install matplotlib==3.5 -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com
#然后继续import之后发现,又有新的错误
#ImportError: cannot import name 'is_categorical' from 'pandas.api.types' (C:\Users\AppData\Roaming\Python\Python39\site-packages\pandas\api\types\__init__.py)
#原因是pandas版本太高,我这里降低到1.4.2就可以用
pip install pandas==1.4.2 -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com
#ERROR=========================================================================================
#在使用library(cowplot)包组合多个list中的图片的时候出现这个错误
# Error in grid.Call(C_convert, x, as.integer(whatfrom), as.integer(whatto), :
# Viewport has zero dimension(s)
#不是代码和数据问题,原因是plot的窗口小了
@解决办法:把plot窗口拉大就可以了
#ERROR=========================================================================================
#numpy的报错
#AttributeError: module ‘numpy‘ has no attribute ‘float‘
#原因是numpy版本太高了,1.24.0才会出现
@解决办法:卸载目前的版本,安装之前的版本即可
pip uninstall numpy
pip install numpy==1.23.5
#ERROR=========================================================================================
#clusterProfiler做GSEA分析,莫名其妙出现如下的报错:
#Error in serialize(data, node$con) : error writing to connection
@解决办法:重启Rstudio,重现跑代码就ok了
#ERROR=========================================================================================
#clusterProfiler做分组GO分析,代码如下:
data_GO <- compareCluster(ENTREZID~group, data=data, fun="enrichGO",
OrgDb="org.Mm.eg.db",ont = "BP",pAdjustMethod = "BH",
pvalueCutoff = 0.05,qvalueCutoff = 0.1)
data_GO_sim <- simplify(data_GO,cutoff=0.7, by="p.adjust", select_fun=min)
#在跑simplify的时候出现报错:
# Error in simplify(data_GO, cutoff = 0.7, by = "p.adjust", select_fun = min) :
# unused arguments (cutoff = 0.7, by = "p.adjust", select_fun = min)
@解决办法:#原因是函数串线了。指定R包即可
data_GO_sim <- clusterProfiler::simplify(data_GO,cutoff=0.7, by="p.adjust", select_fun=min)
#ERROR=========================================================================================
#monocle2 ordercell 或者 BEAM报错
@解决办法:不论是QQ群还是微信群我们发布过monocle2终极解决R包,安装这个包就不会出任何问题
#ERROR=========================================================================================
#加载R包的时候出错:Package ‘MatrixGenerics’ version 1.8.1 cannot be unloaded
#这个unloaded不一定是MatrixGenerics,也有可能遇上其他的。
@解决办法:你能信、折腾半天,解决办法居然是重启Rstusio,再次加载没毛病
#==========================================================================
# R语言错误整理集合
#==========================================================================
#2023年7月
#ERROR=========================================================================================
#运行monocle3,cds <- cluster_cells(cds)发生报错:
#Error in leidenbase::leiden_find_partition(graph_result[["g"]], REAL() can only be applied to a 'numeric', not a 'NULL'
#原因:igraph的版本太高了,例如1.5.0
@解决办法:卸载原先的igraph,安装低版本的,我们测试1.3.5就可以了
remove.packages("igraph")
require(devtools)
install_version("igraph",version = '1.3.5', repos = "http://cran.us.r-project.org")
library(igraph)
library(monocle3)
#=========================================================================================
#运行monocle2出现错误
#Error in mutate()~:i In argument:pData(mouse monocle)$StateCaused by error:"CellDataSetuunable to find an inherited method for function pData' for signature
#原因:monoc3和monocle2冲突
@解决办法:一定记住,使用monocle2的时候不要加载monocle3,反之亦然
#=========================================================================================
#library(biomaRt)发生错误
# Error in { :
# task 1 failed - "package or namespace load failed for 'dbplyr':
# .onLoad failed in loadNamespace() for 'dbplyr', details:
# call: setClass(cl, contains = c(prevClass, "VIRTUAL"), where = where)
# error: error in contained classes ("character") for class "ident"; class definition removed from 'dbplyr'"
# 然后以为是没有加载dbplyr,继续 library(dbplyr), 发现还是出现这个错误
#这个error在很多地方出现,但是这里我成功解决的办法如下,对于其他的不知是否适用
@解决办法:
remove.packages("rlang")#删除这个包
install.packages("rlang")#重新安装,安装成功后重启Rstudio
library(rlang)
library(dbplyr)
library(biomaRt)#然后就成功了
#=========================================================================================
#R语言做某些图的时候出现纸样的Warning,导致图显示不全,或不正确
# Warning message:
# Computation failed in `stat_stratum()`
# Caused by error in `default_missing()`:
# ! could not find function "default_missing"
#原因:dplyr或者ggalluvial包的版本低了
@解决办法:dplyr 1.1.2 ,ggalluvial 0.12.5即可
#=========================================================================================
#运行如下代码发生错误
celltype_ratio <-scedata@meta.data %>%
group_by(group,celltype) %>%
summarise(n=n()) %>%
mutate(relative_freq = n/sum(n))
#Error
# Error in ~n()~:! Must only be used inside data-masking verbs like "mutate(), filter()', and "group by()'.Run rlang:;lasttrace() to see where the error occurred.
@解决办法:summarise前面加上dplyr
celltype_ratio <-scedata@meta.data %>%
group_by(group,celltype) %>%
dplyr::summarise(n=n()) %>%
mutate(relative_freq = n/sum(n))
#=========================================================================================
#Error
#这个也不能称之为一个错误
#事情是这样的,我不小心按了ctrl+shift+A键,导致Rstudio窗口全屏,退不出了
#网上查找发现,有人把四个窗口打乱了,可以使用快捷键恢复
@解决办法:Ctrl+Alt+Shift+0, 就会回复原来的布局了
#=========================================================================================
#Error
#pyscenic 分析第一步,终端中运行grn的时候报错
# preparing dask client
# parsing input
# creating dask graph
# 10 partitions
# computing dask graph
# not shutting down client, client was created externally
# finished
# distributed.worker - ERROR - Exception during execution of task infer_partial_network-1fad78969de74d650a57ebf5532dabbe.
#\\\
#反正很长的一串
#原因:大概率是因为线程数开大了,内存不够
@解决办法:减小num_workers数
#=========================================================================================
#Error
#Monocle2 plot_genes_branched_heatmap函数做分支热图的时候,出现如下错误
#Error in if (isSparseMatrix(exprs(X))) ! : the condition has length > 1
#按理来说,安装使用我们提过的monocle2终结解决版本,是不会有问题的,不过这个错误也是有一个解决办法
@解决办法:core=1的时候会报错,所以core设置为2或者其他
#==========================================================================
# R语言错误整理集合
#==========================================================================
#2023年8月
#ERROR=========================================================================================
#场景:Seurat做cellcycle,计算细胞周期的时候 SeuratObj[[x]] <- CellCycleScoring(SeuratObj[[x]], s.features = s.genes, g2m.features = g2m.genes, set.ident = FALSE)
#出现Error:
# Error in `cut_number()`:
# ! Insufficient data values to produce 24 bins.
#原因:相同数值,0表达的太多,导致ggplot函数出错
@解决办法:第一种,先做跑NormalizeData,再计算周期就可以了,这种最好使
SeuratObj <- NormalizeData(SeuratObj, normalization.method = "LogNormalize")
@解决办法:第二种,在CreateSeuratObject的时候,min.cell设置为1
#ERROR=========================================================================================
此ERROR及解决办法分别由KS科研分享与服务VIP群“一位不愿意透露性别的学长”和“宁怡乐”贡献,感谢
#cellchat运行出现错误---这也是一个通用错误,其他运行中出现类似错误可考虑
# ce11chat <- projectData(ce11chat, PPI.human)
# Error in isTRUE(r <- .Ca11(Dim_validate, object,"Matrix"))object 'Dim_validate' not found
#原因:Matrix包版本的原因
@解决办法:Matrix1.6不兼容,要1.5-4.1才行,https://cran.r-project.org/src/contrib/Archive/Matrix/Matrix_1.5-4.1.tar.gz
#ERROR=========================================================================================
#单细胞Seurat分析FindNeighbors出错
# Computing nearest neighbor graph
# Computing SNN
# Error in validityMethod(as(object, superClass)) :
# object 'Csparse_validate' not found
#原因:Matrix包版本的问题
@解决办法:重新安装,换成1.5-3版本加载就可以了
#ERROR=========================================================================================
#单细胞数据分析PrepSCTIntegration出现错误
# Warning: SCT model not present in assay
# Error in scale.data[anchor.features, ] :
# no 'dimnames' attribute for array
#原因:流程不对,没有先跑SCTransform
@解决办法:先跑SCTransform,再跑PrepSCTIntegration
#ERROR=========================================================================================
#Complexheatmap做热图的时候出错,没有出现图
# Error in grid.Call(C_convert, x, as.integer(whatfrom), as.integer(whatto), : Viewport has zero dimension(s)
#原因:画板不够大
@解决办法:拉大画板即可。如果是需要直接保存为pdf,那么pdf导出尺寸设置大一点
#ERROR=========================================================================================
#使用Seurat或者其他S4对象的时候出现莫名奇妙的错误
# Error in `[[<-`(`*tmp*`, name, value = value) :
# [[<- defined for objects of type "S4" only for subclasses of environment
@解决办法:重启R环境就可以了
#ERROR=========================================================================================
library(biomaRt)#发生错误
# Error in { :
# task 1 failed - "package or namespace load failed for 'dbplyr':
# .onLoad failed in loadNamespace() for 'dbplyr', details:
# call: setClass(cl, contains = c(prevClass, "VIRTUAL"), where = where)
# error: error in contained classes ("character") for class "ident"; class definition removed from 'dbplyr'"
@解决办法:下载biomaRt最新版,http://www.bioconductor.org/packages/release/bioc/src/contrib/biomaRt_2.56.1.tar.gz
#本地安装,加载就可以了
library(biomaRt)
#ERROR=========================================================================================
# python出现如下错误
# AttributeError: module 'scipy.stats' has no attribute 'median_absolute_deviation'
#原因:scipy包1.9.0以上的版本,原来的'stats.median_absolute_deviation' 改成了“stats.median_abs_deviation‘
@解决办法:要么降低版本,要么修改这个名称
#ERROR=========================================================================================
#ARchR中plotMarkerHeatmap函数,或者Complexheatmap函数作图出现如下错误
# Error in magick_image_write_frame(image, format = format, i = i) :
# Image must have at least 1 frame to write a bitmap
#原因:热图行超过16000行就会出现这个错误
@解决办法:不要画这个大的数据
#==========================================================================
# R语言错误整理集合
#==========================================================================
#2023年9月
#ERROR=========================================================================================
#R语言运行出现如下的类似错误
Error in draw_axis(break_positions = guide$key[[aesthetic]], break_labels = guide$key$.label, :
lazy-load database 'C:/Users/tq199/AppData/Local/R/win-library/4.2/gtable/R/gtable.rdb' is corrupt
#一般都是:lazy-load database XXXXX is corrupt
@解决办法:重启Rstudio就可以了(一般这样可解决,如果不行,其他的问题需要进一步排除)
#ERROR=========================================================================================
#运行infercnv的时候出现以下报错
# Error: C stack usage 7969524 is too close to the limit
@解决办法:https://github.com/broadinstitute/infercnv/issues/335
#运行R之前在终端输入:ulimit -s unlimited
#ERROR=========================================================================================
#作图的时候出现如下的错误:
#Error in cairo::Cairo(type = "raster", width = width, height = height,图形API版本不相符
#或者..........Graphics API version mismatch
@解决办法:
#重新安装ragg包或者Cairo包
#其他的暂时不知
#R版本:4.2.1
#ERROR=========================================================================================
#ggtree作图或者其他相关的,作图有问题,或者有如下的warning:
#could not find function "offspring.tbl_tree_item"
@解决办法:重装ggtree
remotes::install_github('YuLab-SMU/ggtree')
#ERROR=========================================================================================
#服务器好端端的安装R包总是出现这样的错误
#error:ERROR: configuration failed for package ‘sodium’
@解决办法:终端中运行:
sudo apt install libsodium-dev
#然后在rsrudio种安装就没有问题了
#ERROR=========================================================================================
#做GSVA的时候出现如下的报错:或者其他的分析出现
# Error: useNames = NA is defunct. Instead, specify either useNames = TRUE or useNames = FALSE.
#可能的原因是matrixStats包的问题
@解决办法:降低matrixStats版本或许能够解决
#ERROR=========================================================================================
#Signac做ATAC分析
# TSSPlot(combined, group.by = 'high.tss') + NoLegend()
# Error in TSSPlot(combined, group.by = "high.tss") :
# Position enrichment matrix not present in assay
#原因,在TSSEnrichment这里参数选择的问题
@解决办法: fast选择False
#ERROR=========================================================================================
#Signac做ATAC分析
combined <- RunSVD(combined)
# Running SVD
# Error in irlba(A = t(x = object), nv = n, work = irlba.work, tol = tol) :
# function 'as_cholmod_sparse' not provided by package 'Matrix'
@解决办法:可能有用的方法: 卸载之前的irlba,重新本地安装irlba,重启R
#ERROR=========================================================================================
#保存文件的时候出现如下报错:
# Error in save(Coembedding, file = "Coembedding.RData") :
# error writing to connection
#原因:磁盘没有空间了
@解决办法:清理空间
#==========================================================================
# R语言错误整理集合
#==========================================================================
#2024年
#ERROR=========================================================================================
#当你跑一些代码的时候,可能是GSVA、可能是Seurat、SCT或者其他,出现如下错误:
# Error: useNames = NA is defunct. Instead, specify either useNames = TRUE or useNames = FALSE.
#原因:matrixStats 包版本的问题
@解决办法:使用1.1.0的matrixStats
remotes::install_version("matrixStats", version="1.1.0")
#ERROR=========================================================================================
#python运行网络图相关,出现如下error
# AttributeError: 'NoneType' object has no attribute 'render'
@解决办法:
pip install pyvis==0.3.1 -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com
#ERROR=========================================================================================
#当你运行peaks annotation的时候,出现如下的错误:
DAR.Anno <- annotatePeak(all_dar.gr, tssRegion=c(-3000, 3000), TxDb = txdb, annoDb="org.Hs.eg.db")
# Error in (function (classes, fdef, mtable) :
# unable to find an inherited method for function ‘NSBS’ for signature ‘"SortedByQueryHits"’
@解决办法:需要再染色体前面添加chr
GenomeInfoDb::seqlevels(all_dar.gr)
all_dar.gr <- diffloop::addchr(all_dar.gr)
DAR.Anno <- annotatePeak(all_dar.gr, tssRegion=c(-3000, 3000), TxDb = txdb, annoDb="org.Hs.eg.db")
#ERROR=========================================================================================
#安装、加载、或者使用的时候出现类似的错误,.rdb' is corrupt
# Error in get(Info[i, 1], envir = env) :
# lazy-load database '/Library/Frameworks/R.framework/Versions/3.3/Resources/library/lme4/R/lme4.rdb' is corrupt
@解决办法:重启R可能会解决你的问题
.rs.restartR()
#ERROR=========================================================================================
#安装monocle3或者其他包的时候出现这样的错误:
# configure: error: gdal-config not found or not executable.
# ERROR: configuration failed for package ‘sf’
@解决办法:终端安装GDAL可能会解决你的问题
sudo apt-get install libgdal-dev
#ERROR=========================================================================================
#scATAC数据分析::::cicero 分析出现如下错误
#Error: methods::is(object = cds, class2 = "cell_data_set") is not TRUE
#原因是monocle3依赖的问题
@解决办法:卸载之前的cicero,按照如下的方式安装,就可以了
devtools::install_github("cole-trapnell-lab/cicero-release", ref = "monocle3")
#ERROR=========================================================================================
#跑 cellchat selectK 的时候出现的错误
#运行这一句:
object.list[[1]] <- netAnalysis_computeCentrality(object.list[[1]], slot.name = "netP")
selectK(object.list[[1]], pattern = "outgoing")
# Timing stopped at: 0.014 0.003 0.017
# Timing stopped at: 0.005 0 0.005
# Timing stopped at: 0.003 0 0.004
# Timing stopped at: 0.013 0 0.013
# Timing stopped at: 0.003 0 0.003
# Timing stopped at: 0.002 0.008 0.011
# Timing stopped at: 0.003 0 0.004
# Timing stopped at: 0.004 0 0.007
# Timing stopped at: 0.005 0 0.007
# Error in (function (...) : All the runs produced an error:
# -#1 [r=2] -> none of the packages are loaded [in call to 'path.package']
# -#2 [r=3] -> none of the packages are loaded [in call to 'path.package']
# -#3 [r=4] -> none of the packages are loaded [in call to 'path.package']
# -#4 [r=5] -> none of the packages are loaded [in call to 'path.package']
# -#5 [r=6] -> none of the packages are loaded [in call to 'path.package']
# -#6 [r=7] -> none of the packages are loaded [in call to 'path.package']
# -#7 [r=8] -> none of the packages are loaded [in call to 'path.package']
# -#8 [r=9] -> none of the packages are loaded [in call to 'path.package']
# -#9 [r=10] -> none of the packages are loaded [in call to 'path.package']
#原因:有些包没有加载
@解决办法:感谢KS科研分享与服务1群的 L。加载相关的包就可以了
library(NMF)
library(ggalluvial)
#ERROR=========================================================================================
#安装了最新版的DoubletFinder
remotes::install_github('chris-mcginnis-ucsf/DoubletFinder')
library(DoubletFinder)
#但是在运行的时候第一步就出现了错误
#Error in seu@assays$RNA$counts : $ operator not defined for this S4 class
#原因:seurat obj是Seurat V4和 SeuratObject V4构建的
#安装别人fix的版本就好了
@解决办法:remotes::install_github('lzmcboy/DoubletFinder_204_fix')
#后面测试之后我大概找到了原因
#如果你用seurat V5是不会有任何问题的
#如果你用了Seurat V4但是SeuratObject 是V5构建的数据,也不会出错
#ERROR=========================================================================================
#pyscenic分析 grn 报错:
#TypeError: Must supply at least one delayed object
#解决办法:
pip install distributed==2023.12.1
#参考:https://github.com/aertslab/pySCENIC/issues/525
#ERROR=========================================================================================
#Cellchat 作图的时候出现错误
Error in Ops.data.frame(guide_loc, panel_loc) :
‘==’ only defined for equally-sized data frames
#seurat Dimplot出现报错
Error in Ops.data.frame(guide_loc, panel_loc) :
‘==’ only defined for equally-sized data frames
#可能原因;ggplot2版本问题,太高?
#解决办法: ggplot2版本使用3.4.0
@解决办法
remotes::install_version("ggplot2", version = "3.4.4", repos = "http://cran.us.r-project.org")
#ERROR=========================================================================================
#R语言作图的时候出现如下报错
Error in .Call.graphics(C_palette2, .Call(C_palette2, NULL)) :
invalid graphics state
#可能原因;图太多太大超过rstudio的承受能力
@解决办法
#清空环境中的作图,重新画就可以了
#ERROR=========================================================================================
#单细胞seurat obj使用subset函数提取亚群出现如下错误
# Error in isVirtualExt(exti) :
# trying to get slot "virtual" from an object of a basic class ("NULL") with no slots
#可能原因:seurat是4.0, SeuratObject 5.0
@解决办法
#两者需要一致,要么都是4,要么都是5
#ERROR=========================================================================================
#Nebulosa包做单细胞密度图或者irGSEA包 plot的时候出现如下报错
# Error in as.vector(x, "character") :
# cannot coerce type 'environment' to vector of type 'character'
#可能原因:不知
@解决办法
#卸载掉原来的Nebulosa包,重装
devtools::install_github("powellgenomicslab/Nebulosa")
#ERROR=========================================================================================
#pyscenic grn 第一步发生报错:
# TypeError: Must supply at least one delayed object
@解决办法
https://github.com/aertslab/pySCENIC/issues/561
#ERROR=========================================================================================
#使用devtools::install_github安装某些包的时候,总是不成功,无法下载,很多时候github都不知道在哪下载安装包
devtools::install_github('shenorrlab/bseqsc')
Downloading GitHub repo shenorrlab/bseqsc@HEAD
Error in utils::download.file(url, path, method = method, quiet = quiet, :
cannot open URL 'https://api.github.com/repos/shenorrlab/bseqsc/tarball/HEAD'
@解决办法
#其实很简单,哪个error后面都提供链接了,R下载不成,就把链接复制到浏览器,然后就可以下载包本地安装了
#ERROR=========================================================================================
#使用patchwork 拼图出现如下报错
# Error in theme[[element]]
# attempt to select more than one element in vectorIndex
#可能原因:包版本的问题,1.3会出现问题
@解决办法
#降低包的版本,1.2就可以了
#ERROR=========================================================================================
#ubbantu linux终端运行python代码出现如下报错:代码没有错误的情况下
#SyntaxError: invalid non-printable character U+00A0
#可能原因:代码是从windows复制粘贴到ubuntu上,复制的代码中空格和Python中的格式不一样造成的
@解决办法
#手动输入代码
#ERROR=========================================================================================
#运行代码出现如下errror
#Error in `validObject()`: ! 类别为"Graph"的对象不对: superclass "mMatrix" not defined in the environment of the object's class
#可能原因:还是Matrix的毛病
@解决办法:
remotes::install_version("Matrix", "1.6.1")
#ERROR=========================================================================================
#seurat 分析 RunUMAP的时候报错:
# Error in irlba::irlba(L, nv = n, nu = 0, maxit = iters) :
# function 'sexp_as_cholmod_sparse' not provided by package 'Matrix'
#可能原因:irlba包在作妖
@解决办法:卸载之前的,重启R安装irlba就解决了
install.packages("irlba", type="source")
#ERROR=========================================================================================
#运行某些代码出现如下得报错:
# Error in .make_numeric_version(x, strict, .standard_regexps()$valid_numeric_version) :
# invalid non-character version specification 'x' (type: double)
#可能原因:ggplot2版本得问题
@解决办法:安装最新版??? ggplot2 3.5.1
#ERROR=========================================================================================
#可能你在R中导入h5ad数据的时候出现如下报错:
#Error in h5ad loading: invalid class “dgRMatrix” object: 'Dim' slot does not have length 2
@解决办法:我倾向于第二种
#1、在环境中将scipy版本降低为1.11以下
#2、卸载原先的reticulate包,重新安装最新的:remotes::install_github("rstudio/reticulate")
#ERROR=========================================================================================
#Windows R包安装出现报错
# Error: Failed to install 'x' from GitHub:
# Git does not seem to be installed on your system.
@解决办法:安装Git
#这里下载Git安装包,按默认安装好就可以了, https://git-scm.com/downloads/win
#ERROR=========================================================================================
#monocle3 graph_test 出现错误
# >mycds1_res <- graph_test(mycds1, neighbor_graph="principal_graph", cores=4)
# 错误: make_nn_matrix: the subject_matrix object must be of type matrix
@解决办法:参考---https://github.com/cole-trapnell-lab/monocle3/issues/617
#ERROR=========================================================================================
#signac 分析scATAC数据使用 ClosetFeature函数的时候出现如下报错:
# Error in .Call2("C_find_overlaps_in_groups_NCList", start(q), end(q), :
# build_NCList: memory allocation failed
#原因:设备问题,不是其他的就是内存不够了,因为用的笔记本
@解决办法:使用服务器或者运行内存大的设备就不会有这个问题