I have an Rscript that constructs plots for a number of genes. I have hardcoded the gene name and color assignments in the script itself with the following code:
grid.col = c(gene0059="aquamarine",gene0086="bisque",gene0107="blue",gene1658="brown",
gene0171="brown1",gene0246="burlywood4",gene0404="cadetblue",gene0439="cadetblue1",
gene0518="chartreuse",gene0716="chartreuse4",gene1099="chocolate",gene1525="chocolate4",
gene1527="coral",gene1621="coral4",gene1661="cyan",gene1701="cyan3",gene1907="darkgoldenrod",
gene2223="purple",gene2244="green",gene2552="green4",gene2584="honeydew",
gene2692="hotpink",gene2874="indianred1",gene2884="khaki1",gene2888="red",
gene0016="lightblue1",gene0096="lightgoldenrod3",gene1959="lightpink",gene2271="lightsalmon",
gene2804="lightskyblue",gene2885="magenta",gene3000="blue",gene1689="mediumorchid3",
gene1776="mediumpurple1",gene2628="olivedrab2",gene0963="orange",gene1137="orangered",
gene0621="palegreen1",gene2733="royalblue1",gene2806="seagreen1",gene1702="purple1")
When plotting, I can call the grid.col
for the colors. Specifically I am using this with the chordDiagram
command in the circlize
package.
When I import this as a list (example pasted next) the colors do not get assigned properly to the gene IDs, so the plots do not use the right colors.
gene0059="aquamarine"
...
gene1702="purple1"
How do I both format the file and import it to correctly assign the colors to the gene labels?
Please show us your full plotting code.
Sure thing. Wasn't sure if it was too much to post:
The input file is just a tab delimited, three column file that has the first gene ID (geneID_1), the connecting gene ID (geneID_2), and value that is used for drawing the chord diagrams (Count).
The manual uses a matrix (wide form of the long form dataset you're using). See: https://jokergoo.github.io/circlize_book/book/the-chorddiagram-function.html#basic-usage-of-making-chord-diagram
Try getting your data in that format, that might solve the problem.
Thanks for the reply. I use
acast
to convert the DF into the format used by chordDiagram. So I don't think the input data format is the issue, but I will certainly take a look.