[R] Repeating tdt function on thousands of variables

From: David Duffy <David.Duffy_at_qimr.edu.au>
Date: Thu 04 May 2006 - 14:17:22 EST

> 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@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

R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Thu May 04 14:24:35 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Thu 04 May 2006 - 16:09:59 EST.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.