Custom title for DEXseq plot
1
1
Entering edit mode
timknutsen ▴ 10
@timknutsen-7013
Last seen 9.5 years ago
Norway

Hi!

I a using DEXseq to explore Diff Expression of transcripts one particular gene in the Bovine genome.

 

The function plotDEXSeq() produces a nice plot that can be seen in the DEXseq manual.

http://www.bioconductor.org/packages/release/bioc/vignettes/DEXSeq/inst/doc/DEXSeq.pdf 

My question is the following: Can I set a  custom title for the plot? 

I tried with (main = "new title") It did not work. 

 

regards, Tim Knutsen

PhD student in genetics.

 

dexseq • 1.4k views
ADD COMMENT
3
Entering edit mode
@james-w-macdonald-5106
Last seen 3 days ago
United States

Not without hacking the code. If you look at the bottom of plotDEXSeq(), you will see

 if (legend) {
        mtext(paste(geneID, unique(sub$strand)), side = 3, adj = 0.25,
            padj = 1.5, line = 0, outer = TRUE, cex = 1.5)
        posforlegend <- seq(0.7, 0.9, length.out = numcond)
        for (i in seq(along = color)) {
            mtext(names(color[i]), side = 3, adj = posforlegend[i],
                padj = 1.5, line = 0, outer = TRUE, col = color[i],
                ...)
        }
    }
    else {
        mtext(paste(geneID, unique(sub$strand)), side = 3, adj = 0.5,
            padj = 1.5, line = 0, outer = TRUE, cex = 1.5)
    }

And those calls to mtext() are hard-coding the gene ID as title. If you really care enough about having a different title, all you need to do is download the source tarball, modify that function to allow you to pass in an arbitrary title, build and install.

Something really simple and ad hoc would be to add an extra argument:

plotDEXSeq
function (object, geneID, FDR = 0.1, fitExpToVar = "condition",
    norCounts = FALSE, expression = TRUE, splicing = FALSE, displayTranscripts = FALSE,
    names = FALSE, legend = FALSE, color = NULL, color.samples = NULL,
    main = NULL, ...)

And then right before the last bit of code, you could add

if(!is.null(main)){
        mtext(main, side = 3, adj = 0.25, padj = 1.5, line = 0, outer = TRUE,
            cex = 1.5)
} else {
if (legend) {
        mtext(paste(geneID, unique(sub$strand)), side = 3, adj = 0.25,
            padj = 1.5, line = 0, outer = TRUE, cex = 1.5)
        posforlegend <- seq(0.7, 0.9, length.out = numcond)
        for (i in seq(along = color)) {
            mtext(names(color[i]), side = 3, adj = posforlegend[i],
                padj = 1.5, line = 0, outer = TRUE, col = color[i],
                ...)
        }
    }
    else {
        mtext(paste(geneID, unique(sub$strand)), side = 3, adj = 0.5,
            padj = 1.5, line = 0, outer = TRUE, cex = 1.5)
    }
}

 

 

ADD COMMENT
0
Entering edit mode

Thanks for the answer!

I will try your solution. I find it a bit weird that a custom title is not allowed for this plotting function.

Tim

ADD REPLY
0
Entering edit mode

This gives you a prime opportunity to (attempt to) contribute! Bioconductor packages are Open Source, after all, and Alejandro Reyes may be happy to incorporate a patched function (which is why I say 'attempt to' contribute - he might not be interested in a patch, but you can't know without trying).

You can check out the package from subversion using

svn co --username readonly --password readonly https://hedgehog.fhcrc.org/bioconductor/trunk/madman/Rpacks/DEXSeq 

Make your changes (you should copy the DEXSeq directory somewhere else to build and install, so you don't pollute the svn directory with extra files that are generated by the build process), and once you like how it works, you can go back to the svn DEXSeq directory and then do

svn diff > my_sweet_patch.diff

And then send to Alejandro, with an explanation of why you think it is weird that you cannot change the plot title, and why you think your sweet patch should be incorporated. Et voila! Social coding, without github!

ADD REPLY

Login before adding your answer.

Traffic: 702 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6