-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathswish.R
95 lines (56 loc) · 2.05 KB
/
swish.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
library(tximeta)
library(fishpond)
files_df <- as.data.frame(files)
files_df <- rownames_to_column(files_df)
files_df <- left_join(files_df, xie_kidney_index, by = c("rowname"="X1"))
files_df <- files_df %>% select(1,2,4)
names(files_df) <- c("names", "files", "condition")
se <- tximeta(files_df)
se$condition <- factor(se$condition, levels = c("control","metformin"))
y<-se
y$condition
## Running Swish at the transcript level
# Squash Technical Reps
y <- fishpond::scaleInfReps(y)
# Filter rows
y <- fishpond::labelKeep(y, minCount = 10, minN = 3)
y <- y[mcols(y)$keep,]
# set.seed(1)
y <- fishpond::swish(y, x = "condition")
##############################
DET_results <- S4Vectors::mcols(y) %>%
base::as.data.frame() %>%
tibble::rownames_to_column("transcript_id") %>%
tibble::as_tibble()
#####
test <- left_join(DET_results, txtogenesv37, by = "transcript_id")
Xie_kidney_swish<- test %>% dplyr::select(1,8,9,11,15,16,18)
write.csv(Xie_kidney_swish, "Xie_kidney_swish.csv")
##############
#lung swish
files_df <- as.data.frame(files)
files_df <- rownames_to_column(files_df)
files_df <- left_join(files_df, xie_lung_index, by = c("rowname"="X1"))
files_df <- files_df %>% dplyr::select(1,2,4)
names(files_df) <- c("names", "files", "condition")
se <- tximeta(files_df)
se$condition <- factor(se$condition, levels = c("control","metformin"))
y<-se
y$condition
## Running Swish at the transcript level
# Squash Technical Reps
y <- fishpond::scaleInfReps(y)
# Filter rows
y <- fishpond::labelKeep(y, minCount = 10, minN = 3)
y <- y[mcols(y)$keep,]
# set.seed(1)
y <- fishpond::swish(y, x = "condition")
##############################
DET_results <- S4Vectors::mcols(y) %>%
base::as.data.frame() %>%
tibble::rownames_to_column("transcript_id") %>%
tibble::as_tibble()
#####
test <- left_join(DET_results, txtogenesv37, by = "transcript_id")
Xie_lung_swish<- test %>% dplyr::select(1,8,9,11,15,16,18)
write.csv(Xie_lung_swish, "Xie_lung_swish.csv")