I have used this approach to produce chord diagrams
for some time now, and will need to proceed using this package in order to harmonize graphics on my work.
I have never received any errors using this approach, and I cannot figure what causes this issue and how to solve it.
My apologies for the "long" data sample, but it was needed to reproduce the error.
Question why am I receiving this error, and can it be fixed?:
Error in
f()
: ! Breaks and labels are different lengths
library(tidyverse)
library(GOplot)
i_circle <- circle_dat(i_GOterms, i_genelist) %>%
na.omit()
chord_i <- chord_dat(data = i_circle,
genes = i_genelist,
process = unique(i_circle$term))
GOChord(chord_i)
Data structure 1
i_genelist <- structure(list(ID = structure(1:128, levels = c("A1BG", "A2M",
"ACTB;ACTG1", "AGT", "AHSG", "ALB", "AMBP", "APLP1", "APOA1",
"APOA2", "APOA4", "APOC3", "APOD", "APOE", "APOH", "APP", "AZGP1",
"B2M", "B4GAT1", "BCAN", "C1QC", "C1R", "C1S", "C3", "C4A", "C7",
"CD14", "CD59", "CDH2", "CFB", "CFH", "CHGA", "CHGB", "CHL1",
"CLSTN1", "CLU", "CNDP1", "CNTN1", "CP", "CPE", "CRTAC1", "CSF1",
"CSF1R", "CST3", "CTSD", "DAG1", "DKK3", "ECM1", "EFEMP1", "ENPP2",
"EPHA4", "EXOC3L4", "F2", "FAM3C", "FBLN1", "FCGBP", "FGA", "FGB",
"FGG", "FN1", "FSTL1", "GC", "GM2A", "GRIK1", "HBA1", "HBB",
"HP", "HPX", "HSPG2", "IGF2", "IGFBP2", "IGFBP6", "IGFBP7", "IGHA1",
"IGHG1", "IGHG2", "IGHG3", "IGKC", "IGLL5;IGLC1", "ITIH2", "ITIH4",
"KLK6", "KNG1", "LDHB", "LGALS3BP", "LRG1", "LY6H", "NCAM1",
"NCAM2", "NEGR1", "NELL2", "NOV", "NPC2", "NPTXR", "NRCAM", "OGN",
"ORM1", "ORM2", "PAM", "PCOLCE", "PCSK1N", "PENK", "PLG", "PLTP",
"PSAP", "PTGDS", "RARRES2", "RBP4", "RNASE1", "SCG2", "SCG3",
"SCG5", "SERPINA1", "SERPINA3", "SERPINC1", "SERPIND1", "SERPINF1",
"SERPING1", "SIRPA;SIRPB1", "SOD3", "SPARCL1", "SPP1", "TF",
"TIMP1", "TTR", "VGF", "VSTM2A", "VTN"), class = "factor"), logFC = c(16,
17, 13, 14, 14, 21, 12, 16, 17, 13, 15, 11, 15, 18, 14, 13, 15,
16, 13, 14, 12, 13, 11, 18, 17, 11, 13, 14, 14, 14, 15, 15, 14,
13, 15, 17, 14, 13, 15, 12, 14, 11, 12, 17, 12, 11, 14, 12, 14,
15, 10, 12, 15, 13, 15, 12, 15, 12, 12, 16, 11, 16, 11, 13, 15,
16, 17, 17, 10, 12, 12, 11, 14, 14, 18, 14, 16, 16, 13, 12, 11,
13, 16, 12, 12, 13, 11, 14, 11, 12, 14, 11, 13, 13, 13, 14, 15,
14, 13, 11, 14, 12, 12, 12, 12, 17, 12, 13, 12, 12, 12, 13, 18,
15, 13, 11, 16, 15, 14, 12, 16, 12, 19, 11, 16, 15, 12, 14)), row.names = c(NA,
-128L), class = "data.frame")
Data structure 2
i_GOterms <- structure(list(Category = c("GOTERM_BP_DIRECT", "GOTERM_BP_DIRECT",
"GOTERM_BP_DIRECT", "GOTERM_BP_DIRECT", "GOTERM_BP_DIRECT", "GOTERM_BP_DIRECT",
"GOTERM_BP_DIRECT", "GOTERM_BP_DIRECT", "GOTERM_BP_DIRECT", "GOTERM_BP_DIRECT",
"GOTERM_BP_DIRECT", "GOTERM_BP_DIRECT", "GOTERM_BP_DIRECT", "GOTERM_BP_DIRECT",
"GOTERM_BP_DIRECT", "GOTERM_BP_DIRECT", "GOTERM_BP_DIRECT", "GOTERM_BP_DIRECT",
"GOTERM_BP_DIRECT", "GOTERM_BP_DIRECT"), Term = c("inflammatory response",
"defense response to bacterium", "plasminogen activation", "positive regulation of B cell activation",
"phagocytosis, recognition", "high-density lipoprotein particle assembly",
"negative regulation of fibrinolysis", "negative regulation of blood coagulation",
"phagocytosis, engulfment", "positive regulation of peptidase activity",
"protein localization to secretory granule", "protein polymerization",
"complement activation, alternative pathway", "axon guidance",
"cholesterol metabolic process", "B cell receptor signaling pathway",
"negative regulation of very-low-density lipoprotein particle remodeling",
"regulation of beta-amyloid clearance", "aging", "positive regulation of phagocytosis"
), Genes = c("SERPINA3, CSF1R, ECM1, ORM1, CSF1, RARRES2, HSPG2, KNG1, C3, C4A, SPP1, CD14, SCG2",
"CHGA, IGHG3, IGLL5, IGHG1, IGHG2, VGF, IGKC, HP, IGLC1, IGHA1",
"FGB, FGA, APOH, FGG", "IGHG3, IGLL5, IGHG1, IGHG2, IGKC, IGLC1, IGHA1",
"IGHG3, IGLL5, IGHG1, IGHG2, IGKC, IGLC1, IGHA1", "APOA2, APOA1, APOA4, APOE",
"VTN, APOH, PLG, F2", "VTN, APOH, APOE, KNG1", "IGHG3, IGLL5, IGHG1, IGHG2, IGKC, IGLC1, IGHA1",
"APP, FN1, FBLN1, PCOLCE", "CHGA, CPE, SCG3", "FGB, FGA, VTN, FGG",
"C3, CFH, C7, CFB", "NELL2, EPHA4, CSF1R, B4GAT1, CHL1, DAG1, CNTN1, NRCAM",
"APP, NPC2, APOA2, APOA1, APOA4, APOE", "IGHG3, IGLL5, IGHG1, IGHG2, IGKC, IGLC1, IGHA1",
"APOA2, APOC3, APOA1", "APP, APOE, CLU", "SERPINF1, PENK, IGFBP2, DAG1, SERPING1, APOD, TIMP1, AGT",
"AHSG, APOA2, SIRPA, APOA1, SIRPB1"), adj_pval = c(0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)), row.names = c(NA,
-20L), class = "data.frame")
You need to increase lfc.max
, since all of the values in your logFC
column lie outside the default range of c(-3, 3)
:
GOChord(chord_i, lfc.max = 20)
I find it quite difficult to fit the legend into this plot due to the length of your terms' labels.