Skip to content

Commit 4335c75

Browse files
committed
update pipeline doc code
1 parent ad17a28 commit 4335c75

File tree

1 file changed

+10
-18
lines changed

1 file changed

+10
-18
lines changed

RNAseq/Pipeline_GL-DPPD-7115_Versions/GL-DPPD-7115.md

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1254,7 +1254,8 @@ res_lrt <- results(dds_lrt)
12541254

12551255
```R
12561256
### Initialize output table with normalized counts ###
1257-
output_table <- tibble::rownames_to_column(normCounts, var = gene_id)
1257+
gene_id_type <- "ENSEMBL"
1258+
output_table <- tibble::rownames_to_column(normCounts, var = gene_id_type)
12581259

12591260
### Iterate through Wald Tests to generate pairwise comparisons of all groups ###
12601261
compute_contrast <- function(i) {
@@ -1314,43 +1315,34 @@ annot <- read.table(annotations_link,
13141315
sep = "\t",
13151316
header = TRUE,
13161317
quote = "",
1317-
comment.char = "",
1318-
row.names = 1
1318+
comment.char = ""
13191319
)
13201320

13211321
### Combine annotations table and the DGE table ###
1322-
output_table <- merge(annot, output_table, by='row.names', all.y=TRUE)
1323-
output_table <- annot %>%
1324-
merge(output_table,
1325-
by = gene_id,
1326-
all.y = TRUE
1327-
) %>%
1328-
select(all_of(gene_id), everything())
1329-
1330-
if (!(gene_id %in% colnames(annot)) || !(gene_id %in% colnames(output_table))) {
1331-
# If gene ID column is missing from either table, just write the original DGE table
1332-
output_table2 <- output_table
1333-
warning(paste("Gene ID column", gene_id, "not found in one or both tables."))
1322+
# If gene ID column is missing from either table, just write the original DGE table
1323+
if (!(gene_id_type %in% colnames(annot)) || !(gene_id_type %in% colnames(output_table))) {
1324+
warning(paste("Gene ID column", gene_id_type, "not found in both tables."))
13341325
} else {
13351326
### Combine annotations with data
13361327
output_table <- annot %>%
13371328
merge(output_table,
1338-
by = gene_id,
1329+
by = gene_id_type,
13391330
all.y = TRUE
13401331
) %>%
1341-
select(all_of(gene_id), everything()) # Make sure main gene ID is first column
1332+
select(all_of(gene_id_type), everything()) # Make sure main gene ID is first column
13421333
}
13431334

13441335
```
13451336

13461337
**Input Data:**
13471338

1339+
- `gene_id_type` (Gene identifier type, e.g. ENSEMBL, used to merge the annotations with the DGE results)
13481340
- `normCounts` (data frame of normalized counts, output from [Step 8e](#8e-perform-dge-analysis))
13491341
- `res_lrt` (results object from likelihood ratio test, output from [Step 8e](#8e-perform-dge-analysis))
13501342
- `contrasts` (matrix defining pairwise comparisons, output from [Step 8c](#8c-configure-metadata-sample-grouping-and-group-comparisons))
13511343
- `dds` (DESeq2 data object containing normalized counts, experimental design, and differential expression results, output from [Step 8e](#8e-perform-dge-analysis))
13521344
- `annotations_link` (variable containing URL to GeneLab gene annotation table, output from [Step 8b](#8b-environment-set-up))
1353-
- `gene_id` (Gene id type, e.g. ENSEMBL, used to merge the annotations with the DGE results)
1345+
13541346
**Output Data:**
13551347

13561348
- `output_table` (data frame containing the following columns:

0 commit comments

Comments
 (0)