Skip to content

Commit

Permalink
Add batch id
Browse files Browse the repository at this point in the history
  • Loading branch information
ShixiangWang committed Dec 8, 2022
1 parent 3dc4a4a commit 744880f
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions data-raw/update_tcga_cli.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# https://zenodo.org/record/6326542#.Y4sP5ZxBzvQ
# https://doi.org/10.1101/2021.11.01.466731
devtools::load_all()

fl = list.files("~/Downloads/TCGA_RNASeq", pattern = "rds", full.names = TRUE)
rf = dplyr::tibble()

for (i in fl) {
x = readRDS(i)
x2 = colData(x)
x2 = as.data.frame(x2[, c("Samples", "BatchId_mda")])
x2 = x2 |>
dplyr::as_tibble() |>
dplyr::rename(sample = Samples, BatchId = BatchId_mda) |>
dplyr::mutate(sample = substr(sample, 1, 15))
rf = dplyr::bind_rows(rf, x2)
}

tcga_clinical = tcga_clinical |>
dplyr::left_join(rf, by = "sample")

usethis::use_data(tcga_clinical, overwrite = TRUE)
Binary file modified data/tcga_clinical.rda
Binary file not shown.

0 comments on commit 744880f

Please sign in to comment.