出错解决 | Error: cannot allocate vector of size 109.7 Mb

时间:2024-10-21 08:07:59

最近要处理蛮大的数据。结果这个数据放到R中,却出现了内存不够的问题。
关于计算机的基础的知识,是我一直以来的薄弱项。
我现在拥有足够的精力和时间,所以,我希望能够认真解决这个问题。

解决方法,并没有想象的那么复杂。
在要处理的大数据的代码前,添加gc()
即如下所示:

coverage_cutoff <- 3  
coverage_percentage <- 0.2
cell_percentage <- 0.2
artefact_percentage <- 0.03
gc() #即这行指令 #下面的处理将占用很大的内存,在运行之前先删去不必要的
preprocess_genetics <- read_sclineager(runinfo,
                                       coverage_cutoff,
                                       coverage_percentage,
                                       cell_percentage,
                                       out_folder,
                                       artefact_percentage)

最终运行成功。

[1] "./mutations/cell/1"
[1] "./mutations/cell/2"
[1] "./mutations/cell/3"
[1] "./mutations/cell/4"
[1] "./mutations/cell/5"
[1] "./mutations/cell/6"
[1] "./mutations/cell/7"
[1] "./mutations/cell/8"
[1] "./mutations/cell/9"
[1] "./mutations/cell/10"
[1] "./mutations/cell/11"
[1] "./mutations/cell/12"
[1] "./mutations/cell/13"
[1] "./mutations/cell/14"
[1] "./mutations/cell/15"
[1] "./mutations/cell/16"
[1] "./mutations/cell/17"
[1] "./mutations/cell/18"
[1] "./mutations/cell/19"
[1] "./mutations/cell/20"
[1] "./mutations/cell/21"
[1] "./mutations/cell/22"
[1] "./mutations/cell/23"
[1] "./mutations/cell/24"
[1] "./mutations/cell/25"
[1] "./mutations/cell/26"
[1] "./mutations/cell/27"
[1] "./mutations/cell/28"
[1] "./mutations/cell/29"
[1] "./mutations/cell/30"
[1] "./mutations/cell/31"
[1] "./mutations/cell/32"
[1] "./mutations/cell/33"
[1] "./mutations/cell/34"
[1] "./mutations/cell/35"
[1] "./mutations/cell/36"
[1] "./mutations/cell/37"
[1] "./mutations/cell/38"
[1] "./mutations/cell/39"
[1] "./mutations/cell/40"
[1] "./mutations/cell/41"
[1] "./mutations/cell/42"
[1] "./mutations/cell/43"
[1] "./mutations/cell/44"
[1] "./mutations/cell/45"
[1] "./mutations/cell/46"
[1] "./mutations/cell/47"
[1] "./mutations/cell/48"
[1] "./mutations/cell/49"
[1] "./mutations/cell/50"
[1] "./mutations/cell/51"
[1] "./mutations/cell/52"
[1] "./mutations/cell/53"
[1] "./mutations/cell/54"
[1] "./mutations/cell/55"
[1] "./mutations/cell/56"
[1] "./mutations/cell/57"
[1] "./mutations/cell/58"
[1] "./mutations/cell/59"
[1] "./mutations/cell/60"
[1] "./mutations/cell/61"
[1] "./mutations/cell/62"
[1] "./mutations/cell/63"
[1] "./mutations/cell/64"
[1] "./mutations/cell/65"
[1] "./mutations/cell/66"
[1] "./mutations/cell/67"
[1] "./mutations/cell/68"
[1] "./mutations/cell/69"
[1] "./mutations/cell/70"
[1] "./mutations/cell/71"
[1] "./mutations/cell/72"
[1] "./mutations/cell/73"
[1] "./mutations/cell/74"
[1] "./mutations/cell/75"
[1] "./mutations/cell/76"
[1] "./mutations/cell/77"
[1] "./mutations/cell/78"
[1] "./mutations/cell/79"
[1] "./mutations/cell/80"
[1] "./mutations/cell/81"
[1] "./mutations/cell/82"
[1] "./mutations/cell/83"
[1] "./mutations/cell/84"
[1] "./mutations/cell/85"
[1] "./mutations/cell/86"
[1] "./mutations/cell/87"
[1] "./mutations/cell/88"
[1] "./mutations/cell/89"
[1] "./mutations/cell/90"
[1] "./mutations/cell/91"
[1] 87581    86
Processing coverage data for 1 th cell
Processing coverage data for 2 th cell
Processing coverage data for 3 th cell
Processing coverage data for 4 th cell
Processing coverage data for 5 th cell
Processing coverage data for 6 th cell
Processing coverage data for 7 th cell
Processing coverage data for 8 th cell
Processing coverage data for 9 th cell
Processing coverage data for 10 th cell
Processing coverage data for 11 th cell
Processing coverage data for 12 th cell
Processing coverage data for 13 th cell
Processing coverage data for 14 th cell
Processing coverage data for 15 th cell
Processing coverage data for 16 th cell
Processing coverage data for 17 th cell
Processing coverage data for 18 th cell
Processing coverage data for 19 th cell
Processing coverage data for 20 th cell
Processing coverage data for 21 th cell
Processing coverage data for 22 th cell
Processing coverage data for 23 th cell
Processing coverage data for 24 th cell
Processing coverage data for 25 th cell
Processing coverage data for 26 th cell
Processing coverage data for 27 th cell
Processing coverage data for 28 th cell
Processing coverage data for 29 th cell
Processing coverage data for 30 th cell
Processing coverage data for 31 th cell
Processing coverage data for 32 th cell
Processing coverage data for 33 th cell
Processing coverage data for 34 th cell
Processing coverage data for 35 th cell
Processing coverage data for 36 th cell
Processing coverage data for 37 th cell
Processing coverage data for 38 th cell
Processing coverage data for 39 th cell
Processing coverage data for 40 th cell
Processing coverage data for 41 th cell
Processing coverage data for 42 th cell
Processing coverage data for 43 th cell
Processing coverage data for 44 th cell
Processing coverage data for 45 th cell
Processing coverage data for 46 th cell
Processing coverage data for 47 th cell
Processing coverage data for 48 th cell
Processing coverage data for 49 th cell
Processing coverage data for 50 th cell
Processing coverage data for 51 th cell
Processing coverage data for 52 th cell
Processing coverage data for 53 th cell
Processing coverage data for 54 th cell
Processing coverage data for 55 th cell
Processing coverage data for 56 th cell
Processing coverage data for 57 th cell
Processing coverage data for 58 th cell
Processing coverage data for 59 th cell
Processing coverage data for 60 th cell
Processing coverage data for 61 th cell
Processing coverage data for 62 th cell
Processing coverage data for 63 th cell
Processing coverage data for 64 th cell
Processing coverage data for 65 th cell
Processing coverage data for 66 th cell
Processing coverage data for 67 th cell
Processing coverage data for 68 th cell
Processing coverage data for 69 th cell
Processing coverage data for 70 th cell
Processing coverage data for 71 th cell
Processing coverage data for 72 th cell
Processing coverage data for 73 th cell
Processing coverage data for 74 th cell
Processing coverage data for 75 th cell
Processing coverage data for 76 th cell
Processing coverage data for 77 th cell
Processing coverage data for 78 th cell
Processing coverage data for 79 th cell
Processing coverage data for 80 th cell
Processing coverage data for 81 th cell
Processing coverage data for 82 th cell
Processing coverage data for 83 th cell
Processing coverage data for 84 th cell
Processing coverage data for 85 th cell
Processing coverage data for 86 th cell
[1] 50880    86
keep
FALSE  TRUE 
50351   529 
keep
FALSE  TRUE 
    9    77