MUMmer 结果R可视化

输出coords 文件

展示一条染色体

library(ggplot2)
file <- "C:\\Users\\Admin\\Desktop\\"
nucmer <- read.delim(paste0(file, "nucmer.coords"), 
                  header = F, 
                  sep = "\t",
                  stringsAsFactors = FALSE)

colnames(nucmer) <- c("ref_start", "ref_end", "qry_start", "qry_end", 
                  "ref_len", "qry_len", "identiy", "ref_tag","qry_tag")

chr1_nuc <-  subset(nucmer,  ref_tag == 'chr1' & qry_tag == 'chr1')

ggplot(data = chr1_nuc) +  
  geom_segment(aes(x = ref_start/100000, y = qry_start/100000,
                   xend = ref_end/100000, 
                   yend = qry_end/100000), size = 1)+
  xlab(label = "ref genome") +
  ylab(label = "qry genome") +
  theme_bw()

展示所有染色体

ggplot(data = nucmer) + facet_grid(qry_tag~ref_tag, as.table = FALSE, 
                                switch = "both", scales = "free", 
                                space = "free") + 
  geom_segment(aes(x = ref_start/10000, y = qry_start/10000,
                                     xend = ref_end/10000, 
                   yend = qry_end/10000), size = 1) +
  scale_colour_gradient(low = "black",
                        high = "red") + 
  theme_bw() +
  xlab(label = "ref genome") +
  ylab(label = "qry genome") 

你可能感兴趣的:(MUMmer 结果R可视化)