jamesbang

V1

2022/11/10阅读：31主题：雁栖湖

# 🤑 qPCRtools | 神仙R包分分钟搞定你的qPCR实验结果！~

## 2用到的包

``rm(list = ls())library(tidyverse)library(ggsci)library(qPCRtools)library(ggstatsplot)``

## 3计算反转录用的RNA体积

### 3.1 示例数据

`df.1`需要至少2列`sample``concentration`，剩下的大家随意。🤣
Note! 这里浓度默认是`ng/ul`。🤜

``df.1.path <- system.file("examples", "crtv.data.txt", package = "qPCRtools")df.1 <- data.table::fread(df.1.path)head(df.1)``

Note! 这里我们的`df.2`文件至少要包含一个`all`的列，告诉`R`具体的反应体积。🤒

``df.2.path <- system.file("examples", "crtv.template.txt", package = "qPCRtools")df.2 <- data.table::fread(df.2.path)head(df.2)``

### 3.2 开始计算

``result <- CalRTable(data = df.1, template = df.2, RNA.weight = 1)head(result)``

## 4相对标准曲线和扩增效率的计算

### 4.1 示例数据

`df.1`包含至少2列，孔的位置`Cq`值。😗

``df.1.path <- system.file("examples", "calsc.cq.txt", package = "qPCRtools")df.1 <- data.table::fread(df.1.path)head(df.1)``

`df.2`包含至少2列，孔的位置`浓度`。🫠

``df.2.path <- system.file("examples", "calsc.info.txt", package = "qPCRtools")df.2 <- data.table::fread(df.2.path)head(df.2)``

### 4.2 开始计算

Note! 大家注意一下这里的稀释倍数，默认是`4`，可以按需更改。😂

``CalCurve(  cq.table = df.1,  concen.table = df.2,  lowest.concen = 4,  highest.concen = 4096,  dilu = 4,  by = "mean") -> pp[["table"]]``

### 4.3 可视化

``p[["figure"]] +  theme_bw()+  scale_color_npg()``

## 5使用相对标准曲线法计算基因表达水平

### 5.1 示例数据

`cq.table`至少包含`position``Cq`值。😘

``df1.path <-  system.file("examples", "cal.exp.curve.cq.txt", package = "qPCRtools")cq.table <-  data.table::fread(df1.path)head(cq.table)``

`curve.table`标准曲线，可以通过前面介绍的方法计算得出。😂

``df2.path = system.file("examples", "cal.expre.curve.sdc.txt", package = "qPCRtools")curve.table = data.table::fread(df2.path)head(curve.table)``

`design.table`需要包含`position`和相应的信息，如`干预``基因名`等。 🙃

``df3.path = system.file("examples", "cal.exp.curve.design.txt", package = "qPCRtools")design.table = data.table::fread(df3.path)head(design.table)``

### 5.2 开始计算

``CalExpCurve(  cq.table,  curve.table,  design.table,  correction = TRUE,  ref.gene = "OsUBQ",  stat.method = "t.test",  ref.group = "CK",  fig.type = "box",  fig.ncol = NULL) -> resres[["table"]]``

### 5.3 可视化

``res[["table"]] %>%   grouped_ggbetweenstats(y = expre,                        x = Treatment,                        grouping.var = Gene,                        type = "nonparametric"                         )``

## 62-ΔΔCt法计算表达水平

### 6.1 示例数据

``df1.path <-  system.file("examples", "ddct.cq.txt", package = "qPCRtools")cq.table <-  data.table::fread(df1.path)head(cq.table)``

``df2.path <-  system.file("examples", "ddct.design.txt", package = "qPCRtools")design.table <-  data.table::fread(df2.path)head(df.2)``

### 6.2 开始计算

``CalExp2ddCt(cq.table,            design.table,            ref.gene = "OsUBQ", ## 内参            ref.group = "CK", ## 对照            stat.method = "t.test", ## 统计方法            fig.type = "bar",            fig.ncol = NULL) -> resres[["table"]]``

### 6.3 可视化

``res[["table"]] %>%   grouped_ggbetweenstats(y = expre,                        x = Treatment,                        grouping.var = gene,                        type = "nonparametric"                         )``

## 7使用RqPCR方法计算表达水平

### 7.1 示例数据

``df1.path <- system.file("examples", "cal.expre.rqpcr.cq.txt", package = "qPCRtools")cq.table <- data.table::fread(df1.path, header = TRUE)head(cq.table)``

``df2.path <- system.file("examples", "cal.expre.rqpcr.design.txt", package = "qPCRtools")design.table <- data.table::fread(df2.path, header = TRUE)head(design.table)``

### 7.2 开始计算

``CalExpRqPCR(cq.table,           design.table,           ref.gene = NULL,           ref.group = "CK",           stat.method = "t.test",           fig.type = "box",           fig.ncol = NULL           ) -> resres[["table"]]``

### 7.3 可视化

``res[["table"]] %>%   grouped_ggbetweenstats(y = Expre4Stat,                        x = group,                        grouping.var = gene,                        type = "nonparametric"                         )``

## 8引用

🌟 如何引用：👇

Li X, Wang Y, Li J, Mei X, Liu Y, Huang H. qPCRtools: An R package for qPCR data processing and visualization. Front Genet. 2022;13:1002704. Published 2022 Sep 13. doi:10.3389/fgene.2022.1002704

📍 往期精彩

##### jamesbang
V1

wx🔍: Grassssss 卷起来了