Comments (9)
Code Example
from pycirclize import Circos
from pycirclize.utils import calc_group_spaces
import pandas as pd
import math
col_names = ["J2", "J3", "J4", "J6", "J7"]
row_names = ["V3-1", "V3-2", "V3-3", "V3S1", "V3S25", "V3S28", "V3S31", "V3S32", "V3S33", "V3S39", "V3S41", "V3S53", "V3S58", "V3S60", "V3S61", "V3S63", "V3S65", "V3S66"]
matrix_data = [
[0,0,1,0,0],
[0,0,0,2,0],
[0,0,249,13,3],
[1,0,0,1,0],
[0,0,0,0,1],
[0,0,1,0,0],
[0,0,1,0,0],
[0,0,1,0,0],
[0,0,1,0,0],
[0,0,2,0,0],
[0,1,5,2,1],
[1,0,44,9,2],
[0,0,1,0,0],
[0,0,1,1,0],
[0,0,28,7,7],
[0,0,1,0,0],
[1,0,51,6,40],
[1,0,9,3,2],
]
matrix_df = pd.DataFrame(matrix_data, index=row_names, columns=col_names)
# Calculate group spaces to separate V & J groups
groups = [len(row_names), len(col_names)]
spaces = calc_group_spaces(groups, space_bw_group=20, space_in_group=3)
circos = Circos.initialize_from_matrix(
matrix_df,
start=-90,
end=270,
space=spaces,
endspace= True,
r_lim=(93, 100),
# Set dict cmap
cmap={"V3-3": "red", "V3S41": "blue", "V3S53": "lime", "V3S61": "orange", "V3S65": "purple", "V3S66": "pink"},
ticks_interval=20,
# Set orientation of labels
label_kws=dict(r=110, size=8, color="black", orientation="vertical"),
)
# Set fontweight="bold"
circos.text("Top 500 sequences of VHH TfR 0R \n VJ region link map", r=100 * math.sqrt(2), deg=315, size=10, fontweight="bold")
circos.savefig("example.png")
example.png
from pycirclize.
Please provide the code and input files to run the plots in this figure. Without knowing what code you are writing, it is impossible to give an adequate answer.
from pycirclize.
Dear Moshi4 and team
I am sorry for the trouble
Here is my code:
from pycirclize import Circos
import pandas as pd
import math
col_names = ["J2", "J3", "J4", "J6", "J7"]
row_names = ["V3-1", "V3-2", "V3-3", "V3S1", "V3S25", "V3S28", "V3S31", "V3S32", "V3S33", "V3S39", "V3S41", "V3S53", "V3S58", "V3S60", "V3S61", "V3S63", "V3S65", "V3S66"]
matrix_data = [
[0,0,1,0,0],
[0,0,0,2,0],
[0,0,249,13,3],
[1,0,0,1,0],
[0,0,0,0,1],
[0,0,1,0,0],
[0,0,1,0,0],
[0,0,1,0,0],
[0,0,1,0,0],
[0,0,2,0,0],
[0,1,5,2,1],
[1,0,44,9,2],
[0,0,1,0,0],
[0,0,1,1,0],
[0,0,28,7,7],
[0,0,1,0,0],
[1,0,51,6,40],
[1,0,9,3,2],
]
matrix_df = pd.DataFrame(matrix_data, index=row_names, columns=col_names)
circos = Circos.initialize_from_matrix(
matrix_df,
start=-90,
end=240,
space=3,
endspace= True,
r_lim=(93, 100),
cmap="viridis",
ticks_interval=20,
label_kws=dict(r=110, size=8, color="black"),
)
circos.text("Top 500 sequences of VHH TfR 0R \n VJ region link map", r=100 * math.sqrt(2), deg=315, size =10)
print(matrix_df)`
from pycirclize.
Thank you so much mr. Moshi04.
It is so helpful for me. I would like to ask about matrix data from the import file.
If I have this matrix file in csv, what code do we need to insert this csv file to the previous code?
0R Matrix.csv.
and another question about grouping.
According to your code:
groups = [len(row_names), len(col_names)]
When I learned from your lesson code of "plot_tips.ipynb", you used this code
group1, group2, group3 = list("ABCD"), list("EFG"), list("HIJ")
with "list" on it. So, what is the difference?
Once again, thank you in advance and I am sorry for the trouble.
from pycirclize.
Code Example
from pycirclize import Circos
from pycirclize.utils import calc_group_spaces
import pandas as pd
import math
# Read matrix csv
matrix_df = pd.read_csv("0R.Matrix.csv", index_col=0)
# Calculate group spaces to separate V & J groups
groups = [len(matrix_df.index), len(matrix_df.columns)]
spaces = calc_group_spaces(groups, space_bw_group=20, space_in_group=3)
circos = Circos.initialize_from_matrix(
matrix_df,
start=-90,
end=270,
space=spaces,
endspace= True,
r_lim=(93, 100),
# Set dict cmap
cmap={"V3-3": "red", "V3S41": "blue", "V3S53": "lime", "V3S61": "orange", "V3S65": "purple", "V3S66": "pink"},
ticks_interval=20,
# Set orientation of labels
label_kws=dict(r=110, size=8, color="black", orientation="vertical"),
)
# Set fontweight="bold"
circos.text("Top 500 sequences of VHH TfR 0R \n VJ region link map", r=100 * math.sqrt(2), deg=315, size=10, fontweight="bold")
circos.savefig("example.png")
The other question about groups is difficult to answer because I don't understand what is being asked.It seems to me that this is due to a lack of understanding of Python syntax, so please interpret the purpose of the code yourself.
from pycirclize.
Thank you so much for your comment. I completely understand.
Best regards.
from pycirclize.
Dear Mr. Moshi04.
I sincerely apologize for reopening the issue.
I have another question. I am trying to separate into three groups: V3, V3S, and J groups
and I tried to use this code:
from pycirclize import Circos
from pycirclize.utils import calc_group_spaces
import pandas as pd
import math
col_names = ["J2", "J3", "J4", "J6", "J7"]
row_names = ["V3-1", "V3-2", "V3-3", "V3S1", "V3S25", "V3S28", "V3S31", "V3S32", "V3S33", "V3S39", "V3S41", "V3S53", "V3S58", "V3S60", "V3S61", "V3S63", "V3S65", "V3S66"]
matrix_data = [
[0,0,1,0,0],
[0,0,0,2,0],
[0,0,249,13,3],
[1,0,0,1,0],
[0,0,0,0,1],
[0,0,1,0,0],
[0,0,1,0,0],
[0,0,1,0,0],
[0,0,1,0,0],
[0,0,2,0,0],
[0,1,5,2,1],
[1,0,44,9,2],
[0,0,1,0,0],
[0,0,1,1,0],
[0,0,28,7,7],
[0,0,1,0,0],
[1,0,51,6,40],
[1,0,9,3,2],
]
matrix_df = pd.DataFrame(matrix_data, index=row_names, columns=col_names)
print(matrix_df)
# Calculate group spaces to separate V3, V3S & J groups
groups = [len(row_names[0:2]), len(row_names[3:17]), len(col_names)]
spaces = calc_group_spaces(groups, space_bw_group=20, space_in_group=3)
circos = Circos.initialize_from_matrix(
matrix_df,
start=-90,
end=270,
space=spaces,
endspace= True,
r_lim=(93, 100),
# Set dict cmap
cmap={"V3-1": "red", "V3S41": "blue", "V3S53": "lime", "V3S61": "orange", "V3S65": "purple", "V3S66": "pink"},
ticks_interval=20,
# Set orientation of labels
label_kws=dict(r=110, size=8, color="black", orientation="vertical"),
link_kws=dict(hatch="//", direction=1, color="blue", alpha=0.4, lw=1),
ticks_kws=dict(outer=True, major_interval=10, label_size=10, color="black", label_orientation="vertical", show_label=True)
)
# Set fontweight="bold"
circos.text("Top 500 sequences of VHH TfR 0R \n VJ region link map", r=100 * math.sqrt(2), deg=315, size=10, fontweight="bold")
But I got an error code. Would you mind suggesting the example code?
and, I am also trying ticks_kws code, but when I tried to modify ticks_kws, hoping I could show major and minor interval. However, the ticks were not shown. Could you show me the way to use it.
from pycirclize.
I feel that many of the questions are due to a lack of basic understanding of Python. I don't want to be asked endless basic questions, so I apologize, but this will be my last answer.
Code Example
from pycirclize import Circos
from pycirclize.utils import calc_group_spaces
import pandas as pd
import math
col_names = ["J2", "J3", "J4", "J6", "J7"]
row_names = ["V3-1", "V3-2", "V3-3", "V3S1", "V3S25", "V3S28", "V3S31", "V3S32", "V3S33", "V3S39", "V3S41", "V3S53", "V3S58", "V3S60", "V3S61", "V3S63", "V3S65", "V3S66"]
matrix_data = [
[0,0,1,0,0],
[0,0,0,2,0],
[0,0,249,13,3],
[1,0,0,1,0],
[0,0,0,0,1],
[0,0,1,0,0],
[0,0,1,0,0],
[0,0,1,0,0],
[0,0,1,0,0],
[0,0,2,0,0],
[0,1,5,2,1],
[1,0,44,9,2],
[0,0,1,0,0],
[0,0,1,1,0],
[0,0,28,7,7],
[0,0,1,0,0],
[1,0,51,6,40],
[1,0,9,3,2],
]
matrix_df = pd.DataFrame(matrix_data, index=row_names, columns=col_names)
# Calculate group spaces to separate V3, V3S & J groups
groups = [len(row_names[0:3]), len(row_names[3:18]), len(col_names)]
spaces = calc_group_spaces(groups, space_bw_group=20, space_in_group=3)
circos = Circos.initialize_from_matrix(
matrix_df,
start=-90,
end=270,
space=spaces,
endspace= True,
r_lim=(93, 100),
# Set dict cmap
cmap={"V3-1": "red", "V3S41": "blue", "V3S53": "lime", "V3S61": "orange", "V3S65": "purple", "V3S66": "pink"},
# Set orientation of labels
label_kws=dict(r=110, size=8, color="black", orientation="vertical"),
)
# Plot xticks manually
for sector in circos.sectors:
track = sector.tracks[0]
major_interval, minor_interval = 50, 10
if track.size >= major_interval:
track.xticks_by_interval(major_interval)
track.xticks_by_interval(minor_interval, tick_length=1, show_label=False)
# Set fontweight="bold"
circos.text("Top 500 sequences of VHH TfR 0R \n VJ region link map", r=100 * math.sqrt(2), deg=315, size=10, fontweight="bold")
circos.savefig("example.png")
example.png
from pycirclize.
Dear Mr. Moshi04
Thank you so much for your generous help.
from pycirclize.
Related Issues (20)
- Phylogenetic leaf labels with spaces are truncated HOT 2
- Arrows HOT 2
- Is there a way to plot shapes on tracks? HOT 5
- Issue with ZeroDivisionError in Circos Plot HOT 2
- Is there any way to integrate between heatmap data and tree leaves? HOT 3
- Confused with bar plot HOT 2
- Enable wrapping/bending the text around a circle HOT 1
- Track Heatmap cmap Customization HOT 2
- cannot import name 'SimpleLocation' from 'Bio.SeqFeature' HOT 1
- figuresize HOT 1
- Massive size on save to svg - vectors of sector borders and some other lines have tons of nodes HOT 1
- Doubt regarding pycircilize HOT 3
- How to use vmin argument in `track.line()` method HOT 1
- Question: Linear tree visualization HOT 2
- Highlight different gene functioins with different tick/label colors and jitter labels HOT 1
- Custom color for genomic features HOT 2
- Set different axis scales in the radar chart HOT 5
- how to adjust overlap label by bend line like circlize HOT 1
- Rounding issue in sector.py HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pycirclize.