[R] Repeating tdt function on thousands of variables

David Duffy David.Duffy at qimr.edu.au
Thu May 4 06:17:22 CEST 2006


>
> I am using dgc.genetics to perform TDT analysis on SNP data from a cohort of
> trios.
>
> I now have a file with about 6008 variables. The first few variables related
> to the pedigree data such as the pedigree ID the person ID etc. Thereafter
> each variable is a specific locus or marker. The variables are named by a
> pattern such as "Genotype.nnnnn" with nnnnn corresponding to a number which
> is the name or id of the locus.
>
> I am able to get the tdt to run by each locus. >tdt(Genotype.914186, PGWide,
> famid, pid, fatid, motid, sex, affected )
>
> Clearly I cannot type each locus in one at a time. Instead I want to loop it
> but am not sure how to do it. I tried lapply but it did not really work.
> --
> Farrel Buchinsky, MD
> Pediatric Otolaryngologist
> Allegheny General Hospital
> Pittsburgh, PA
>

Something like:

pos.first.marker <- 8
Nsnps <- nrow(your.data)-pos.first.marker+1
res <- double(Nsnps)
names(res) <- names(your.data)[-seq(1,pos.first.marker-1)]
for (i in seq(1, Nsnps)) {
  res[i] <- tdt(your.data[,i], your.data)$p.value[2]
}

David Duffy

| David Duffy (MBBS PhD)                                         ,-_|\
| email: davidD at qimr.edu.au  ph: INT+61+7+3362-0217 fax: -0101  /     *
| Epidemiology Unit, Queensland Institute of Medical Research   \_,-._/
| 300 Herston Rd, Brisbane, Queensland 4029, Australia  GPG 4D0B994A v




More information about the R-help mailing list