comparison compare_gff.R @ 11:5366d5ea04bc draft

planemo upload commit 9d1b19f98d8b7f0a0d1baf2da63a373d155626f8-dirty
author petr-novak
date Fri, 04 Aug 2023 12:35:32 +0000
parents b53f5a456d01
children
comparison
equal deleted inserted replaced
10:276efc4cb17f 11:5366d5ea04bc
68 g1 <- import("test_data/RM_LTR_TE.gff3") 68 g1 <- import("test_data/RM_LTR_TE.gff3")
69 g2 <- import("test_data/RM_RE.gff3") 69 g2 <- import("test_data/RM_RE.gff3")
70 g2 <- import("test_data/RM_RE_CL.gff3") 70 g2 <- import("test_data/RM_RE_CL.gff3")
71 g2 <- import("test_data/RM_RE_v3.gff3") 71 g2 <- import("test_data/RM_RE_v3.gff3")
72 g2 <- import("test_data/RM_RE_v4.gff3") 72 g2 <- import("test_data/RM_RE_v4.gff3")
73 g1 <- import("test_data/RM_RE_v4.gff3")
73 74
74 attribute_name <- "Name" 75 attribute_name <- "Name"
75 } 76 }
76 77
77 g1$SOURCE <- 1 78 g1$SOURCE <- 1
94 n2 <- cbind("No Annotation", sapply(annot_name[c2], "[", 1)) 95 n2 <- cbind("No Annotation", sapply(annot_name[c2], "[", 1))
95 96
96 n12 <- do.call(rbind, annot_name[c12]) 97 n12 <- do.call(rbind, annot_name[c12])
97 98
98 n12all <- matrix(character(), ncol = 2, nrow = length(g12_disjoin)) 99 n12all <- matrix(character(), ncol = 2, nrow = length(g12_disjoin))
99 n12all[c1,] <- n1 100
100 n12all[c2,] <- n2 101 if (any(c1)){
101 n12all[c12,] <- n12 102 n12all[c1,] <- n1
103 }
104 if (any(c2)){
105 n12all[c2,] <- n2
106 }
107 if (any(c12)){
108 n12all[c12,] <- n12
109 }
102 110
103 traw <- wtable(n12all[,1], n12all[,2], weights = width(g12_disjoin)) 111 traw <- wtable(n12all[,1], n12all[,2], weights = width(g12_disjoin))
104 tbl_df <- as.data.frame((traw)) 112 tbl_df <- as.data.frame((traw))
105 tbl_df <- tbl_df[order(tbl_df$Freq, decreasing = TRUE),] 113 tbl_df <- tbl_df[order(tbl_df$Freq, decreasing = TRUE),]
106 colnames(tbl_df) <- c("Annotation1", "Annotation2", "Overlap[bp]") 114 colnames(tbl_df) <- c("Annotation1", "Annotation2", "Overlap[bp]")