Giter Club home page Giter Club logo

Comments (9)

kevinblighe avatar kevinblighe commented on August 23, 2024

Hi Anthony, did you post on Biostars, too?

I have not seen this error, previously. Can you show me the code that you used to run EnhancedVolcano()?

from enhancedvolcano.

AnthonyDohertyTCD avatar AnthonyDohertyTCD commented on August 23, 2024

Yes sorry for posting twice was not sure the best place to ask.

I am using standard output from the DeSeq2 res command. I am trying to make a key variable MYC stand out more. I have been able to overwrite the colour scheme and change the shape of this variable alone also (see attached PDF). I would like it to stand out more. Hence why I would like to shade it.
ExampleVolcano.pdf

#Adding Custom Colours
keyvals <- ifelse(
  res$log2FoldChange < -log2(1.5) & res$padj < (0.05), 'royalblue',
  ifelse(res$log2FoldChange > log2(1.5) & res$padj < (0.05), 'red',
         'black'))


keyvals[is.na(keyvals)] <- 'black'
names(keyvals)[keyvals == 'red'] <- 'high'
names(keyvals)[keyvals == 'black'] <- 'mid'
names(keyvals)[keyvals == 'royalblue'] <- 'low'


#Making 2 variables a different shape to stand out
# define different cell-types that will change shape
celltype1 <- c('ENSG00000136997')
celltype2 <- c('ENSG00000007516')


# create custom key-value pairs for different cell-types
# this can be achieved with nested ifelse statements
keyvals.shape <- ifelse(
  rownames(res) %in% celltype1, 11,
  ifelse(rownames(res) %in% celltype2, 1,
         1))
keyvals.shape[is.na(keyvals.shape)] <- 1
names(keyvals.shape)[keyvals.shape == 1] <- "All other genes"
names(keyvals.shape)[keyvals.shape == 11] <- 'MYC'
names(keyvals.shape)[keyvals.shape == 1] <- NULL

#Define variable to be shaded
celltype3 <- c('ENSG00000132688')

#Enhanced volcano plot 
library(EnhancedVolcano)
EnhancedVolcano(res, lab = rownames(res),
                x = 'log2FoldChange', y = 'padj',
                selectLab = celltype1, xlim = c(-10, 10), xlab = bquote(~Log[2]~ 'fold change'), 
                ylab = bquote(~-Log[10]~adjusted~italic(P)),
                pCutoff = 0.05, FCcutoff = log2(1.5), pointSize =  c(ifelse(rownames(res) %in% c('ENSG00000136997') , 5, 1)), labSize = 3.0, colAlpha = 5 ,colCustom = keyvals, shapeCustom = keyvals.shape,
                labCol = 'black',
                labFace = 'bold',
                boxedLabels = T,
                gridlines.major = FALSE,
                gridlines.minor = FALSE,
                shade = celltype3,
                shadeLabel = 'MYC',
                shadeAlpha = 1/2,
                shadeFill = 'purple',
                shadeSize = 4,
                shadeBins = 5,
                legend=c('NS', 'Log2 FC', 'Adjusted p-value', 'Adjusted p-value & Log2 FC'))

The above attached PDF is produced but with the following warning and no shading.
Warning message:
Computation failed in stat_density2d():
missing value where TRUE/FALSE needed

Thank you for the quick reply.

from enhancedvolcano.

kevinblighe avatar kevinblighe commented on August 23, 2024

Thanks for sharing. Can you confirm your version of R and also this package? A change brought about in R 4.0.0 has already caused functionality to change across many packages.

Also, is this line necessary?
names(keyvals.shape)[keyvals.shape == 1] <- NULL

The 'shade' functionality is a part of the package that I have considered removing, as I am not overly content with it. If you are just looking to highlight your gene, ENSG00000132688, is the selectLab and boxedLabels functionality enough?

selectLab and boxedLabels should work together, though, as exemplified here:
https://github.com/kevinblighe/EnhancedVolcano#shade-certain-variables

Is ENSG00000132688 definitely in your data?

from enhancedvolcano.

AnthonyDohertyTCD avatar AnthonyDohertyTCD commented on August 23, 2024

R version 3.6.3 (2020-02-29)

packageVersion("EnhancedVolcano")
‘1.4.0’

That line was not necessary thank you.

I have used the selectLab and boxedLabels together and it works very well. I would have liked to highlight it a bit more. Instead of shading, would it be possible to colour this key variable alone a single colour while also maintaining my custom colour scheme.

Thank you again for the help. I am new to R as I said and this package has been quite easy to use.

Yes the variable I am trying to shade is for sure in my data.

from enhancedvolcano.

kevinblighe avatar kevinblighe commented on August 23, 2024

I'm not sure what else to suggest. If possible, upgrade to R 4.0.0, which will in turn pull in the 'newest' version of EnhancedVolcano, too.

You could also try to paste a mini-table here that acts as a reproducible example that I can debug here. Or, feel free to email me some data if you prefer to keep the data private.

from enhancedvolcano.

AnthonyDohertyTCD avatar AnthonyDohertyTCD commented on August 23, 2024

That would be cool if I could email you. In regards to my last comment: Instead of shading, would it be possible to colour this key variable alone a single colour while also maintaining my custom colour scheme.

Thanks again for all the help.

from enhancedvolcano.

kevinblighe avatar kevinblighe commented on August 23, 2024

You should be able to label it its own colour via the colCustom argument, which works much the same as shapeCustom. Also take a look at the example here, where you could change the size of point for the key gene:
https://github.com/kevinblighe/EnhancedVolcano#highlighting-key-variables-via-custom-point-sizes

from enhancedvolcano.

kevinblighe avatar kevinblighe commented on August 23, 2024

Note: need to improve point shading / highlighting. geom_path may be an option.

from enhancedvolcano.

kevinblighe avatar kevinblighe commented on August 23, 2024

Hey @AnthonyDohertyTCD , this has now been implemented. You'll have to install the GitHub version for now; otherwise, in a few days, it will be on the Bioconductor Devel branch (and official branch when the next version of Bioconductor is released).

An example here:
https://github.com/kevinblighe/EnhancedVolcano#encircle--highlight-certain-variables

from enhancedvolcano.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.