Open hlnicholls opened 3 years ago
I managed to address my need for shapes in a way, but with using an additional package to overlay the shapes, and this still isn't quite correct, it looks like this:
drugs <- fread('genes_dgidb_export.tsv')
drugs <- dplyr::select(drugs, Gene, Druggability)
drugs <- drugs[1:56,] #making data same size as mentioned in previous error message
Druggability <- drugs$Druggability
names(Druggability) <- drugs$Gene
options(ggrepel.max.overlaps = Inf)
pother <- cnetplot(gene_of_interest,
categorySize ='pvalue',
foldChange = gene_list_scores,
)
pother <- pother + scale_color_gradient2(name='Score', low='steelblue', high='red') +
scale_size_continuous(range = c(2, 8))
#Overlaying shapes by drug:
library(ggraph)
pother + geom_node_point(aes(shape=Druggability)) +
scale_shape_manual(values=c(2, 5, 3, 4))
This gives:
This isn't exactly what I'm looking for (ideally I'd like to change the point shapes completely, maintaining the color scale, and not need to overlay a new point shape on top), but the bigger problem I can't solve is that some of the pathway nodes are also being assigned a druggability shape, even though only each gene has an assigned druggability, I'm not sure how to fix this. And the shapes that are assigned in the plot are not in the correct places, some genes are being assigned a shape when I know from my Druggability
data that they shouldn't be.
I have a cnetplot and I am wondering if it is possible for me to do further categorising of genes in the plot by point shape?
My cnetplot is of genes and their interacting pathways, but the genes are also in a separate dataset that lists each of their drug categories, and there are 4-5 categories in total. I want to see if I could change the point shape from circles to have shapes corresponding to the drug category a gene might be in, as well as already having/keeping the points colour-coded by the fold change in cnetplot().
Currently I am trying:
My
drugs
gene list is shorter than the gene list ingenes_of_interest
, but my drugs data does contain only genes that are ingenes_of_interest
object and their corresponding drug categories - is there a way for me to add these into the cnetplot to consider as point shapes?I'm not an experienced coder, but would it this be possible to do if I can add my drugs data as a column in my
gene_of_interest
enrichResult data somehow and fill in any missing drug category values with NA for the genes, making the drug data have the same length of 56 that the error message above mentions?For reference, an example of my input drug data that I am trying to overlay as shape categories for the genes looks like:
And
gene_of_interest
is a formal class of enrichResult so I'm not sure how to share a sample of it. Andgene_list_measure
is just another dataset of 2 columns of gene symbols and their foldchange scores. An example of this would be:Currently the output of cnetplot looks like:
My SessionInfo:
Sorry this is a lot of information, any kind of help on if it's possible to change the point shapes would be helpful