-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path01_get_samplenames_table.R
executable file
·38 lines (29 loc) · 1.21 KB
/
01_get_samplenames_table.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!usr/bin/Rscript
# dependencies
library(tidyverse)
# import table
sra_runtable <- read.table("./SraRunTable.txt", sep = ",",
header = TRUE)
# filter columns
sra_runtable <- sra_runtable[, c("Run", "chip_antibody", "Developmental_stage")]
colnames(sra_runtable)[1] <- "run"
# change chip_antibody None values to Input
sra_runtable[sra_runtable == "None"] <- "Input"
# format rows
#sra_runtable$chip_antibody <- gsub(" ", "-", sra_runtable$chip_antibody)
#sra_runtable$chip_antibody <- gsub("\\.", "", sra_runtable$chip_antibody)
# merge rows
sra_runtable$samplename <- paste(sra_runtable$Developmental_stage, "_",
sra_runtable$chip_antibody, "_",
sra_runtable$run)
# format rows
sra_runtable$samplename <- gsub(" ", "", sra_runtable$samplename)
sra_runtable$samplename <- gsub("\\.", "", sra_runtable$samplename)
sra_runtable$samplename <- gsub("\\(", "-", sra_runtable$samplename)
sra_runtable$samplename <- gsub("\\)", "", sra_runtable$samplename)
# remove unnnecessary columns
sra_runtable <- sra_runtable[, c(1, 4)]
# export table
write.csv(sra_runtable, "./SRA_samplenames.csv",
row.names = FALSE,
quote = FALSE)