jokergoo / circlize

Circular visualization in R
http://jokergoo.github.io/circlize_book/book/
Other
959 stars 141 forks source link

issue with the FUN circos.genomicLabels #347

Closed edoardobertolini closed 1 year ago

edoardobertolini commented 1 year ago

Hi, I'm using circlize v0.4.15.

I would like to add gene labels to the links but the function circos.genomicLabels() returns this error:

Error in if (any(df[, start_column] < chr_start[all_chr])) { : 
  missing value where TRUE/FALSE needed

This is my code:

pdf("circos_plot.pdf")
circos.genomicInitialize(genome, axis.labels.cex= 0.3, labels.cex=1, track.height=0.5)
#set up the colors
circos.track(ylim = c(0, 1), 
             bg.col = c("#9d867c", "#718c97", "#9d867c", "#718c97", "#9d867c", "#718c97", "#9d867c", "#718c97", "#9d867c", "#718c97"), 
             bg.border = NA, track.height = 0.05)

#create links
gene_X = data.frame(chr= rep(1, 24), 
                     start = rep(286729805, 24),
                     end = rep(286729805, 24))
gene_X_target = read.delim("gene_X_targets.txt", header=T, stringsAsFactors = F)
str(gene_X_target)
circos.genomicLink(gene_X, gene_X_target, col = "#7c768e", border = NA)
circos.genomicLabels(gene_X_target, labels.column = 4, side = "outside")
dev.off()

image

> str(gene_X_target)
'data.frame':   24 obs. of  4 variables:
 $ Chr  : int  8 8 8 8 5 5 5 7 7 7 ...
 $ Start: int  104781826 127166051 162564171 179759260 12228881 81993089 94166360 3332835 3851787 149911751 ...
 $ End  : int  104781826 127166051 162564171 179759260 12228881 81993089 94166360 3332835 3851787 149911751 ...
 $ gene : chr  "nactf38" "hox1" "lrp1" "hb9" ...

Any suggestions? Thanks

Edo

Myrtle-bio commented 4 months ago

Hi,I met the same question , how did you solve this ? Looking forward to your reply!