Search
Question: Problems with generating manhattan plot
0
gravatar for achimmiri
2.5 years ago by
achimmiri0
United States
achimmiri0 wrote:

Dear All,

I am trying to plot manhattan plot , I first tried with qqplot , it looked like a scatter plot and very funny> plotGrandLinear(MPB, aes(y = P), color = c("#7fc97f", "#fdc086"))

Error: Objects of type data.frame not supported by autoplot.  Please use qplot() or ggplot() instead

> str(MPB)

'data.frame': 63 obs. of  4 variables:

 $ CHR: num  1 1 1 1 1 1 1 1 1 1 ...

 $ SNP: chr  "rsID0" "rsID1" "rsID2" "rsID3" ...

 $ BP : num  1310924 16840541 16840567 16840575 17231444 ...

 $ P  : num  1 0.822 0.001 0.807 0 0.357 0.148 0.95 1 0.22 ..

> makeGRangesFromDataFrame(MPB,keep.extra.columns=FALSE,ignore.strand=FALSE,seqinfo=NULL,seqnames.field=c("CHR","SNP","BP","P"),start.field=c("start","CHR"),end.field=c("end","P"))

Error in .find_seqnames_col(df_colnames0, seqnames.field0, prefix) : 

  cannnot determine seqnames column unambiguously

> gr1 <- makeGRangesFromDataFrame(MPB, keep.extra.columns=TRUE,

+                                 starts.in.df.are.0based=TRUE, start=1, end=23)

Error in .normarg_field(start.field, "start") : 

  'start.field' must be a character vector with no NAs

> gr1 <- makeGRangesFromDataFrame(MPB, keep.extra.columns=TRUE,

+                                 starts.in.df.are.0based=TRUE)

Error in .find_start_end_cols(df_colnames0, start.field0, end.field0) : 

  cannnot determine start/end columns

It is still giving me error 

as I attached my data( This is how my data looks) , Thanks so much again. 

CHR

SNP

BP

P

1

1

rsID0

1310924

1.000

2

1

rsID1

16840541

0.822

3

1

rsID2

16840567

0.001

4

1

rsID3

16840575

0.807

5

1

rsID4

17231444

0.000

6

1

rsID5

26758773

0.357

7

1

rsID6

40506239

0.148

8

1

rsID7

47779951

0.950

9

1

rsID8

109289236

1.000

10

1

rsID9

110881432

0.220

         

 

 

ADD COMMENTlink modified 2.5 years ago by James W. MacDonald45k • written 2.5 years ago by achimmiri0
0
gravatar for James W. MacDonald
2.5 years ago by
United States
James W. MacDonald45k wrote:

Does this work for you?

library(BiocInstaller)

 biocLite("FDb.UCSC.snp137common.hg19")

library(FDb.UCSC.snp137common.hg19)

snps <- features(FDb.UCSC.snp137common.hg19)

snps2 <-  snps[paste0("rs", as.numeric(gsub("rsID", "", as.character(data[,2])))),]li

 

 

ADD COMMENTlink written 2.5 years ago by James W. MacDonald45k
0
gravatar for James W. MacDonald
2.5 years ago by
United States
James W. MacDonald45k wrote:

Ugh. Hit enter by accident.

You need a GRanges object for plotGrandLinear(). You can get one by doing what I show in my previous post. You then need to add your p-values to the metadata slot (after converting to -log10), naming the column pvalues. Something like

mcols(snps2)$pvalue <- -log10(data[,3])

Where I am assuming you have called your data.frame 'data'. There are lots of examples you can then use, here.


 

ADD COMMENTlink written 2.5 years ago by James W. MacDonald45k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.2.0
Traffic: 196 users visited in the last hour