example_data/with_annotation_in_count_table/example.R

library(CircTest)

Circ <- read.delim('Circ.csv', header = T, as.is = T)
Linear <- read.delim('Linear.csv', header = T, as.is = T)

Circ
#     Chr Start   End   Gene Control_1 Control_2 Control_3 Treatment_1 Treatment_2 Treatment_3
# 1  chr1   100   800 Gene_A         0         2         1           5           4           0
# 2  chr1  1050 10080 Gene_B        20        22        21          10          13           0
# 3  chr2   600  1000 Gene_C         0         1         0          10           0           1
# 4 chr10  4100  5400 Gene_D        55        54        52          56          53          50
# 5 chr11   600  1500 Gene_E         3         0         1           2           2           3

Linear
#     Chr Start   End   Gene Control_1 Control_2 Control_3 Treatment_1 Treatment_2 Treatment_3
# 1  chr1   100   800 Gene_A        10        11        12           9          10          10
# 2  chr1  1050 10080 Gene_B        80        81        83          45          48          46
# 3  chr2   600  1000 Gene_C         5         5         2          12           8           7
# 4 chr10  4100  5400 Gene_D       101       110       106         150         160         153
# 5 chr11   600  1500 Gene_E        20        21        18          19          20          20



Circ_filtered <- Circ.filter(circ = Circ, linear = Linear, Nreplicates = 3, filter.sample = 3, filter.count = 5, percentage = 0.1, circle_description = c(1:4))
Linear_filtered <- Linear[rownames(Circ_filtered),]


Circ_filtered
#     Chr Start   End   Gene Control_1 Control_2 Control_3 Treatment_1 Treatment_2 Treatment_3
# 2  chr1  1050 10080 Gene_B        20        22        21          10          13           0
# 4 chr10  4100  5400 Gene_D        55        54        52          56          53          50

Linear_filtered
#     Chr Start   End   Gene Control_1 Control_2 Control_3 Treatment_1 Treatment_2 Treatment_3
# 2  chr1  1050 10080 Gene_B        80        81        83          45          48          46
# 4 chr10  4100  5400 Gene_D       101       110       106         150         160         153


test <- Circ.test(Circ_filtered, Linear_filtered, group=c(rep(1,3),rep(2,3)), circle_description = c(1:4))
# $summary_table
#     Chr Start  End   Gene      sig_p
# 4 chr10  4100 5400 Gene_D 0.01747407
# 
# $sig.dat
#     Chr Start  End   Gene Control_1 Control_2 Control_3 Treatment_1 Treatment_2 Treatment_3
# 4 chr10  4100 5400 Gene_D        55        54        52          56          53          50
# 
# $p.val
# [1] 0.153464107 0.008737037
# 
# $p.adj
# [1] 0.15346411 0.01747407
# 
# $sig_p
# [1] 0.01747407

pdf('example_pictures.pdf')
for (i in rownames(test$summary_table))  { 
  Circ.ratioplot(Circ_filtered, Linear_filtered, plotrow=i, groupindicator1=c(rep('Control',3),rep('Treatment',3)), 
		 lab_legend='Condition', circle_description = c(1:4) )
}

for (i in rownames(test$summary_table))  {
  Circ.lineplot(Circ_filtered, Linear_filtered, plotrow=i, groupindicator1=c(rep('Control',3),rep('Treatment',3)),
		circle_description = c(1:4) )
 }
dev.off()
dieterich-lab/CircTest documentation built on May 15, 2019, 8:29 a.m.