u-boot for fun (3) -- read start.S

本文详细解析了U-Boot的启动过程,包括CPU模式设置、内存分配、BSS段清理及程序重定位等关键步骤,并介绍了相关汇编指令的应用。

start.S:

1.设置cpu模式为svc32

2.初始化看门狗

3.设置中断(根据手册)

4.设置时钟CLKDIV

5.Cpu_critical_setting, memory timing, flush cache

6.重新定位u-boot

这里需要了解lds文件的作用,以及ldr,adr的区别,源码中这里是将代码从flashcopyRam中,如果移植到mini2440上的话,那这里就需要处理把u-boot copyram中。

 

 

 

7.留出需要的内存(CFG_MALLOC_LEN, GBL_DATA_SIZE, IRQ+FIQ,定义用户栈区

8.清理bss

9.进入第二阶段

 

汇编基础:

ELF格式相关 参照 http://learn.akae.cn/media/ch18s05.html

汇编条令 参照:http://learn.akae.cn/media/ch18s01.html

 

 

 

 


 

代码解释:

 


 

.globl _start

 

/*_start为程序的入口点, 可以在连接脚本中修改Entry标签(即可以改用其他标签),_start是个全局变量,链接器会给它指定运行/加载地址。程序的第一条指定就存储在_start变量里*/


_start: b       reset

 

/*上面说到_start这个变量(地址)里存放的就是第一条指令,所以程序启动即执行reset,实际就是跳转到reset这个标签指定的地址,这里的b指令执行跳转时需要的偏移量是编译器根据当前和目标计算出来的,是个相对值,所以也是相对跳转*/

     ldr pc, _undefined_instruction
    ldr pc, _software_interrupt
    ldr pc, _prefetch_abort
    ldr pc, _data_abort
    ldr pc, _not_used
    ldr pc, _irq
    ldr pc, _fiq

 

/*上面这些是跳转到相应中断处理的命令,把各中断标签代表的地址中存放的值传给pc,cpu下条指令就会执行pc所指向地址的命令,也就是各中断标签代表的地址中所存放地址所指向的的命令。这是个绝对跳转,因为pc直接指向需要执行指令的存放的地址*/

 

_undefined_instruction: .word undefined_instruction
_software_interrupt:    .word software_interrupt
_prefetch_abort:    .word prefetch_abort
_data_abort:        .word data_abort
_not_used:      .word not_used
_irq:           .word irq
_fiq:           .word fiq

/*把各处理中断的程序序列地址赋给各标签,这里讨论下ARM汇编中的.word的用法。

官方解释:

.word
Syntax: .word expressions

This directive expects zero or more expressions, of any section, separated by commas. For each expression, as emits a 16-bit number for this target

就是把expression以16bit的方式存放在当前位置, 以上面的代码为例,_undefined_instruction: .word undefined_instruction, 是把undefined_instruction标号地址存放在_undefined_instruction标号地址处, .word就是赤裸裸的引用*/

 

.balignl 16,0xdeadbeef

/*强制对齐*/

 

 

_TEXT_BASE:
    .word TEXT_BASE

/*TEXT_BASE(config.mk定义的一个常量)存放在_TEXT_BASE标号地址处*/

 

.globl _armboot_start
_armboot_start:
    .word _start

 /*定义全局变量_armboot_start,并把_start的地址赋给_armboot_start*/

 

.globl _bss_start
_bss_start:
    .word __bss_start

.globl _bss_end
_bss_end:
    .word _end
/*
 * These are defined in the board-specific linker script.
 */

#ifdef CONFIG_USE_IRQ
/* IRQ stack memory (calculated at run-time) */
.globl IRQ_STACK_START
IRQ_STACK_START:
    .word   0x0badc0de

/* IRQ stack memory (calculated at run-time) */
.globl FIQ_STACK_START
FIQ_STACK_START:
    .word 0x0badc0de
#endif

reset:

    /*
     * set the cpu to SVC32 mode
     */
    mrs r0,cpsr
    bic r0,r0,#0x1f
    orr r0,r0,#0xd3
    msr cpsr,r0

****************


 

 

#ifndef CONFIG_SKIP_RELOCATE_UBOOT
relocate:               /* relocate U-Boot to RAM       */
    adr r0, _start      /* r0 <- current position of code   */
    ldr r1, _TEXT_BASE      /* test if we run from flash or RAM */
    cmp     r0, r1                  /* don't reloc during debug         */
    beq     stack_setup

    ldr r2, _armboot_start
    ldr r3, _bss_start
    sub r2, r3, r2      /* r2 <- size of armboot            */
    add r2, r0, r2      /* r2 <- source end address         */

copy_loop:
    ldmia   r0!, {r3-r10}       /* copy from source address [r0]    */
    stmia   r1!, {r3-r10}       /* copy to   target address [r1]    */
    cmp r0, r2          /* until source end addreee [r2]    */
    ble copy_loop

 

/*上面的代码块实现了u-boot把自己从flash cp到RAM中。

adr r0, _start      /* r0 <- current position of code   */

adr 是伪指令,是把_start的地址放到r0中,但是需要注意,这里获取_start的地址是汇编器通过计算当前PC到_start的偏移量得到的,我们可以看下u-boot的反汇编

33f80094 <relocate>:
33f80094:   e24f009c    sub r0, pc, #156    ; 0x9c

可以看出上面的伪指令在汇编器处理之后是一条sub语句,是用当前PC值减去156,以为ARM是流水线工作,预取指令,所以执行到这条命令的时候PC值跟程序运行区域有关系,如果u-boot此刻运行在ARM4kflash中,那么PC=0x33f80094 + 8 = 33f8009c,如果运行在RAM,那么PC=0x0 + 8.所以R0就是33f80000(运行在flash中)或者0(运行在RAM中),即_start的地址。*/

ldr r1, _TEXT_BASE      /* test if we run from flash or RAM */

/*ldr 也是一条伪指令,是把_TEXT_BASE的值,最开始的代码段已经给_TEXT_BASE赋值为TEXT_BASE(/board/boadname/config.mk中赋值为33f80000),所以r1=0x33f80000

u-boot反汇编看此条指令为

 33f80098:   e51f1060    ldr r1, [pc, #-96]  ; 33f80040 <_TEXT_BASE>

以此可以看出,可以对比r0和r1的值来确定u-boot现在运行的环境(RAM/Flash)/*

  ldr r2, _armboot_start
    ldr r3, _bss_start
    sub r2, r3, r2      /* r2 <- size of armboot            */
    add r2, r0, r2      /* r2 <- source end address         */

/*ldr 是个比mov更好用的数据传递指令,_armboot_start, _bass_start都是对_start, bss_start的引用,这样就可以把想要的地址传递到r2, r3中了。想要得到u-boot映像的大小,就需要知道起始和截止地址,_start和bss_start的地址在连接后都是确定的,所以r3-r2就是size of u-boot*/


 ldr pc, _start_armboot

_start_armboot: .word start_armboot


/*跳转到第二阶段继续执行函数,此时_start_armboot存放的是全局变量start_armboot的地址,是链接后的地址,也就是运行地址,指向RAM。从而实现了跳到RAM继续执行后面的程序*/

参考的代码: # Check presence of rows with cell_id of 0 cells_0 <- grep("_0$", rownames(exprMat), value = TRUE) # Check presence of Negative and SystemControl probes columns negPrb_col <- grep("^Neg", colnames(exprMat), value = TRUE) # Neg columns sysCon_col <- grep("^SystemControl", colnames(exprMat), value = TRUE) # SystemControl columns # Show head expression matrix as.matrix(exprMat[1:6, 1:10]) Chrna4 Slc6a1 Cd109 Ldha Aldoc Drd1 Tank Rit2 Prkag2 Lpar3 c_1_1_0 9 58 11 30 938 6 28 20 15 2 c_1_1_1 0 0 0 0 0 0 0 0 0 0 c_1_1_2 0 0 0 0 0 0 0 0 1 0 c_1_1_3 5 1 0 1 2 0 0 0 0 0 c_1_1_4 1 1 0 1 0 0 0 2 1 0 c_1_1_5 0 0 0 2 2 0 0 0 0 0 但是我用exprMat <- read.csv("Run5961_PDAC_Slide1_exprMat_file.csv", header = TRUE) 得到的结果与参考代码不同 R version 4.4.3 (2025-02-28) -- "Trophy Case" Copyright (C) 2025 The R Foundation for Statistical Computing Platform: x86_64-pc-linux-gnu R是自由软件,不附带任何担保。 在某些条件下你可以将其自由分发。 用&#39;license()&#39;或&#39;licence()&#39;来看分发的详细条件。 R是个合作计划,有许多人为之做出了贡献. 用&#39;contributors()&#39;来看合著者的详细情况 用&#39;citation()&#39;会告诉你如何在出版物中正确地引用R或R程序包。 用&#39;demo()&#39;来看一些示例程序,用&#39;help()&#39;来阅读在线帮助文件,或 用&#39;help.start()&#39;通过HTML浏览器来看帮助文件。 输入&#39;q()&#39;退出R. > setwd("/data1/firefox") > BiocManager::install("NanoStringNCTtools") &#39;getOption("repos")&#39; replaces Bioconductor standard repositories, see &#39;help("repositories", package = "BiocManager")&#39; for details. Replacement repositories: CRAN: https://cloud.r-project.org Bioconductor version 3.20 (BiocManager 1.30.25), R 4.4.3 (2025-02-28) Installing package(s) &#39;NanoStringNCTtools&#39; Installation paths not writeable, unable to update packages path: /usr/lib/R/library packages: boot, codetools, foreign, lattice, Matrix, mgcv, nlme, spatial Old packages: &#39;aplot&#39;, &#39;BiocManager&#39;, &#39;BiocParallel&#39;, &#39;bookdown&#39;, &#39;broom&#39;, &#39;Cairo&#39;, &#39;checkmate&#39;, &#39;cli&#39;, &#39;collections&#39;, &#39;colorspace&#39;, &#39;cols4all&#39;, &#39;commonmark&#39;, &#39;cowplot&#39;, &#39;credentials&#39;, &#39;crosstalk&#39;, &#39;curl&#39;, &#39;data.table&#39;, &#39;data.tree&#39;, &#39;dbplyr&#39;, &#39;dbscan&#39;, &#39;Deriv&#39;, &#39;diffobj&#39;, &#39;doBy&#39;, &#39;DT&#39;, &#39;dtplyr&#39;, &#39;evaluate&#39;, &#39;fastcluster&#39;, &#39;fields&#39;, &#39;fitdistrplus&#39;, &#39;forcats&#39;, &#39;fs&#39;, &#39;future&#39;, &#39;future.apply&#39;, &#39;gargle&#39;, &#39;generics&#39;, &#39;ggforce&#39;, &#39;ggfun&#39;, &#39;ggnetwork&#39;, &#39;ggnewscale&#39;, &#39;ggplot2&#39;, &#39;ggplotify&#39;, &#39;ggpubr&#39;, &#39;ggraph&#39;, &#39;ggridges&#39;, &#39;ggsci&#39;, &#39;ggtangle&#39;, &#39;gh&#39;, &#39;globals&#39;, &#39;googledrive&#39;, &#39;googlesheets4&#39;, &#39;haven&#39;, &#39;here&#39;, &#39;httpuv&#39;, &#39;httr2&#39;, &#39;igraph&#39;, &#39;later&#39;, &#39;logger&#39;, &#39;magick&#39;, &#39;magrittr&#39;, &#39;maps&#39;, &#39;miniUI&#39;, &#39;mockr&#39;, &#39;modeltools&#39;, &#39;msigdbr&#39;, &#39;nanoarrow&#39;, &#39;openssl&#39;, &#39;parallelly&#39;, &#39;patchwork&#39;, &#39;pbapply&#39;, &#39;pbkrtest&#39;, &#39;pheatmap&#39;, &#39;pillar&#39;, &#39;pkgbuild&#39;, &#39;pkgdown&#39;, &#39;pkgload&#39;, &#39;plotly&#39;, &#39;progressr&#39;, &#39;promises&#39;, &#39;ps&#39;, &#39;psych&#39;, &#39;purrr&#39;, &#39;R.cache&#39;, &#39;R.oo&#39;, &#39;ragg&#39;, &#39;Rcpp&#39;, &#39;RcppArmadillo&#39;, &#39;RcppParallel&#39;, &#39;reformulas&#39;, &#39;ResidualMatrix&#39;, &#39;restfulr&#39;, &#39;reticulate&#39;, &#39;rlang&#39;, &#39;roxygen2&#39;, &#39;rprojroot&#39;, &#39;rsample&#39;, &#39;RSQLite&#39;, &#39;RUnit&#39;, &#39;rvest&#39;, &#39;s2&#39;, &#39;sass&#39;, &#39;scales&#39;, &#39;scatterpie&#39;, &#39;SCpubr&#39;, &#39;sctransform&#39;, &#39;SeuratObject&#39;, &#39;sf&#39;, &#39;shiny&#39;, &#39;spacesXYZ&#39;, &#39;spatstat&#39;, &#39;spatstat.data&#39;, &#39;spatstat.explore&#39;, &#39;spatstat.geom&#39;, &#39;spatstat.linnet&#39;, &#39;spatstat.model&#39;, &#39;spatstat.random&#39;, &#39;spatstat.univar&#39;, &#39;spatstat.utils&#39;, &#39;spdep&#39;, &#39;stringr&#39;, &#39;survminer&#39;, &#39;svglite&#39;, &#39;systemfonts&#39;, &#39;tensor&#39;, &#39;terra&#39;, &#39;textshaping&#39;, &#39;TH.data&#39;, &#39;tibble&#39;, &#39;tinytex&#39;, &#39;usethis&#39;, &#39;utf8&#39;, &#39;V8&#39;, &#39;vroom&#39;, &#39;waldo&#39;, &#39;xfun&#39;, &#39;xgboost&#39;, &#39;XML&#39;, &#39;xml2&#39;, &#39;yulab.utils&#39;, &#39;zip&#39;, &#39;zoo&#39; Update all/some/none? [a/s/n]: n 警告信息: package ‘NanoStringNCTtools’ is not available for Bioconductor version &#39;3.20&#39; A version of this package for your version of R might be available elsewhere, see the ideas at https://cran.r-project.org/doc/manuals/r-patched/R-admin.html#Installing-packages > BiocManager::install("NanoStringNCTools") &#39;getOption("repos")&#39; replaces Bioconductor standard repositories, see &#39;help("repositories", package = "BiocManager")&#39; for details. Replacement repositories: CRAN: https://cloud.r-project.org Bioconductor version 3.20 (BiocManager 1.30.25), R 4.4.3 (2025-02-28) Installing package(s) &#39;NanoStringNCTools&#39; 还安装依赖关系‘S7’, ‘scales’, ‘ggplot2’, ‘ggiraph’, ‘ggthemes’ 试开URL’https://cloud.r-project.org/src/contrib/S7_0.2.0.tar.gz&#39; Content type &#39;application/x-gzip&#39; length 183153 bytes (178 KB) ================================================== downloaded 178 KB 试开URL’https://cloud.r-project.org/src/contrib/scales_1.4.0.tar.gz&#39; Content type &#39;application/x-gzip&#39; length 328671 bytes (320 KB) ================================================== downloaded 320 KB 试开URL’https://cloud.r-project.org/src/contrib/ggplot2_4.0.0.tar.gz&#39; Content type &#39;application/x-gzip&#39; length 3810397 bytes (3.6 MB) ================================================== downloaded 3.6 MB 试开URL’https://cloud.r-project.org/src/contrib/ggiraph_0.9.1.tar.gz&#39; Content type &#39;application/x-gzip&#39; length 392782 bytes (383 KB) ================================================== downloaded 383 KB 试开URL’https://cloud.r-project.org/src/contrib/ggthemes_5.1.0.tar.gz&#39; Content type &#39;application/x-gzip&#39; length 493992 bytes (482 KB) ================================================== downloaded 482 KB 试开URL’https://bioconductor.org/packages/3.20/bioc/src/contrib/NanoStringNCTools_1.14.0.tar.gz&#39; Content type &#39;application/gzip&#39; length 382477 bytes (373 KB) ================================================== downloaded 373 KB * installing *source* package ‘S7’ ... ** 成功将‘S7’程序包解包并MD5和检查 ** using staged installation ** libs using C compiler: ‘gcc (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0’ gcc -I"/usr/share/R/include" -DNDEBUG -fpic -g -O2 -fdebug-prefix-map=/build/r-base-0GHeEU/r-base-4.4.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -c init.c -o init.o gcc -I"/usr/share/R/include" -DNDEBUG -fpic -g -O2 -fdebug-prefix-map=/build/r-base-0GHeEU/r-base-4.4.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -c method-dispatch.c -o method-dispatch.o gcc -I"/usr/share/R/include" -DNDEBUG -fpic -g -O2 -fdebug-prefix-map=/build/r-base-0GHeEU/r-base-4.4.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -c prop.c -o prop.o gcc -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -Wl,-z,relro -o S7.so init.o method-dispatch.o prop.o -L/usr/lib/R/lib -lR installing to /home/user/R/x86_64-pc-linux-gnu-library/4.4/00LOCK-S7/00new/S7/libs ** R ** inst ** byte-compile and prepare package for lazy loading ** help *** installing help indices ** building package indices ** installing vignettes ** testing if installed package can be loaded from temporary location ** checking absolute paths in shared objects and dynamic libraries ** testing if installed package can be loaded from final location ** testing if installed package keeps a record of temporary installation path * DONE (S7) * installing *source* package ‘scales’ ... ** 成功将‘scales’程序包解包并MD5和检查 ** using staged installation ** R ** byte-compile and prepare package for lazy loading ** help *** installing help indices *** copying figures ** building package indices ** testing if installed package can be loaded from temporary location ** testing if installed package can be loaded from final location ** testing if installed package keeps a record of temporary installation path * DONE (scales) * installing *source* package ‘ggplot2’ ... ** 成功将‘ggplot2’程序包解包并MD5和检查 ** using staged installation ** R ** data *** moving datasets to lazyload DB ** inst ** byte-compile and prepare package for lazy loading ** help *** installing help indices *** copying figures ** building package indices ** installing vignettes ** testing if installed package can be loaded from temporary location ** testing if installed package can be loaded from final location ** testing if installed package keeps a record of temporary installation path * DONE (ggplot2) * installing *source* package ‘ggiraph’ ... ** 成功将‘ggiraph’程序包解包并MD5和检查 ** using staged installation ** libs using C++ compiler: ‘g++ (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0’ g++ -std=gnu++17 -I"/usr/share/R/include" -DNDEBUG -I&#39;/home/user/R/x86_64-pc-linux-gnu-library/4.4/Rcpp/include&#39; -I&#39;/home/user/R/x86_64-pc-linux-gnu-library/4.4/systemfonts/include&#39; -fpic -g -O2 -fdebug-prefix-map=/build/r-base-0GHeEU/r-base-4.4.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -c RcppExports.cpp -o RcppExports.o g++ -std=gnu++17 -I"/usr/share/R/include" -DNDEBUG -I&#39;/home/user/R/x86_64-pc-linux-gnu-library/4.4/Rcpp/include&#39; -I&#39;/home/user/R/x86_64-pc-linux-gnu-library/4.4/systemfonts/include&#39; -fpic -g -O2 -fdebug-prefix-map=/build/r-base-0GHeEU/r-base-4.4.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -c a_color.cpp -o a_color.o g++ -std=gnu++17 -I"/usr/share/R/include" -DNDEBUG -I&#39;/home/user/R/x86_64-pc-linux-gnu-library/4.4/Rcpp/include&#39; -I&#39;/home/user/R/x86_64-pc-linux-gnu-library/4.4/systemfonts/include&#39; -fpic -g -O2 -fdebug-prefix-map=/build/r-base-0GHeEU/r-base-4.4.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -c clip.cpp -o clip.o g++ -std=gnu++17 -I"/usr/share/R/include" -DNDEBUG -I&#39;/home/user/R/x86_64-pc-linux-gnu-library/4.4/Rcpp/include&#39; -I&#39;/home/user/R/x86_64-pc-linux-gnu-library/4.4/systemfonts/include&#39; -fpic -g -O2 -fdebug-prefix-map=/build/r-base-0GHeEU/r-base-4.4.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -c dsvg.cpp -o dsvg.o g++ -std=gnu++17 -I"/usr/share/R/include" -DNDEBUG -I&#39;/home/user/R/x86_64-pc-linux-gnu-library/4.4/Rcpp/include&#39; -I&#39;/home/user/R/x86_64-pc-linux-gnu-library/4.4/systemfonts/include&#39; -fpic -g -O2 -fdebug-prefix-map=/build/r-base-0GHeEU/r-base-4.4.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -c dsvg_dev.cpp -o dsvg_dev.o g++ -std=gnu++17 -I"/usr/share/R/include" -DNDEBUG -I&#39;/home/user/R/x86_64-pc-linux-gnu-library/4.4/Rcpp/include&#39; -I&#39;/home/user/R/x86_64-pc-linux-gnu-library/4.4/systemfonts/include&#39; -fpic -g -O2 -fdebug-prefix-map=/build/r-base-0GHeEU/r-base-4.4.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -c geom.cpp -o geom.o g++ -std=gnu++17 -I"/usr/share/R/include" -DNDEBUG -I&#39;/home/user/R/x86_64-pc-linux-gnu-library/4.4/Rcpp/include&#39; -I&#39;/home/user/R/x86_64-pc-linux-gnu-library/4.4/systemfonts/include&#39; -fpic -g -O2 -fdebug-prefix-map=/build/r-base-0GHeEU/r-base-4.4.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -c indexed.cpp -o indexed.o g++ -std=gnu++17 -I"/usr/share/R/include" -DNDEBUG -I&#39;/home/user/R/x86_64-pc-linux-gnu-library/4.4/Rcpp/include&#39; -I&#39;/home/user/R/x86_64-pc-linux-gnu-library/4.4/systemfonts/include&#39; -fpic -g -O2 -fdebug-prefix-map=/build/r-base-0GHeEU/r-base-4.4.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -c interactive.cpp -o interactive.o g++ -std=gnu++17 -I"/usr/share/R/include" -DNDEBUG -I&#39;/home/user/R/x86_64-pc-linux-gnu-library/4.4/Rcpp/include&#39; -I&#39;/home/user/R/x86_64-pc-linux-gnu-library/4.4/systemfonts/include&#39; -fpic -g -O2 -fdebug-prefix-map=/build/r-base-0GHeEU/r-base-4.4.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -c mask.cpp -o mask.o g++ -std=gnu++17 -I"/usr/share/R/include" -DNDEBUG -I&#39;/home/user/R/x86_64-pc-linux-gnu-library/4.4/Rcpp/include&#39; -I&#39;/home/user/R/x86_64-pc-linux-gnu-library/4.4/systemfonts/include&#39; -fpic -g -O2 -fdebug-prefix-map=/build/r-base-0GHeEU/r-base-4.4.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -c pattern.cpp -o pattern.o g++ -std=gnu++17 -I"/usr/share/R/include" -DNDEBUG -I&#39;/home/user/R/x86_64-pc-linux-gnu-library/4.4/Rcpp/include&#39; -I&#39;/home/user/R/x86_64-pc-linux-gnu-library/4.4/systemfonts/include&#39; -fpic -g -O2 -fdebug-prefix-map=/build/r-base-0GHeEU/r-base-4.4.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -c raster.cpp -o raster.o g++ -std=gnu++17 -I"/usr/share/R/include" -DNDEBUG -I&#39;/home/user/R/x86_64-pc-linux-gnu-library/4.4/Rcpp/include&#39; -I&#39;/home/user/R/x86_64-pc-linux-gnu-library/4.4/systemfonts/include&#39; -fpic -g -O2 -fdebug-prefix-map=/build/r-base-0GHeEU/r-base-4.4.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -c shapes.cpp -o shapes.o g++ -std=gnu++17 -I"/usr/share/R/include" -DNDEBUG -I&#39;/home/user/R/x86_64-pc-linux-gnu-library/4.4/Rcpp/include&#39; -I&#39;/home/user/R/x86_64-pc-linux-gnu-library/4.4/systemfonts/include&#39; -fpic -g -O2 -fdebug-prefix-map=/build/r-base-0GHeEU/r-base-4.4.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -c svg.cpp -o svg.o g++ -std=gnu++17 -I"/usr/share/R/include" -DNDEBUG -I&#39;/home/user/R/x86_64-pc-linux-gnu-library/4.4/Rcpp/include&#39; -I&#39;/home/user/R/x86_64-pc-linux-gnu-library/4.4/systemfonts/include&#39; -fpic -g -O2 -fdebug-prefix-map=/build/r-base-0GHeEU/r-base-4.4.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -c text.cpp -o text.o g++ -std=gnu++17 -I"/usr/share/R/include" -DNDEBUG -I&#39;/home/user/R/x86_64-pc-linux-gnu-library/4.4/Rcpp/include&#39; -I&#39;/home/user/R/x86_64-pc-linux-gnu-library/4.4/systemfonts/include&#39; -fpic -g -O2 -fdebug-prefix-map=/build/r-base-0GHeEU/r-base-4.4.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -c tinyxml2.cpp -o tinyxml2.o g++ -std=gnu++17 -I"/usr/share/R/include" -DNDEBUG -I&#39;/home/user/R/x86_64-pc-linux-gnu-library/4.4/Rcpp/include&#39; -I&#39;/home/user/R/x86_64-pc-linux-gnu-library/4.4/systemfonts/include&#39; -fpic -g -O2 -fdebug-prefix-map=/build/r-base-0GHeEU/r-base-4.4.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -c utils.cpp -o utils.o g++ -std=gnu++17 -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -Wl,-z,relro -o ggiraph.so RcppExports.o a_color.o clip.o dsvg.o dsvg_dev.o geom.o indexed.o interactive.o mask.o pattern.o raster.o shapes.o svg.o text.o tinyxml2.o utils.o -lpng -lz -L/usr/lib/R/lib -lR installing to /home/user/R/x86_64-pc-linux-gnu-library/4.4/00LOCK-ggiraph/00new/ggiraph/libs ** R ** inst ** byte-compile and prepare package for lazy loading ** help *** installing help indices *** copying figures ** building package indices ** installing vignettes ** testing if installed package can be loaded from temporary location ** checking absolute paths in shared objects and dynamic libraries ** testing if installed package can be loaded from final location ** testing if installed package keeps a record of temporary installation path * DONE (ggiraph) * installing *source* package ‘ggthemes’ ... ** 成功将‘ggthemes’程序包解包并MD5和检查 ** using staged installation ** R ** data *** moving datasets to lazyload DB ** inst ** byte-compile and prepare package for lazy loading ** help *** installing help indices ** building package indices ** testing if installed package can be loaded from temporary location ** testing if installed package can be loaded from final location ** testing if installed package keeps a record of temporary installation path * DONE (ggthemes) * installing *source* package ‘NanoStringNCTools’ ... ** 成功将‘NanoStringNCTools’程序包解包并MD5和检查 ** using staged installation ** R ** inst ** byte-compile and prepare package for lazy loading ** help *** installing help indices ** building package indices ** installing vignettes ** testing if installed package can be loaded from temporary location ** testing if installed package can be loaded from final location ** testing if installed package keeps a record of temporary installation path * DONE (NanoStringNCTools) 下载的程序包在 ‘/tmp/Rtmp5RH1TC/downloaded_packages’里 Installation paths not writeable, unable to update packages path: /usr/lib/R/library packages: boot, codetools, foreign, lattice, Matrix, mgcv, nlme, spatial Old packages: &#39;aplot&#39;, &#39;BiocManager&#39;, &#39;BiocParallel&#39;, &#39;bookdown&#39;, &#39;broom&#39;, &#39;Cairo&#39;, &#39;checkmate&#39;, &#39;cli&#39;, &#39;collections&#39;, &#39;colorspace&#39;, &#39;cols4all&#39;, &#39;commonmark&#39;, &#39;cowplot&#39;, &#39;credentials&#39;, &#39;crosstalk&#39;, &#39;curl&#39;, &#39;data.table&#39;, &#39;data.tree&#39;, &#39;dbplyr&#39;, &#39;dbscan&#39;, &#39;Deriv&#39;, &#39;diffobj&#39;, &#39;doBy&#39;, &#39;DT&#39;, &#39;dtplyr&#39;, &#39;evaluate&#39;, &#39;fastcluster&#39;, &#39;fields&#39;, &#39;fitdistrplus&#39;, &#39;forcats&#39;, &#39;fs&#39;, &#39;future&#39;, &#39;future.apply&#39;, &#39;gargle&#39;, &#39;generics&#39;, &#39;ggforce&#39;, &#39;ggfun&#39;, &#39;ggnetwork&#39;, &#39;ggnewscale&#39;, &#39;ggplotify&#39;, &#39;ggpubr&#39;, &#39;ggraph&#39;, &#39;ggridges&#39;, &#39;ggsci&#39;, &#39;ggtangle&#39;, &#39;gh&#39;, &#39;globals&#39;, &#39;googledrive&#39;, &#39;googlesheets4&#39;, &#39;haven&#39;, &#39;here&#39;, &#39;httpuv&#39;, &#39;httr2&#39;, &#39;igraph&#39;, &#39;later&#39;, &#39;logger&#39;, &#39;magick&#39;, &#39;magrittr&#39;, &#39;maps&#39;, &#39;miniUI&#39;, &#39;mockr&#39;, &#39;modeltools&#39;, &#39;msigdbr&#39;, &#39;nanoarrow&#39;, &#39;openssl&#39;, &#39;parallelly&#39;, &#39;patchwork&#39;, &#39;pbapply&#39;, &#39;pbkrtest&#39;, &#39;pheatmap&#39;, &#39;pillar&#39;, &#39;pkgbuild&#39;, &#39;pkgdown&#39;, &#39;pkgload&#39;, &#39;plotly&#39;, &#39;progressr&#39;, &#39;promises&#39;, &#39;ps&#39;, &#39;psych&#39;, &#39;purrr&#39;, &#39;R.cache&#39;, &#39;R.oo&#39;, &#39;ragg&#39;, &#39;Rcpp&#39;, &#39;RcppArmadillo&#39;, &#39;RcppParallel&#39;, &#39;reformulas&#39;, &#39;ResidualMatrix&#39;, &#39;restfulr&#39;, &#39;reticulate&#39;, &#39;rlang&#39;, &#39;roxygen2&#39;, &#39;rprojroot&#39;, &#39;rsample&#39;, &#39;RSQLite&#39;, &#39;RUnit&#39;, &#39;rvest&#39;, &#39;s2&#39;, &#39;sass&#39;, &#39;scatterpie&#39;, &#39;SCpubr&#39;, &#39;sctransform&#39;, &#39;SeuratObject&#39;, &#39;sf&#39;, &#39;shiny&#39;, &#39;spacesXYZ&#39;, &#39;spatstat&#39;, &#39;spatstat.data&#39;, &#39;spatstat.explore&#39;, &#39;spatstat.geom&#39;, &#39;spatstat.linnet&#39;, &#39;spatstat.model&#39;, &#39;spatstat.random&#39;, &#39;spatstat.univar&#39;, &#39;spatstat.utils&#39;, &#39;spdep&#39;, &#39;stringr&#39;, &#39;survminer&#39;, &#39;svglite&#39;, &#39;systemfonts&#39;, &#39;tensor&#39;, &#39;terra&#39;, &#39;textshaping&#39;, &#39;TH.data&#39;, &#39;tibble&#39;, &#39;tinytex&#39;, &#39;usethis&#39;, &#39;utf8&#39;, &#39;V8&#39;, &#39;vroom&#39;, &#39;waldo&#39;, &#39;xfun&#39;, &#39;xgboost&#39;, &#39;XML&#39;, &#39;xml2&#39;, &#39;yulab.utils&#39;, &#39;zip&#39;, &#39;zoo&#39; Update all/some/none? [a/s/n]: n > library(NanoStringNCTools) 载入需要的程序包:Biobase 载入需要的程序包:BiocGenerics 载入程序包:‘BiocGenerics’ The following objects are masked from ‘package:stats’: IQR, mad, sd, var, xtabs The following objects are masked from ‘package:base’: anyDuplicated, aperm, append, as.data.frame, basename, cbind, colnames, dirname, do.call, duplicated, eval, evalq, Filter, Find, get, grep, grepl, intersect, is.unsorted, lapply, Map, mapply, match, mget, order, paste, pmax, pmax.int, pmin, pmin.int, Position, rank, rbind, Reduce, rownames, sapply, saveRDS, setdiff, table, tapply, union, unique, unsplit, which.max, which.min Welcome to Bioconductor Vignettes contain introductory material; view with &#39;browseVignettes()&#39;. To cite Bioconductor, see &#39;citation("Biobase")&#39;, and for packages &#39;citation("pkgname")&#39;. 载入需要的程序包:S4Vectors 载入需要的程序包:stats4 载入程序包:‘S4Vectors’ The following object is masked from ‘package:utils’: findMatches The following objects are masked from ‘package:base’: expand.grid, I, unname 载入需要的程序包:ggplot2 > library(Seurat) 载入需要的程序包:SeuratObject 载入需要的程序包:sp 载入程序包:‘SeuratObject’ The following object is masked from ‘package:S4Vectors’: intersect The following object is masked from ‘package:BiocGenerics’: intersect The following objects are masked from ‘package:base’: intersect, t > slide1_obj <- ReadNanostring( + data.dir = ".", + mtx.file = "GSE277782_Run5961_PDAC_Slide1_exprMat_file.csv.gz", + metadata.file = "GSE277782_Run5961_PDAC_Slide1_metadata_file.csv.gz", + segmentations.file = "GSE277782_Run5961_PDAC_Slide1-polygons.csv.gz", + fov.file = "GSE277782_Run5961_PDAC_Slide1_fov_positions_file.csv.gz", + assay = "Spatial" + ) 错误于ReadNanostring(data.dir = ".", mtx.file = "GSE277782_Run5961_PDAC_Slide1_exprMat_file.csv.gz", : 参数没有用(fov.file = "GSE277782_Run5961_PDAC_Slide1_fov_positions_file.csv.gz", assay = "Spatial") > slide1_obj <- ReadNanostring( + data.dir = ".", + mtx.file = "GSE277782_Run5961_PDAC_Slide1_exprMat_file.csv.gz", + metadata.file = "GSE277782_Run5961_PDAC_Slide1_metadata_file.csv.gz", + segmentations.file = "GSE277782_Run5961_PDAC_Slide1-polygons.csv.gz" + ) 错误于ReadNanostring(data.dir = ".", mtx.file = "GSE277782_Run5961_PDAC_Slide1_exprMat_file.csv.gz", : 找不到对象&#39;mx&#39; > slide1_obj <- ReadNanostring( + data.dir = "/data1/firefox", + mtx.file = "GSE277782_Run5961_PDAC_Slide1_exprMat_file.csv.gz", + metadata.file = "GSE277782_Run5961_PDAC_Slide1_metadata_file.csv.gz", + segmentations.file = "GSE277782_Run5961_PDAC_Slide1-polygons.csv.gz" + ) 错误于ReadNanostring(data.dir = "/data1/firefox", mtx.file = "GSE277782_Run5961_PDAC_Slide1_exprMat_file.csv.gz", : 找不到对象&#39;mx&#39; > required_files <- c( + mtx = "GSE277782_Run5961_PDAC_Slide1_exprMat_file.csv.gz", + metadata = "GSE277782_Run5961_PDAC_Slide1_metadata_file.csv.gz", + segmentations = "GSE277782_Run5961_PDAC_Slide1-polygons.csv.gz" + ) > file_check <- sapply(required_files, function(file) { + file.exists(file) + }) > if (all(file_check)) { + cat("✅ 所有必要文件均存在\n") + } else { + missing_files <- names(file_check)[!file_check] + cat("❌ 缺失以下必要文件:\n") + cat(paste("-", missing_files, "\n", sep="")) + stop("请先确保所有文件存在于指定目录") + } ✅ 所有必要文件均存在 > # 检查表达矩阵格式(前5行5列) > cat("\n=== 验证表达矩阵格式 ===\n") === 验证表达矩阵格式 === > tryCatch({ + mtx_sample <- read.csv(required_files["mtx"], nrows=5, header=TRUE) + cat("表达矩阵前5行5列预览:\n") + print(head(mtx_sample[, 1:5])) + if (!is.numeric(as.matrix(mtx_sample[, -1]))) { + stop("表达矩阵包含非数值数据") + } + cat("✅ 表达矩阵格式验证通过\n") + }, error = function(e) { + cat("❌ 表达矩阵格式错误:", e$message, "\n") + stop("请检查表达矩阵文件格式") + }) 表达矩阵前5行5列预览: fov cell_ID RAMP2 CD83 RYK 1 1 0 13 59 36 2 1 1 0 0 1 3 1 2 0 0 0 4 1 3 1 0 0 5 1 4 0 0 0 ✅ 表达矩阵格式验证通过 > # ----------------------------- > # 步骤2:使用修正参数调用ReadNanostring > # ----------------------------- > cat("\n=== 尝试加载数据 ===\n") === 尝试加载数据 === > if (!requireNamespace("NanoStringNCTools", quietly=TRUE)) { + stop("NanoStringNCTools包未安装") + } > library(NanoStringNCTools) > library(Seurat) > # 尝试使用基础参数加载(避免可能的内部变量冲突) > tryCatch({ + # 仅使用必要参数,避免复杂参数组合 + slide1_obj <- ReadNanostring( + data.dir = data_dir, + mtx.file = required_files["mtx"], + metadata.file = required_files["metadata"], + segmentations.file = required_files["segmentations"], + verbose = TRUE # 输出详细过程信息 + ) + cat("✅ 数据加载成功\n") + }, error = function(e) { + cat("❌ ReadNanostring调用失败:", e$message, "\n") + + # ----------------------------- + # 备选方案:手动构建Seurat对象 + # ----------------------------- + cat("\n=== 尝试备选方案:手动构建Seurat对象 ===\n") + + # 1. 读取表达矩阵 + cat("读取表达矩阵...\n") + expr_matrix <- read.csv(required_files["mtx"], row.names=1) %>% as.matrix() + + # 2. 读取元数据 + cat("读取元数据...\n") + metadata <- read.csv(required_files["metadata"], row.names=1) + + # 3. 读取空间坐标(从segmentations文件) + cat("读取空间坐标...\n") + segmentations <- read.csv(required_files["segmentations"]) + coords <- segmentations %>% + select(cell_id, x, y) %>% # 根据实际列名调整 + column_to_rownames("cell_id") + + # 4. 创建Seurat对象 + cat("创建Seurat对象...\n") + seurat_obj <- CreateSeuratObject( + counts = expr_matrix, + meta.data = metadata + ) + + # 5. 添加空间坐标 + if (nrow(coords) > 0) { + seurat_obj@images$image <- new( + Class = "SpatialImage", + assay = "RNA", + coordinates = coords[colnames(seurat_obj), ] + ) + cat("✅ 已添加空间坐标信息\n") + } + + # 6. 保存结果 + saveRDS(seurat_obj, "manual_seurat_object.rds") + cat("✅ 备选方案成功:手动创建的Seurat对象已保存为manual_seurat_object.rds\n") + cat("请使用以下代码加载:\n") + cat("seurat_obj <- readRDS(&#39;manual_seurat_object.rds&#39;)\n") + })ReadNanostring调用失败: 参数没有用(verbose = TRUE) === 尝试备选方案:手动构建Seurat对象 === 读取表达矩阵... 错误于read.csv(required_files["mtx"], row.names = 1) %>% as.matrix(): 没有"%>%"这个函数 Called from: value[[3L]](cond) Browse[1]> Q > library(dplyr) 载入程序包:‘dplyr’ The following object is masked from ‘package:NanoStringNCTools’: groups The following objects are masked from ‘package:S4Vectors’: first, intersect, rename, setdiff, setequal, union The following object is masked from ‘package:Biobase’: combine The following objects are masked from ‘package:BiocGenerics’: combine, intersect, setdiff, union The following objects are masked from ‘package:stats’: filter, lag The following objects are masked from ‘package:base’: intersect, setdiff, setequal, union > # 尝试使用基础参数加载(避免可能的内部变量冲突) > tryCatch({ + # 仅使用必要参数,避免复杂参数组合 + slide1_obj <- ReadNanostring( + data.dir = data_dir, + mtx.file = required_files["mtx"], + metadata.file = required_files["metadata"], + segmentations.file = required_files["segmentations"], + verbose = TRUE # 输出详细过程信息 + ) + cat("✅ 数据加载成功\n") + }, error = function(e) { + cat("❌ ReadNanostring调用失败:", e$message, "\n") + + # ----------------------------- + # 备选方案:手动构建Seurat对象 + # ----------------------------- + cat("\n=== 尝试备选方案:手动构建Seurat对象 ===\n") + + # 1. 读取表达矩阵 + cat("读取表达矩阵...\n") + expr_matrix <- read.csv(required_files["mtx"], row.names=1) %>% as.matrix() + + # 2. 读取元数据 + cat("读取元数据...\n") + metadata <- read.csv(required_files["metadata"], row.names=1) + + # 3. 读取空间坐标(从segmentations文件) + cat("读取空间坐标...\n") + segmentations <- read.csv(required_files["segmentations"]) + coords <- segmentations %>% + select(cell_id, x, y) %>% # 根据实际列名调整 + column_to_rownames("cell_id") + + # 4. 创建Seurat对象 + cat("创建Seurat对象...\n") + seurat_obj <- CreateSeuratObject( + counts = expr_matrix, + meta.data = metadata + ) + + # 5. 添加空间坐标 + if (nrow(coords) > 0) { + seurat_obj@images$image <- new( + Class = "SpatialImage", + assay = "RNA", + coordinates = coords[colnames(seurat_obj), ] + ) + cat("✅ 已添加空间坐标信息\n") + } + + # 6. 保存结果 + saveRDS(seurat_obj, "manual_seurat_object.rds") + cat("✅ 备选方案成功:手动创建的Seurat对象已保存为manual_seurat_object.rds\n") + cat("请使用以下代码加载:\n") + cat("seurat_obj <- readRDS(&#39;manual_seurat_object.rds&#39;)\n") + })ReadNanostring调用失败: 参数没有用(verbose = TRUE) === 尝试备选方案:手动构建Seurat对象 === 读取表达矩阵... 错误于h(simpleError(msg, call)): 在为函数“as.matrix”选择方法时计算参数“x”时出错:&#39;row.names&#39;里不能有重复的名称 Called from: h(simpleError(msg, call)) Browse[1]> Q > ?ReadNanostring > slide1_obj <- ReadNanostring( + data.dir = "/data1/firefox", + mtx.file = "GSE277782_Run5961_PDAC_Slide1_exprMat_file.csv.gz", + metadata.file = "GSE277782_Run5961_PDAC_Slide1_metadata_file.csv.gz", + molecules.file = "" + segmentations.file = "GSE277782_Run5961_PDAC_Slide1-polygons.csv.gz" 错误: 意外的符号 于 " molecules.file = "" segmentations.file" > slide1_obj <- ReadNanostring( + data.dir = "/data1/firefox", + mtx.file = "GSE277782_Run5961_PDAC_Slide1_exprMat_file.csv.gz", + metadata.file = "GSE277782_Run5961_PDAC_Slide1_metadata_file.csv.gz", + segmentations.file = "GSE277782_Run5961_PDAC_Slide1-polygons.csv.gz" + ) 错误于ReadNanostring(data.dir = "/data1/firefox", mtx.file = "GSE277782_Run5961_PDAC_Slide1_exprMat_file.csv.gz", : 找不到对象&#39;mx&#39; > rm(mtx_sample) > setwd("/data1/firefox/GSE277782_Run5961_PDAC_Slide1") > slide1_obj <- ReadNanostring( + data.dir = "/data1/firefox/GSE277782_Run5961_PDAC_Slide1", + mtx.file = "Run5961_PDAC_Slide1_exprMat_file.csv", + metadata.file = "Run5961_PDAC_Slide1_metadata_file.csv", + molecules.file = "Run5961_PDAC_Slide1_tx_file.csv", + segmentations.file = "Run5961_PDAC_Slide1-polygons.csv" + ) > View(slide1_obj) > library(magick) Linking to ImageMagick 6.9.10.23 Enabled features: fontconfig, freetype, fftw, lcms, pango, webp, x11 Disabled features: cairo, ghostscript, heic, raw, rsvg Using 96 threads > slide1_obj <- ReadNanostring( + data.dir = "/data1/firefox/GSE277782_Run5961_PDAC_Slide1", + mtx.file = "Run5961_PDAC_Slide1_exprMat_file.csv", + metadata.file = "Run5961_PDAC_Slide1_metadata_file.csv", + molecules.file = "Run5961_PDAC_Slide1_tx_file.csv", + segmentations.file = "Run5961_PDAC_Slide1-polygons.csv" + ) > fov_positions <- read.csv( + "Run5961_PDAC_Slide1_fov_positions_file.csv", + header = TRUE + ) > cat("FOV位置数据列名:", colnames(fov_positions), "\n") FOV位置数据列名: fov x_global_px y_global_px > max_x <- max(fov_positions$x_global_px) + 2048 > max_x <- max(fov_positions$x_global_px) + 2048 > max_y <- max(fov_positions$y_global_px) + 2048 # 假设单视野高2048像素 > combined_image <- image_blank( + width = max_x, + height = max_y, + color = "white" # 白色背景 + ) 错误: rsession: width or height exceeds limit `#FFFFFFFFFFFF&#39; @ error/cache.c/OpenPixelCache/3911 > cat("x_global_px范围:", range(fov_positions$x_global_px), "\n") x_global_px范围: -193718.9 -96445.92 > > cat("y_global_px范围:", range(fov_positions$y_global_px), "\n") y_global_px范围: -74903.74 65186.42 > > View(fov_positions) > library(data.table) # Efficient data management data.table 1.17.0,使用了 48 个线程(参见 ?getDTthreads)。 最新的消息:r-datatable.com ********** Running data.table in English; package support is available in English only. When searching for online help, be sure to also check for the English error message. This can be obtained by looking at the po/R-<locale>.po and po/<locale>.po files in the package source, where the native language and English error messages can be found side-by-side. You can also try calling Sys.setLanguage(&#39;en&#39;) prior to reproducing the error message. ********** 载入程序包:‘data.table’ The following objects are masked from ‘package:dplyr’: between, first, last The following objects are masked from ‘package:S4Vectors’: first, second > library(Matrix) # Sparse matrices 载入程序包:‘Matrix’ The following object is masked from ‘package:S4Vectors’: expand > library(here) # Enhanced file referencing in project-oriented workflows here() starts at /data1/firefox/GSE277782_Run5961_PDAC_Slide1 > library(vecsets) # Enhanced version of the Set Operations from "base" 错误于library(vecsets): 不存在叫‘vecsets’这个名称的程序包 > BiocManager::install("vecsets") &#39;getOption("repos")&#39; replaces Bioconductor standard repositories, see &#39;help("repositories", package = "BiocManager")&#39; for details. Replacement repositories: CRAN: https://cloud.r-project.org Bioconductor version 3.20 (BiocManager 1.30.25), R 4.4.3 (2025-02-28) Installing package(s) &#39;vecsets&#39; 还安装依赖关系‘pracma’ 试开URL’https://cloud.r-project.org/src/contrib/pracma_2.4.4.tar.gz&#39; Content type &#39;application/x-gzip&#39; length 397815 bytes (388 KB) ================================================== downloaded 388 KB 试开URL’https://cloud.r-project.org/src/contrib/vecsets_1.4.tar.gz&#39; Content type &#39;application/x-gzip&#39; length 5714 bytes ================================================== downloaded 5714 bytes * installing *source* package ‘pracma’ ... ** 成功将‘pracma’程序包解包并MD5和检查 ** using staged installation ** R ** data *** moving datasets to lazyload DB ** demo ** byte-compile and prepare package for lazy loading ** help *** installing help indices ** building package indices ** testing if installed package can be loaded from temporary location ** testing if installed package can be loaded from final location ** testing if installed package keeps a record of temporary installation path * DONE (pracma) * installing *source* package ‘vecsets’ ... ** 成功将‘vecsets’程序包解包并MD5和检查 ** using staged installation ** R ** byte-compile and prepare package for lazy loading ** help *** installing help indices ** building package indices ** testing if installed package can be loaded from temporary location ** testing if installed package can be loaded from final location ** testing if installed package keeps a record of temporary installation path * DONE (vecsets) 下载的程序包在 ‘/tmp/Rtmp5RH1TC/downloaded_packages’里 Installation paths not writeable, unable to update packages path: /usr/lib/R/library packages: boot, codetools, foreign, lattice, Matrix, mgcv, nlme, spatial Old packages: &#39;aplot&#39;, &#39;BiocManager&#39;, &#39;BiocParallel&#39;, &#39;bookdown&#39;, &#39;broom&#39;, &#39;Cairo&#39;, &#39;checkmate&#39;, &#39;cli&#39;, &#39;collections&#39;, &#39;colorspace&#39;, &#39;cols4all&#39;, &#39;commonmark&#39;, &#39;cowplot&#39;, &#39;credentials&#39;, &#39;crosstalk&#39;, &#39;curl&#39;, &#39;data.table&#39;, &#39;data.tree&#39;, &#39;dbplyr&#39;, &#39;dbscan&#39;, &#39;Deriv&#39;, &#39;diffobj&#39;, &#39;doBy&#39;, &#39;DT&#39;, &#39;dtplyr&#39;, &#39;evaluate&#39;, &#39;fastcluster&#39;, &#39;fields&#39;, &#39;fitdistrplus&#39;, &#39;forcats&#39;, &#39;fs&#39;, &#39;future&#39;, &#39;future.apply&#39;, &#39;gargle&#39;, &#39;generics&#39;, &#39;ggforce&#39;, &#39;ggfun&#39;, &#39;ggnetwork&#39;, &#39;ggnewscale&#39;, &#39;ggplotify&#39;, &#39;ggpubr&#39;, &#39;ggraph&#39;, &#39;ggridges&#39;, &#39;ggsci&#39;, &#39;ggtangle&#39;, &#39;gh&#39;, &#39;globals&#39;, &#39;googledrive&#39;, &#39;googlesheets4&#39;, &#39;haven&#39;, &#39;here&#39;, &#39;httpuv&#39;, &#39;httr2&#39;, &#39;igraph&#39;, &#39;later&#39;, &#39;logger&#39;, &#39;magick&#39;, &#39;magrittr&#39;, &#39;maps&#39;, &#39;miniUI&#39;, &#39;mockr&#39;, &#39;modeltools&#39;, &#39;msigdbr&#39;, &#39;nanoarrow&#39;, &#39;openssl&#39;, &#39;parallelly&#39;, &#39;patchwork&#39;, &#39;pbapply&#39;, &#39;pbkrtest&#39;, &#39;pheatmap&#39;, &#39;pillar&#39;, &#39;pkgbuild&#39;, &#39;pkgdown&#39;, &#39;pkgload&#39;, &#39;plotly&#39;, &#39;progressr&#39;, &#39;promises&#39;, &#39;ps&#39;, &#39;psych&#39;, &#39;purrr&#39;, &#39;R.cache&#39;, &#39;R.oo&#39;, &#39;ragg&#39;, &#39;Rcpp&#39;, &#39;RcppArmadillo&#39;, &#39;RcppParallel&#39;, &#39;reformulas&#39;, &#39;ResidualMatrix&#39;, &#39;restfulr&#39;, &#39;reticulate&#39;, &#39;rlang&#39;, &#39;roxygen2&#39;, &#39;rprojroot&#39;, &#39;rsample&#39;, &#39;RSQLite&#39;, &#39;RUnit&#39;, &#39;rvest&#39;, &#39;s2&#39;, &#39;sass&#39;, &#39;scatterpie&#39;, &#39;SCpubr&#39;, &#39;sctransform&#39;, &#39;SeuratObject&#39;, &#39;sf&#39;, &#39;shiny&#39;, &#39;spacesXYZ&#39;, &#39;spatstat&#39;, &#39;spatstat.data&#39;, &#39;spatstat.explore&#39;, &#39;spatstat.geom&#39;, &#39;spatstat.linnet&#39;, &#39;spatstat.model&#39;, &#39;spatstat.random&#39;, &#39;spatstat.univar&#39;, &#39;spatstat.utils&#39;, &#39;spdep&#39;, &#39;stringr&#39;, &#39;survminer&#39;, &#39;svglite&#39;, &#39;systemfonts&#39;, &#39;tensor&#39;, &#39;terra&#39;, &#39;textshaping&#39;, &#39;TH.data&#39;, &#39;tibble&#39;, &#39;tinytex&#39;, &#39;usethis&#39;, &#39;utf8&#39;, &#39;V8&#39;, &#39;vroom&#39;, &#39;waldo&#39;, &#39;xfun&#39;, &#39;xgboost&#39;, &#39;XML&#39;, &#39;xml2&#39;, &#39;yulab.utils&#39;, &#39;zip&#39;, &#39;zoo&#39; Update all/some/none? [a/s/n]: n > library(vecsets) # Enhanced version of the Set Operations from "base" > library(dplyr) # For the use of pipes %>% > library(kableExtra) # For table formatting 错误于library(kableExtra): 不存在叫‘kableExtra’这个名称的程序包 > BiocManager::install("kableExtra") &#39;getOption("repos")&#39; replaces Bioconductor standard repositories, see &#39;help("repositories", package = "BiocManager")&#39; for details. Replacement repositories: CRAN: https://cloud.r-project.org Bioconductor version 3.20 (BiocManager 1.30.25), R 4.4.3 (2025-02-28) Installing package(s) &#39;kableExtra&#39; 试开URL’https://cloud.r-project.org/src/contrib/kableExtra_1.4.0.tar.gz&#39; Content type &#39;application/x-gzip&#39; length 1824636 bytes (1.7 MB) ================================================== downloaded 1.7 MB * installing *source* package ‘kableExtra’ ... ** 成功将‘kableExtra’程序包解包并MD5和检查 ** using staged installation ** R ** inst ** byte-compile and prepare package for lazy loading ** help *** installing help indices ** building package indices ** installing vignettes ** testing if installed package can be loaded from temporary location ** testing if installed package can be loaded from final location ** testing if installed package keeps a record of temporary installation path * DONE (kableExtra) 下载的程序包在 ‘/tmp/Rtmp5RH1TC/downloaded_packages’里 Installation paths not writeable, unable to update packages path: /usr/lib/R/library packages: boot, codetools, foreign, lattice, Matrix, mgcv, nlme, spatial Old packages: &#39;aplot&#39;, &#39;BiocManager&#39;, &#39;BiocParallel&#39;, &#39;bookdown&#39;, &#39;broom&#39;, &#39;Cairo&#39;, &#39;checkmate&#39;, &#39;cli&#39;, &#39;collections&#39;, &#39;colorspace&#39;, &#39;cols4all&#39;, &#39;commonmark&#39;, &#39;cowplot&#39;, &#39;credentials&#39;, &#39;crosstalk&#39;, &#39;curl&#39;, &#39;data.table&#39;, &#39;data.tree&#39;, &#39;dbplyr&#39;, &#39;dbscan&#39;, &#39;Deriv&#39;, &#39;diffobj&#39;, &#39;doBy&#39;, &#39;DT&#39;, &#39;dtplyr&#39;, &#39;evaluate&#39;, &#39;fastcluster&#39;, &#39;fields&#39;, &#39;fitdistrplus&#39;, &#39;forcats&#39;, &#39;fs&#39;, &#39;future&#39;, &#39;future.apply&#39;, &#39;gargle&#39;, &#39;generics&#39;, &#39;ggforce&#39;, &#39;ggfun&#39;, &#39;ggnetwork&#39;, &#39;ggnewscale&#39;, &#39;ggplotify&#39;, &#39;ggpubr&#39;, &#39;ggraph&#39;, &#39;ggridges&#39;, &#39;ggsci&#39;, &#39;ggtangle&#39;, &#39;gh&#39;, &#39;globals&#39;, &#39;googledrive&#39;, &#39;googlesheets4&#39;, &#39;haven&#39;, &#39;here&#39;, &#39;httpuv&#39;, &#39;httr2&#39;, &#39;igraph&#39;, &#39;later&#39;, &#39;logger&#39;, &#39;magick&#39;, &#39;magrittr&#39;, &#39;maps&#39;, &#39;miniUI&#39;, &#39;mockr&#39;, &#39;modeltools&#39;, &#39;msigdbr&#39;, &#39;nanoarrow&#39;, &#39;openssl&#39;, &#39;parallelly&#39;, &#39;patchwork&#39;, &#39;pbapply&#39;, &#39;pbkrtest&#39;, &#39;pheatmap&#39;, &#39;pillar&#39;, &#39;pkgbuild&#39;, &#39;pkgdown&#39;, &#39;pkgload&#39;, &#39;plotly&#39;, &#39;progressr&#39;, &#39;promises&#39;, &#39;ps&#39;, &#39;psych&#39;, &#39;purrr&#39;, &#39;R.cache&#39;, &#39;R.oo&#39;, &#39;ragg&#39;, &#39;Rcpp&#39;, &#39;RcppArmadillo&#39;, &#39;RcppParallel&#39;, &#39;reformulas&#39;, &#39;ResidualMatrix&#39;, &#39;restfulr&#39;, &#39;reticulate&#39;, &#39;rlang&#39;, &#39;roxygen2&#39;, &#39;rprojroot&#39;, &#39;rsample&#39;, &#39;RSQLite&#39;, &#39;RUnit&#39;, &#39;rvest&#39;, &#39;s2&#39;, &#39;sass&#39;, &#39;scatterpie&#39;, &#39;SCpubr&#39;, &#39;sctransform&#39;, &#39;SeuratObject&#39;, &#39;sf&#39;, &#39;shiny&#39;, &#39;spacesXYZ&#39;, &#39;spatstat&#39;, &#39;spatstat.data&#39;, &#39;spatstat.explore&#39;, &#39;spatstat.geom&#39;, &#39;spatstat.linnet&#39;, &#39;spatstat.model&#39;, &#39;spatstat.random&#39;, &#39;spatstat.univar&#39;, &#39;spatstat.utils&#39;, &#39;spdep&#39;, &#39;stringr&#39;, &#39;survminer&#39;, &#39;svglite&#39;, &#39;systemfonts&#39;, &#39;tensor&#39;, &#39;terra&#39;, &#39;textshaping&#39;, &#39;TH.data&#39;, &#39;tibble&#39;, &#39;tinytex&#39;, &#39;usethis&#39;, &#39;utf8&#39;, &#39;V8&#39;, &#39;vroom&#39;, &#39;waldo&#39;, &#39;xfun&#39;, &#39;xgboost&#39;, &#39;XML&#39;, &#39;xml2&#39;, &#39;yulab.utils&#39;, &#39;zip&#39;, &#39;zoo&#39; Update all/some/none? [a/s/n]: n > library(kableExtra) # For table formatting 载入程序包:‘kableExtra’ The following object is masked from ‘package:dplyr’: group_rows > library(Seurat) # Seurat object > metadata <- read.csv( "Run5961_PDAC_Slide1_metadata_file.csv", header = TRUE) > exprMat <- read.csv("Run5961_PDAC_Slide1_exprMat_file.csv", row.names = 1 ) 错误于read.table(file = file, header = header, sep = sep, quote = quote, : &#39;row.names&#39;里不能有重复的名称 > exprMat <- read.csv("Run5961_PDAC_Slide1_exprMat_file.csv", header = TRUE) > head(fov_positions) fov x_global_px y_global_px 1 31 -167790.5 60037.54 2 33 -168926.1 50800.38 3 35 -167131.8 36894.30 4 34 -166881.8 32628.33 5 30 -153631.6 35808.63 6 45 -143096.8 38916.08 > > metadata[1:6,1:6] fov cell_ID Area AspectRatio CenterX_local_px CenterY_local_px 1 1 1 10063 1.39 93 4209 2 1 2 2783 1.43 1214 4232 3 1 3 7246 2.34 2498 4223 4 1 4 8318 1.35 2769 4211 5 1 5 4371 1.10 3226 4221 6 1 6 6603 1.41 3009 4217 > > cells_0 <- grep("_0$", rownames(exprMat), value = TRUE) > > negPrb_col <- grep("^Neg", colnames(exprMat), value = TRUE) # Neg columns > > sysCon_col <- grep("^SystemControl", colnames(exprMat), value = TRUE) # SystemControl columns > > as.matrix(exprMat[1:6, 1:10]) fov cell_ID RAMP2 CD83 RYK CD5L NLRP2 BIRC5 LIF H2AZ1 1 1 0 13 59 36 33 20 26 54 84 2 1 1 0 0 1 1 0 1 1 0 3 1 2 0 0 0 0 0 0 0 0 4 1 3 1 0 0 0 0 0 0 0 5 1 4 0 0 0 0 0 0 0 0 6 1 5 0 0 0 0 0 0 0 0
09-28
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值