circular genome visualisation: genomic.labels: Error in if (cr != chr) { : missing value where TRUE/FALSE needed
0
0
Entering edit mode
@chrisclarkson100-11114
Last seen 2.6 years ago
United Kingdom

I am finding your circlize package really useful. However, I am trying to label certain parts of the genome in my circular diagram with the function "genomic.labels" and getting the highlighted error below:

library(circlize)

  circos.initializeWithIdeogram(chromosome.index = paste0("chr", c(1:22,'X')))

  circos.genomicDensity(data_from_bed1, col = c("#FF000080"), track.height = 0.1)

  circos.genomicDensity(data_from_bed2, col = c("#B0E0E6"), track.height = 0.1)

  circos.genomicLabels(differential_labels, labels.column=5, side = "inside",

        cex=1.8,col = 'black', line_col='black')

    Error in if (cr != chr) { : missing value where TRUE/FALSE needed

 

The data from the differential_labels variable is just a normal bed file format. e.g.

 

1    chr1     10011     10526 277          chr1_10011_10526

2    chr1  31904591  31905068 497    chr1_31904591_31905068

3    chr1 108113082 108113613 259  chr1_108113082_108113613

4    chr1 143366525 143366833 219  chr1_143366525_143366833

5    chr1 149032152 149036235 214  chr1_149032152_149036235

6    chr1 235680770 235681860 205  chr1_235680770_235681860

7    chr1 236260392 236260727 230  chr1_236260392_236260727

8    chr1 240347680 240348538 254  chr1_240347680_240348538

9    chr1 248571411 248572287 310  chr1_248571411_248572287

10  chr10  42354937  42385067 528   chr10_42354937_42385067

 

When I try this with code (using an example for from the package vignette (Chapter 11 figure 11.3)) using data from a randomly generated bed file it works fine....

circos.initializeWithIdeogram()

bed = generateRandomBed(nr = 50, fun = function(k) sample(letters, k, replace = TRUE))
bed[1, 4] = "aaaaa"
circos.genomicLabels(bed, labels.column = 4, side = "inside")
circos.clear()

Can anyone help me out?

genomicfeatures rcircos • 1.6k views
ADD COMMENT
0
Entering edit mode

Dear Chris,

Hope you are well. I am facing the same problem. Did you resolve this? If so, could you please help me?

Cheers Naveen

ADD REPLY
0
Entering edit mode

Hi Naveen, Sorry I'm so late to reply- I haven't been logged into this site for ages... I went through my notes on this project and I think that I just gave up on trying to fit 2 genomic density profiles and labels all in one plot... Instead I just went for one genomic density profile and labels on the inner ring and this seemed to fit.

Also their may have been a problem with the ordering/ sorting of the bed file used to input the label locations...

I had to sort it as follows:

head(bedfile_labels)
chr10    2000    3000    green
chr10    4000    5000    red

ord=data.frame()
for(i in c(1:22,c('X'))){
  tmp=bedfile_labels[gsub('chr','',genes$V1)==i,]
  ord=rbind(ord,tmp[order(tmp$V2),])
}

.....
circos.genomicLabels(bedfile_labels, labels.column = 4, side = "inside", cex=1.8,
                     col = ord$color,line_col = ord$color)

I'm sorry about the lateness.... I hope this helps- but it was so long ago that I wrote the code that it might not be helpful

ADD REPLY

Login before adding your answer.

Traffic: 816 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6