lvulliard / BioCircos.R

Htmlwidgets binding R commands to the BioCircos.js library
GNU General Public License v2.0
37 stars 9 forks source link

Biocircos Link track automation using loop #28

Open khush876 opened 1 year ago

khush876 commented 1 year ago

I would like to automate BioCircos plot in R and here is my code. However, I am not able to link the tracks when I am using the full file.

Input file

All_C1.txt

query pos1 sub pos2 AUSP_1 15147 AUSA_1 93903 AUSP_3 15147 AUSA_2 93903 AUSP_9 15204 AUSA_4 93960 AUSP_2 15242 AUSA_3 93998 AUSP_3 15264 AUSA_5 94021 AUSP_4 15287 AUSA_6 94044 AUSP_5 15309 AUSA_7 94066 AUSP_6 15313 AUSA_8 94070 AUSP_7 15319 AUSA_9 94076 AUSP_8 15320 AUSA_1 94077

library(BioCircos) setwd("/PATH/TO/FILE") data <- read.table("All_C1.txt")
head(data)

myGenomeAus0 = list("AUSP_1" = 31248581, "AUSP_2" = 31645086, "AUSP_3" = 47108296, "AUSP_4" = 29969644, "AUSP_5" = 36443716, "AUSP_6" = 26560673, "AUSP_7" = 28486927, "AUSP_8" = 29326496, "AUSP_9" = 29774650, "AUSA_1" = 31122193, "AUSA_2" = 32101233, "AUSA_3" = 46783639, "AUSA_4" = 29229108, "AUSA_5" = 36358360, "AUSA_6" = 26077416, "AUSA_7" = 27897604, "AUSA_8" = 29233132, "AUSA_9" = 30348868)

links_chromosomes_1 <- c(data) V1 <- links_chromosomes_1[1] V1

links_pos_1 <- c(data) V2 <- links_pos_1[2] V2

links_chromosomes_2 <- c(data) V3 <- links_chromosomes_2[3] V3

links_pos_2 <- c(data) V4 <- links_pos_2[4] V4

for (i in data$V1[2]){ print (i) for (j in data$V2[2]){ print (j) for (k in data$V3[2]){ print (k) for (l in data$V4[2]){ print (l)

tracklist = BioCircosLinkTrack('myLinkTrack', i, j, j, k, l, l, genome = myGenomeAus0, maxRadius = 1, color = "black", width = "1.0em", displayAxis = TRUE, axisColor = "black", axisWidth = 0.5, axisPadding = 0, displayLabel = TRUE, labelColor = "black", labelSize = "1em") } } }
}

BioCircos(tracklist, genome = myGenomeAus0, genomeFillColor = c("Spectral"), chrPad = 0.05, displayGenomeBorder = FALSE, genomeTicksDisplay = FALSE, genomeLabelTextSize = "20pt", genomeLabelDy = 0)

Thanks