Last active
September 21, 2021 02:40
-
-
Save Nanguage/9b2b089b8721cc05d669a1230c90282c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(GenomicRanges) | |
| library(ggbio) | |
| pairs.df <- read.table("D:/tmp/ggbio_demo/ZQL-49_final.txt",header=FALSE, sep="\t")[,1:7] | |
| colnames(pairs.df) <- c("read", "chr1", "pos1", "chr2", "pos2", "strand1", "strand2") | |
| chromsize.df <- read.csv("D:/tmp/ggbio_demo/susScr11_ASFV_noun.fa.csv") | |
| chromsize.gr <- GRanges( | |
| seqnames = chromsize.df$seqnames, | |
| ranges = IRanges(start=1, end=chromsize.df$end), | |
| ) | |
| seqlengths(chromsize.gr) <- chromsize.df$width | |
| pairs.gr <- GRanges( | |
| seqnames = pairs.df$chr1, | |
| ranges = IRanges(start=pairs.df$pos1, end=pairs.df$pos1), | |
| seqlengths = seqlengths(chromsize.gr), | |
| to.gr = GRanges( | |
| seqnames=pairs.df$chr2, | |
| ranges=IRanges(start=pairs.df$pos2, end=pairs.df$pos2), | |
| seqlengths = seqlengths(chromsize.gr)), | |
| ) | |
| p <- ggbio() + | |
| circle(chromsize.gr, geom="ideo", fill="gray70") + | |
| circle(chromsize.gr, geom="scale", size=2) + | |
| circle(chromsize.gr, geom="text", aes(label=seqnames), vjust=0, size=3) + | |
| circle(pairs.gr, geom="link", linked.to="to.gr", radius=30, aes(color=seqnames)) | |
| p | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment

GRanges object should specify the
seqlengthsattribute when plot the "link" geom.