Skip to content

Instantly share code, notes, and snippets.

@cwhelan
Created November 1, 2019 16:15
Show Gist options
  • Save cwhelan/38db55962701fc35a32bd2a6297570bd to your computer and use it in GitHub Desktop.
Save cwhelan/38db55962701fc35a32bd2a6297570bd to your computer and use it in GitHub Desktop.
phaseSets <- read.table("phase_sets.dat", header=T)
switches <- read.table("compare.err_pos.more") // this file is created by the phasing evaluation scripts
names(switches) <- c("POS", "TYPE")
phaseSets$MID <- (phaseSets$START + phaseSets$END) / 2
phaseSets$COLOR <- factor(seq(1,dim(phaseSets)[1]) %% 4)
phaseSets$LABEL <- ifelse(phaseSets$NUM_SITES > 500, phaseSets$NUM_SITES, NA)
ggplot(phaseSets) +
  geom_segment(aes(y=1, yend=1, x=START, xend=END, color=COLOR), size=4) +
  geom_text(aes(x = MID, y=1, label=LABEL, color=COLOR), angle=45, size=2.5, nudge_y = 0.015) +
  geom_segment(data=switches[switches$TYPE == "SWITCH_ERROR_LONG",], aes(y=.975, yend=.99, x=POS, xend=POS), color="black", arrow = arrow(length = unit(0.01, "npc")), size=1) +
  geom_segment(data=switches[switches$TYPE == "SWITCH_ERROR_POINT",], aes(y=.975, yend=.99, x=POS, xend=POS), color="red", arrow = arrow(length = unit(0.01, "npc")), size=1) +
  theme_bw() +
  theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank()) +
  theme(legend.position="none") +
  theme(axis.title = element_blank()) +
  scale_y_continuous(breaks = c(1.0), labels=c("10x Phasing Only"), limits = c(.5,1.1))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment