ponnhide / pyCircos

python Circos
GNU General Public License v3.0
340 stars 66 forks source link

Chord_plot coordinates #11

Closed jaygut closed 2 years ago

jaygut commented 2 years ago

Hi,

Pretty handy tool you have developed here. It is a good alternative to R circos plot tools.

I have a question: in the chord_plot function, the edge_position1 and edge_position2 are the x coordinates on the Garc class object, but where can I get those from? I've been inspecting the object but I can't seem to get those. I noticed in you tutorials that you have an input file with those edge_position1 and edge_position2 data points, but where did you get those from?

Thanks for your feedback

ponnhide commented 2 years ago

@jaygut Thank you for using pyCircos. Maybe, the descriptions in README are not proper and induce misunderstanding to you. "x coordinates on the Garc class" means "genomic coordinates on Garc class," so you can specify genomic positions for edge_position1 and edge_position2.
In fact, the input file used In my tutorial1 is just a description of the mock chromosomal positions.

If you have any questions, please let me know.

jaygut commented 2 years ago

Thanks @ponnhide for the prompt feedback, but perhaps I should have explained in more detail the idea I have with your code: my problem is that I don't deal with genomic sequences (no Bio.seq objects neither their coordinates) but with metagenomic samples, which I'm trying to plot them on the circos plot as arcs. Then, I was just inspecting each Garc object created and added to a Gcircle object, and tried to fetch the coordinates assigned internally as follows:

And based on these values I was then trying to create the object:

But then noticed that chords plot is not rendered as expected, in particular the links between arcs are not placed according to the boundaries for each arc.

Can you get now what I'm trying to do? Is there a way to do this without creating a Bio.seq object for each of the samples I want to map on the circos plot?

Cheers

ponnhide commented 2 years ago

@jaygut Probably, I can understand your situation. Then, I'm sorry that my non-proper implementation induces your misunderstanding...

In the current implementation, Garc_object.coordinates means not the coordinates on the Garc object but the coordinates of the Garc object on the parental Gcircle object.

On the other hands, when you make Garc object, I think you set ‘size’ parameter value. So, each Garc class object had its own coordinates within the range 0 to the size value.

Sorry for the confusing explanation. If you have any questions, please let me know.

jaygut commented 2 years ago

Great, it worked like a charm! Now I can easily place the chords right in the middle of each garc object.

Thanks for the feedback,

Cheers,

Jay

gmhhope commented 1 year ago

@jaygut @ponnhide Could any of you help make the solution more explicit? I am also trying to make chord plot on non-genomic circos plot and I also observed the displacement of the chords for the cytoband. I hope any of you can help! Thanks!

Screen Shot 2022-11-27 at 11 03 31 AM

Specifically, how you retrieve the 'source' & 'destinat' values in the examples if I don't have the genomic positions? In the current simplified example, I just create a dummy position for each cytoband and then I assumed that I can use the same start and end position to map the chord plot. But it doesn't seem to work?

gmhhope commented 1 year ago

Maybe I understand now. I will come back if I have further questions!