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

Functions to plot copy number segments #15

Open
lbeltrame opened this issue Dec 18, 2019 · 5 comments
Open

Functions to plot copy number segments #15

lbeltrame opened this issue Dec 18, 2019 · 5 comments
Assignees
Labels
enhancement New feature or request Usage Question Question about how to use the package, not a bug or feature request

Comments

@lbeltrame
Copy link

Currently you can plot either calls, or raw log2ratios. You can't, however, plot segments on top of the log2ratio raw data with the currently available functions.

@bernatgel
Copy link
Owner

CopyNumberPlots is based on karyoploteR and it inherits it's flexibility, so I'm convinced it would be possible to plot pretty much anything you'd need :) Can you post an example of what you're trying to accomplish? or a hand drawing or similar? I can try to help you with that

@bernatgel bernatgel self-assigned this Dec 18, 2019
@bernatgel bernatgel added the Usage Question Question about how to use the package, not a bug or feature request label Dec 18, 2019
@lbeltrame
Copy link
Author

lbeltrame commented Dec 18, 2019

I made a PoC by "tricking" the existing functions:

segment_bins = loadSNPData("bins.seg", chr.col="chr", start.col="start", end.col="end", lrr.col="logR", genome="hg38")

segment_cn = loadCopyNumberCallsSeg("calls.seg", chr.col="chr", start.col="start", end.col="end", segment.value.col="median", genome="hg38")

kp = plotKaryotype(plot.type=5, genome="hg38", chromosomes=c(paste0("chr", 1:22), "chrX"), cex=0.7)
plotLRR(kp, snps=segment_bins ymin=-2, ymax=2, labels="log2ratio", points.cex=0.4)
# Notice how I used the cn.column parameter below
plotCopyNumberCallsAsLines(kp, cn.calls=segment_cn style="segments", r=0, r1=1, cn.column="segment.value", ymin=-2, ymax=2, col="#fd0002", add.axis=F, labels=NA,lwd=4)

Which gives, with my data:

Screenshot_20191218_123421

@bernatgel
Copy link
Owner

Hi @lbeltrame

I was going to suggest you to dom just what you did! So it's possible to create the plot with CopyNumberPlots. How else you'd have expected the system to work? A different function for the segments? (you can use directly karyoploteR::kpSegments so it'd feel less as tricking the functions)

@lbeltrame
Copy link
Author

I actually had issues with kpSegments as it had issues in plotting with the same scale (but I guess I just messed up the paramters).

If you think this is the way to go, perhaps a mention in the documentation would suffice: these types of plots are quite used to see if segmentation is fine (and also for comparison purposes since karyotypeR is very flexible in this regard).

@bernatgel
Copy link
Owner

Ok! It might make sense to create a specific function for that. It could even compute the median
of each segment from the LRR values and the segmentation if needed.

If you keep having issues with kpSegments just ask :)

@bernatgel bernatgel added the enhancement New feature or request label Dec 18, 2019
@bernatgel bernatgel reopened this Dec 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Usage Question Question about how to use the package, not a bug or feature request
Projects
None yet
Development

No branches or pull requests

2 participants