i want to create a circlize circos plot with R or Python

134 views Asked by At

I have a CSV file with two columns: one for the names of proteins and another for the concentrations of these proteins. Some proteins share the same concentrations. I would like to create a Circos plot using R or Python to visualize the connections between proteins that share the same concentration.

P.S.: I have attempted several codes, but I keep encountering errors.

1

There are 1 answers

0
Maximilian Press On

As suggested in my comment, I think you are overcomplicating this.

If you need this visualization as stated and your data are as you say, try a network instead:

library(igraph)

# substitute your data
example = data.frame(cbind(
  c("P53", "cycB", "AuroraB", "CDK1", "MCM8"),
  c(1, 1, 3, 2, 2))
)
g = graph_from_data_frame(example)
plot(g)

this makes a plot, which is somewhat ugly but can be readily prettied up using igraph plotting stuff:

enter image description here

You can do something very similar in python. I haven't run this, but it should more or less work:

import igraph
import pandas as pd

example = pd.DataFrame(
  [["P53", "cycB", "AuroraB", "CDK1", "MCM8"],
  [1, 1, 3, 2, 2]]
)
g = igraph.Graph.DataFrame(edges, directed=False)
igraph.plot(g)