Closed moldach closed 3 years ago
Okay I've figure out that these are just "named vectors" so I was able to create my own.
However, I'm having trouble understanding how to use the circos.link()
function properly.
cytoband = list(
df = data.frame(
V1 = c("I", "II", "III", "IV", "V", "X"),
V2 = c(0, 0, 0, 0, 0, 0),
V3 = c(15072434, 15279421, 13783801, 17493829, 20924180, 17718942),
V4 = c("I", "II", "III", "IV", "V", "X"),
V5 = c("I", "II", "III", "IV", "V", "X")
),
chromosome = c("I", "II", "III", "IV", "V", "X"),
chr.len=c(I=15072434, II=15279421, III=13783801, IV=17493829, V=20924180, X=17718942)
)
cytoband_df = cytoband$df
chromosome = cytoband$chromosome
xrange = c(cytoband$chr.len, cytoband$chr.len[c("I", "IV")])
normal_chr_index = 1:6
zoomed_chr_index = c(1,4)
# normalize in normal chromsomes and zoomed chromosomes separately
sector.width = c(xrange[normal_chr_index] / sum(xrange[normal_chr_index]),
xrange[zoomed_chr_index] / sum(xrange[zoomed_chr_index]))
circos.par(start.degree = 90)
circos.initializeWithIdeogram(extend_chromosomes(cytoband_df, c("I", "IV")), sector.width = sector.width)
circos.track(ylim = c(0, 2),
bg.col = c("#ACCCDD", # pale yellow
"#5896AD", # olive yellow
"#005C91",
"#003C69",
"#00254A",
"#96AAB5",
"#ACCCDD",
"#003C69"),
bg.border = NA, track.height = 0.05)
In your example you have used the following:
circos.link("chr1", get.cell.meta.data("cell.xlim", sector.index = "chr1"),
"zoom_chr1", get.cell.meta.data("cell.xlim", sector.index = "zoom_chr1"),
col = "#00000020", border = NA)
circos.clear()
Where the get.cell.meta.data()
function returns 0.249250621
so I tried the following:
circos.link("Zoom_I", 0.249250621,
"Zoom_IV", 0.249250621,
col = "#00000020", border = NA)
circos.clear()
But I got the error:
Error in array(x, c(length(x), 1L), if (!is.null(names(x))) list(names(x), : 'data' must be of a vector type, was 'NULL'
Ultimately, however, I'd like to be able to use information from the circos.genomicLink
function. As I had been using this successfully before however the region we are interested in was showing up as too-fine-of-a-line before.
suppressPackageStartupMessages(require(StructuralVariantAnnotation))
suppressPackageStartupMessages(require(VariantAnnotation))
suppressPackageStartupMessages(require(circlize))
vcf <- VariantAnnotation::readVcf("data/BC986_subset.vcf", "ce11")
gr <- breakpointRanges(vcf)
gr <- partner(gr)
seqlevelsStyle(gr) <- "UCSC"
pairs <- breakpointgr2pairs(gr)
df = data.frame(
name = c("I", "II", "III", "IV", "V", "X"),
start = c(0, 0, 0, 0, 0, 0),
end = c(15072434, 15279421, 13783801, 17493829, 20924180, 17718942))
circos.initializeWithIdeogram(species = "ce11")
circos.track(ylim = c(0, 1),
bg.col = c("#ACCCDD", # pale yellow
"#5896AD", # olive yellow
"#005C91",
"#003C69",
"#00254A",
"#96AAB5"),
bg.border = NA, track.height = 0.05)
circos.genomicLink(as.data.frame(S4Vectors::first(pairs)), as.data.frame(S4Vectors::second(pairs)), col = "#5F4B8BFF")
How can I use circos.genomicLink()
with this?
I would like to have it shown like this if possible.
The zoomed out arc is seen as a fine-line and the zoomed in portion would look larger (like a ribbon)
Your help is greatly appreciated
It supports more genomes as long as it is avaiable on UCSC database, e.g. rn6
(rat genome?, I cannot remember correctly). To let circos.initializeWithIdeogram()
to be more flexible, if the genome has no cytoband data, circos.initializeWithIdeogram()
actually still works but without drawing the ideogram track.
More generally, if the genome does not exist on UCSC database, you can still provide a data frame which are the ranges of chromosomes of that genome and send it to circos.genomeInitialize()
.
Check the following code:
df = data.frame(
chr = c("I", "II", "III", "IV", "V", "X", "zoom_I", "zoom_IV"),
start = c(0, 0, 0, 0, 0, 0, 0, 0),
end = c(15072434, 15279421, 13783801, 17493829, 20924180, 17718942, 15072434, 17493829)
)
# normalize in normal chromsomes and zoomed chromosomes separately
sector.width = c(df$end[1:6] / sum(df$end[1:6]) * 0.2,
df$end[7:8] / sum(df$end[7:8]))
circos.par(start.degree = 90, gap.after = c(1, 1, 1, 1, 1, 5, 1, 5))
circos.genomicInitialize(df, sector.width = sector.width)
circos.track(ylim = c(0, 2),
bg.col = c("#ACCCDD", # pale yellow
"#5896AD", # olive yellow
"#005C91",
"#003C69",
"#00254A",
"#96AAB5",
"#ACCCDD",
"#003C69"),
bg.border = NA, track.height = 0.05)
circos.link("I", c(5e6, 5e6 + 2e5), "IV", c(5e6, 5e6 + 2e5), col = "#5F4B8BFF")
circos.link("zoom_I", c(5e6, 5e6 + 2e5), "zoom_IV", c(5e6, 5e6 + 2e5), col = "#5F4B8BFF")
circos.clear()
And by the way, your genome is c.elegans, right? The genome code for c.elegans is ce11
and you can directly use it in circos.initializeWithIdeogram()
:
circos.initializeWithIdeogram(species = "ce11")
Hi @jokergoo thanks for the prompt response! Your manual is absolutely phenomenal and this is the first time I've had to ask a question.
Based on the code you've provided it's also clear I can then zoom in further to the chromosome if the event is smaller than the 200kb
event you simulated above. Awesome!
Thanks again!
In Chapter 9.4 a method for zooming in on Chromosomes is shown.
However, this method relies on
cytoband
information; which is only available forhg19
andmm10
withcirclize
The function
read.cytoband
returns an object that looks like:How is the
$chr.len
column generated such that it has two values?I'd like to make my own dummy
cytoband
so be able to zoom in