[R] scrime Package simulatedSNP function

Neil Shephard nshephard at gmail.com
Fri May 9 13:59:48 CEST 2008




Claire_6700 wrote:
> 
> Hello,
> 
> I need some help with the simulatedSNPs function from scrime package.
> 
> I am trying to simulate some genotype of a case/control disease locus. The
> allele frequence are cases/controls
> 
> Sample     cases      controls
> 2000         .5            .10
> 1500         .6            .40
> 
> In each of the row, i need to simulate 100 snp and calculate the pvalue
> 
> ##############Download Scrime Package###########################
> library(scrime)
> n.obs<-1000
> n.snp<-100
> vec.ia<-1
> simulateSNPs(n.obs, n.snp, vec.ia, prop.explain = 1,
> list.ia.val = NULL, vec.ia.num = NULL, maf = c(0.1, 0.12),
> prob.val = rep(1/3, 3), list.equal = NULL, prob.equal = 0.8,
> rm.redundancy = TRUE, shuffle = FALSE, shuffle.obs = FALSE, rand = NA)
> 
> What is the right parameter. I am pretty new with R.
> 
> wrong result.
>   Interaction Cases Controls
> 1   SNP1 == 2   500        0
> 
> any help will be appreciated.
> 
> thanks
> Claire
> 

Check the help for the ?simulateSNPs() function.  It provides clear examples
of how to use it.

In this instance you need to assign the results of running simulateSNPs to
an object.  So, in your above code you need to have...

#### Start ####
> library(scrime)
> n.obs<-1000
> n.snp<-100
> vec.ia<-1
## Note the assignment in the below statement
> sim1<- simulateSNPs(n.obs, n.snp, vec.ia, prop.explain = 1, \\
list.ia.val = NULL, vec.ia.num = NULL, maf = c(0.1, 0.12), \\
prob.val = rep(1/3, 3), list.equal = NULL, prob.equal = 0.8, \\
rm.redundancy = TRUE, shuffle = FALSE, shuffle.obs = FALSE, rand = NA)
#### Finish ####

You now have an object 'sim1' that contains the results of the simulation. 
To find out what these are you type...

#### Start ####
> names(sim1)
[1] "data"        "cl"          "tab.explain" "ia"          "maf"    
#### Finish ####

What you are seeing with out assigning the results from calling
simulateSNPs() to an object is sim1$tab.explain

To get the raw data from the simulations into its own object you can...

#### Start ####
> sim1.data <- sim1$data
## Print summary information on allele frequencies of simulated data
> sim1$maf
  [1] 0.1019921 0.1166833 0.1162599 0.1032456 0.1144771 0.1067833 0.1023612
  [8] 0.1168232 0.1066618 0.1172988 0.1049692 0.1006477 0.1124793 0.1086271
 [15] 0.1181598 0.1038002 0.1150600 0.1029935 0.1196051 0.1015223 0.1045593
 [22] 0.1089789 0.1180688 0.1006122 0.1196565 0.1131580 0.1131264 0.1022888
 [29] 0.1158212 0.1118635 0.1077083 0.1151471 0.1023238 0.1012435 0.1044028
 [36] 0.1047839 0.1007996 0.1030058 0.1180583 0.1003964 0.1051847 0.1183929
 [43] 0.1061727 0.1118420 0.1192968 0.1040632 0.1051112 0.1186949 0.1042196
 [50] 0.1009020 0.1113263 0.1130648 0.1094135 0.1168967 0.1187118 0.1085089
 [57] 0.1199226 0.1143786 0.1159529 0.1014398 0.1104690 0.1050063 0.1009227
 [64] 0.1102197 0.1030258 0.1109929 0.1001394 0.1106730 0.1054413 0.1044738
 [71] 0.1080446 0.1003916 0.1094400 0.1086378 0.1059338 0.1039598 0.1043444
 [78] 0.1102694 0.1017065 0.1154185 0.1177336 0.1095213 0.1171060 0.1103163
 [85] 0.1089563 0.1080247 0.1088396 0.1157875 0.1179325 0.1041557 0.1095087
 [92] 0.1013651 0.1044949 0.1084277 0.1163425 0.1061450 0.1015519 0.1029643
 [99] 0.1126980 0.1023006
#### Start ####

Neil
-- 
View this message in context: http://www.nabble.com/scrime-Package-simulatedSNP-function-tp17138820p17146486.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list