Page 1 of 1

getting SNPnames from gwa.class

Posted: Sun Apr 10, 2016 7:02 pm
by ImanMEZ
Dear all,

When I run the descriptive scan, my results come as follow :
as you see the first column which is the SNPnames column comes without a column names
I need to save my results as data frame, and the snp clumn is missing
I inspected the different slots of my gwa.class, and there is no snpnames column.
is it possible to recover it?

Code: Select all

descriptives.scan(coxresults_BRIT_1, top=20)
           Chromosome  Position Strand A1 A2   N       effB    se_effB chi2.1df                   P1df        Pc1df effAB effBB chi2.2df P2df
rs777           3  57555793      u  A  G 409  0.5936605 0.12347777 23.11526
rs462           3  57559004      u  G  A 409  0.5936605 0.12347777 23.11526
rs672           3  57578276      u  C  A 409  0.5936605 0.12347777 23.11526

> str(coxresults_BRIT_1)
Formal class 'scan.gwaa' [package "GenABEL"] with 7 slots
  ..@ results   :'data.frame':  468913 obs. of  10 variables:
  .. ..$ N       : num [1:468913] 409 409 408 409 409 409 409 409 409 409 ...
  .. ..$ effB    : num [1:468913] -0.1044 -0.0109 -0.1515 -0.1022 0.0221 ...
  .. ..$ se_effB : num [1:468913] 0.145 0.101 0.108 0.116 0.106 ...
  .. ..$ chi2.1df: num [1:468913] 0.5154 0.0117 1.9784 0.7774 0.0435 ...
  .. ..$ P1df    : num [1:468913] 0.473 0.914 0.16 0.378 0.835 ...
  .. ..$ Pc1df   : num [1:468913] 0.476 0.914 0.163 0.382 0.836 ...
  .. ..$ effAB   : logi [1:468913] NA NA NA NA NA NA ...
  .. ..$ effBB   : logi [1:468913] NA NA NA NA NA NA ...
  .. ..$ chi2.2df: logi [1:468913] NA NA NA NA NA NA ...
  .. ..$ P2df    : logi [1:468913] NA NA NA NA NA NA ...
  ..@ dimresults: int [1:2] 468913 10
  ..@ annotation:'data.frame':  468913 obs. of  5 variables:
  .. ..$ Chromosome: Factor w/ 22 levels "1","10","11",..: 1 1 1 1 1 1 1 1 1 1 ...
  .. ..$ Position  : num [1:468913] 765555 798789 152358 125855  ...
  .. ..$ Strand    : Factor w/ 1 level "u": 1 1 1 1 1 1 1 1 1 1 ...
  .. ..$ A1        : Factor w/ 3 levels "A","C","G": 3 3 2 1 1 3 3 1 3 3 ...
  .. ..$ A2        : Factor w/ 3 levels "A","C","G": 1 1 1 3 2 1 1 3 1 1 ...
  ..@ lambda    :List of 2
  .. ..$ estimate: num 1.02
  .. ..$ se      : num 2.31e-05
  ..@ idnames   : chr [1:409] "deadkf04" "deadkf05" "deadkf06" "deadkf07" ...
  ..@ call      : language mlreg(formula = GASurv(survivaldataBRIT@phdata$ObsMonths, survivaldataBRIT@phdata$Status) ~      1, data = qcGWAS_Brit)
  ..@ family    : chr "guess"
 

Re: getting SNPnames from gwa.class

Posted: Mon Apr 11, 2016 9:07 am
by ImanMEZ
Update!

I tried the following, to get the SNPnames from my original data,

Code: Select all

ResultsBrit_1 <- data.frame( SNP=as.character(qcGWAS_Brit@gtdata@snpnames),CHR = as.numeric(coxresults_BRIT_1@annotation$Chromosome), Allele_A1=coxresults_BRIT_1@annotation$A1,Allele_A2=coxresults_BRIT_1@annotation$A2,
 BP = coxresults_BRIT_1@annotation$Position, N = coxresults_BRIT_1@results$N, beta_B = coxresults_BRIT_1@results$effB, sebeta = coxresults_BRIT_1@results$se_effB,chi2.1df=coxresults_BRIT_1@results$chi2.1df,P = coxresults_BRIT_1@results$P1df, P_corrected = coxresults_BRIT_1@results$Pc1df, strand = as.character(coxresults_BRIT_1@annotation$Strand), beta_AB= coxresults_BRIT_1@results$effAB, beta_BB = coxresults_BRIT_1@results$effBB,chi2.2df= coxresults_BRIT_1@results$chi2.2df,P2df= coxresults_BRIT_1@results$P2df)



It look like it's working but since my original data and my results data has different order, the chromosomes are mixed up ,

Code: Select all

table(ResultsBrit_1$CHR)

    1     2     3     4     5     6     7     8     9    10    11    12    13
38738 25101 24151 23593 17352 15469 14490 15326 13861 14097 10742 37293 12506
   14    15    16    17    18    19    20    21    22
 6934  7247 31024 26929 28542 32207 25576 25439 22296
 
 table(Brit_Bim$CHR)

    1     2     3     4     5     6     7     8     9    10    11    12    13
38738 37293 31024 26929 28542 32207 25576 25439 22296 25101 24151 23593 17352
   14    15    16    17    18    19    20    21    22
15469 14490 15326 13861 14097 10742 12506  6934  7247
 


when saving the results without the SNPnames columns and then merging with my bim file, my chromosomes order is coming correctly.

But I was wondering if there is another way to get it directly from the gwa.class