[R] [FORGED] Re: text annotation on Manhattn plot in qqman

Paul Murrell p@u| @end|ng |rom @t@t@@uck|@nd@@c@nz
Wed May 20 22:49:25 CEST 2020


Hi

Something like this might do what you want ...


## From example(manhattan)
manhattan(gwasResults, annotatePval = 0.0001)

library(gridGraphics)
grid.echo()
## grid.ls()
## The annotations have "text" in their name
labels <- grid.grep("text", grep=TRUE)
grid.edit(labels, gp=gpar(cex=1))


Hope that helps

Paul

On 21/05/20 3:10 am, Ana Marija wrote:
> HI Michael,
> 
> Thank you so much!
> That worked!!! Now I am just trying to increase the size of text of
> SNP and GENE on plot
> 
> I tried this:
> 
> a$newname <- paste(a$SNP,"\n", a$GENE)
> manhattan(a, chr="CHR", bp="BP", snp="newname", p="P",cex =
> 0.5,annotatePval = 0.0001)
> 
> but I am getting this error:
> 
> Error in textxy(topSNPs$pos, -log10(topSNPs$P), offset = 0.625, labs =
> topSNPs$SNP,  :
>    formal argument "cex" matched by multiple actual arguments
> 
> Do you by any chance know how to do this?
> 
> Cheers
> Ana
> 
> On Wed, May 20, 2020 at 4:12 AM Michael Dewey <lists using dewey.myzen.co.uk> wrote:
>>
>> a$newname <- paste(a$SNP, a$GENE)
>> manhattan(a, chr="CHR", bp="BP", snp="newname", p="P",annotatePval = 0.0001)
>>
>> However note that I do not use manhattan() so you may need to alter the
>> parameters as I am assuming a is where it finds the remaining parameters.
>>
>> You may also need to play with the sep =, and collapse = parameters to
>> paste() to get the precise layout you want.
>>
>> Michael
>>
>> On 19/05/2020 17:21, Ana Marija wrote:
>>> Hi Michael,
>>>
>>> can you please send me code how that would be done?
>>>
>>> Thanks
>>> Ana
>>>
>>> On Tue, May 19, 2020 at 11:18 AM Michael Dewey <lists using dewey.myzen.co.uk> wrote:
>>>>
>>>> Dear Ana
>>>>
>>>> Perhaps paste together SNP and GENE using paste() and then supply that
>>>> as the snp parameter.
>>>>
>>>> Michael
>>>>
>>>> On 19/05/2020 17:12, Ana Marija wrote:
>>>>> Hello,
>>>>>
>>>>> I am making manhattan plot with:
>>>>> library(qqman)
>>>>> manhattan(a, chr="CHR", bp="BP", snp="SNP", p="P",annotatePval = 0.0001)
>>>>>
>>>>> and I would like to annotate these two SNPs which are above the
>>>>> threshold so that they have GENE name beside them:
>>>>>
>>>>>> a[a$SNP=="rs4081570",]
>>>>>            SNP            P CHR       BP GENE
>>>>> 1 rs4081570 6.564447e-05  19 15918647 UCA1
>>>>>> a[a$SNP=="rs11867934",]
>>>>>                SNP            P CHR       BP GENE
>>>>> 1021 rs11867934 6.738066e-06  17 16933404 FLCN
>>>>>
>>>>> Right now my plot only has SNP name for those 2, how to add GENE names
>>>>> (FLCN and UCA1 as well)
>>>>>
>>>>> Please advise
>>>>> Ana
>>>>>
>>>>>
>>>>>
>>>>> ______________________________________________
>>>>> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
>>>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>>>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>>>>> and provide commented, minimal, self-contained, reproducible code.
>>>>>
>>>>
>>>> --
>>>> Michael
>>>> http://www.dewey.myzen.co.uk/home.html
>>>
>>
>> --
>> Michael
>> http://www.dewey.myzen.co.uk/home.html
> 
> ______________________________________________
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
> 

-- 
Dr Paul Murrell
Department of Statistics
The University of Auckland
Private Bag 92019
Auckland
New Zealand
64 9 3737599 x85392
paul using stat.auckland.ac.nz
http://www.stat.auckland.ac.nz/~paul/



More information about the R-help mailing list