### R代码从vignette源的Rsubread。Rnw ' ################################################### ### 代码块1号:Rsubread。Rnw: 70 - 73 ################################################### 库(Rsubread) ref < -执行(“extdata”、“reference.fa”,包=“Rsubread”)buildindex (basename =“reference_index”,引用= ref ) ################################################### ### 代码块2号:Rsubread。Rnw: 90 - 92 ################################################### 读< -执行(“extdata”、“reads.txt.gz”,包=“Rsubread”)一致。统计< -对齐(指数=“reference_index readfile1 =读取,output_file =“alignResults.BAM phredOffset = 64 ) ################################################### ### 代码块3号:Rsubread。Rnw: 99 - 103 ################################################### reads1 < -执行(“extdata”、“reads1.txt.gz”,包=“Rsubread”)reads2 < -执行(“extdata”、“reads2.txt.gz”,包=“Rsubread”)一致。stat2 < -对齐(指数=“reference_index readfile1 = reads1 readfile2 = reads2 output_file =“alignResultsPE.BAM phredOffset = 64 ) ################################################### ### 代码块数量4:Rsubread。Rnw: 125 - 135 ################################################### 安< - data.frame (GeneID = c(“gene1”、“gene1”,“gene2”、“gene2”),装备=“chr_dummy”,开始= c(100, 1000, 3000, 5000),结束= c(500, 1800, 4000, 5500),链= c ("+","+","-","-"), stringsAsFactors = FALSE)安fc_SE < - featureCounts(“alignResults.BAM”,annot.ext =安)fc_SE ################################################### ### 代码块5号:Rsubread。Rnw: 142 - 144 ################################################### fc_PE < - featureCounts(“alignResultsPE.BAM annot.ext =安,isPairedEnd = TRUE) fc_PE ################################################### ### 代码块6号:Rsubread。Rnw: 152 - 174 ################################################### 如果(.Platform $ OS。type != "windows") {md5.zip <- "ffd5036b36e25e9b61efc412e71820dd" URL <- "https://shilab-bioinformatics.github.io/cellCounts-Example/cellCounts-Example.zip" temp.file <- tempfile() temp.dir <- tempdir() downloading <- tryCatch({download. zip")file(URL, destfile = temp.file) tools::md5sum(temp.file) %in% md5.zip}, error = function(cond){return(FALSE)}) if(!文件,exdir = paste0 (temp.dir / cellCounts-Example))库(Rsubread) buildindex (paste0 (temp.dir“/ chr1”),paste0 (/ cellCounts-Example / hg38_chr1.fa.gz temp.dir。 ")) } ################################################### ### 代码块7号:Rsubread。Rnw: 176 - 185 ################################################### 如果(下载){样本。sheet <- data.frame(BarcodeUMIFile = paste0(temp.dir,"/cellCounts-Example/reads_R1.fastq.gz"), ReadFile = paste0(temp.dir,"/cellCounts-Example/reads_R2.fastq.gz"), SampleName="Example", stringsAsFactors=FALSE) counts <- cellCounts(paste0(temp.dir,"/chr1"),表,nthreads=1,输入。mode="FASTQ", annot.inbuilt="hg38") } ################################################### ### code chunk number 8: Rsubread.Rnw:187-188 ################################################### if(downloaded) print(counts$sample.info) ################################################### ### code chunk number 9: Rsubread.Rnw:190-191 ################################################### if(downloaded) print(dim(counts$counts$Example)) ################################################### ### code chunk number 10: Rsubread.Rnw:211-213 ################################################### x <- qualityScores(filename=reads,offset=64,nreads=1000) x[1:10,1:10] ################################################### ### code chunk number 11: Rsubread.Rnw:238-239 ################################################### propmapped("alignResults.BAM")