Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

constitutional guides for X/Y chromosomes #110

Open
drtconway opened this issue Jan 10, 2024 · 0 comments
Open

constitutional guides for X/Y chromosomes #110

drtconway opened this issue Jan 10, 2024 · 0 comments

Comments

@drtconway
Copy link

Thanks for making/improving a useful tool.

We found the guides on the whole genome plots confusing for chrX and chrY. I think the following change results in a plot that is easier to interpret. You may wish to incorporate it:

$ git diff
diff --git a/wisecondorX/include/plotter.R b/wisecondorX/include/plotter.R
index f4ac798..45d5059 100644
--- a/wisecondorX/include/plotter.R
+++ b/wisecondorX/include/plotter.R
@@ -130,9 +130,13 @@ plot(1, main="", axes=F, # plots nothing -- enables segments function
      cex=0, ylim=c(chr.wide.lower.limit,chr.wide.upper.limit))
 
 plot.constitutionals <- function(ploidy, start, end){
-  segments(start, log2(1/ploidy), end, log2(1/ploidy), col=color.B, lwd=2, lty=3)
-  segments(start, log2(2/ploidy), end, log2(2/ploidy), col=color.A, lwd=2, lty=3)
-  segments(start, log2(3/ploidy), end, log2(3/ploidy), col=color.C, lwd=2, lty=3)
+  pm1 <- ploidy - 1
+  pp1 <- ploidy + 1
+  if (pm1 > 0) {
+    segments(start, log2(pm1/ploidy), end, log2(pm1/ploidy), col=color.B, lwd=2, lty=3)
+  }
+  segments(start, log2(ploidy/ploidy), end, log2(ploidy/ploidy), col=color.A, lwd=2, lty=3)
+  segments(start, log2(pp1/ploidy), end, log2(pp1/ploidy), col=color.C, lwd=2, lty=3)
 }
 
 genome.len <- chr.ends[length(chr.ends)]
@@ -203,7 +207,7 @@ par(xpd=F)
 par(xpd=NA)
 legend(x=chr.ends[length(chr.ends)] * 0.3,
        y=chr.wide.upper.limit + (abs(chr.wide.upper.limit) + abs(chr.wide.lower.limit)) * 0.23,
-       legend=c("Constitutional 3n", "Constitutional 2n", "Constitutional 1n"),
+       legend=c("Constitutional n+1", "Constitutional n", "Constitutional n-1"),
        text.col=color.X, cex=1.3, bty="n", lty=c(3,3,3), lwd=1.5, col=color.X)
 legend(x=0,
        y=chr.wide.upper.limit + (abs(chr.wide.upper.limit) + abs(chr.wide.lower.limit)) * 0.23,
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant