[GenABEL-dev] [Fwd: descriptives.trait Patch]

pirastu at burlo.trieste.it pirastu at burlo.trieste.it
Fri Mar 25 13:03:57 CET 2011


Sorry I forgot the attachment.

Dear all,

attached you can find a patch to fix the bugs described underneath. To
install from the root directory of /pkg: patch -p0 <
patch_descriptives.trait.

Best

Nicola

Patch for bugs #1184 #1185 #1259

Bug [#1184] descriptives.trait can not see the variable in by.var argument
unless full path specified

Description:
https://r-forge.r-project.org/tracker/index.php?func=detail&aid=1184&group_id=505&atid=2058

Changes: now by.var can be specified aslo as :"var_name" or ~var_name

Test:

> library(GenABEL)
> data(ge03d2ex)
> descriptives.trait(ge03d2ex,by.var="sex")
       No(by.var=0)    Mean     SD No(by.var=1)    Mean     SD   Ptt   Pkw
id               64      NA     NA           72      NA     NA    NA    NA
sex              64      NA     NA           72      NA     NA    NA    NA
age              64  46.942 12.479           72  50.959 13.107 0.070 0.081
dm2              64   0.547  0.502           72   0.708  0.458 0.053 0.052
height           64 162.680  6.819           71 175.534  7.943 0.000 0.000
weight           64  78.605 26.908           71  95.322 21.441 0.000 0.000
diet             64   0.109  0.315           72   0.014  0.118 0.025 0.019
bmi              64  29.604  9.506           71  30.930  6.547 0.352 0.040
       Pexact
id         NA
sex        NA
age        NA
dm2     0.074
height     NA
weight     NA
diet    0.026
bmi        NA
> descriptives.trait(ge03d2ex,by.var=~sex)
       No(by.var=0)    Mean     SD No(by.var=1)    Mean     SD   Ptt   Pkw
id               64      NA     NA           72      NA     NA    NA    NA
sex              64      NA     NA           72      NA     NA    NA    NA
age              64  46.942 12.479           72  50.959 13.107 0.070 0.081
dm2              64   0.547  0.502           72   0.708  0.458 0.053 0.052
height           64 162.680  6.819           71 175.534  7.943 0.000 0.000
weight           64  78.605 26.908           71  95.322 21.441 0.000 0.000
diet             64   0.109  0.315           72   0.014  0.118 0.025 0.019
bmi              64  29.604  9.506           71  30.930  6.547 0.352 0.040
       Pexact
id         NA
sex        NA
age        NA
dm2     0.074
height     NA
weight     NA
diet    0.026
bmi        NA

Bug [#1185] descriptives.trait with missings in by.var argument

Description:
https://r-forge.r-project.org/tracker/index.php?func=detail&aid=1185&group_id=505&atid=2058

Fixed: now by.var argument acceptes missing

Test:

> phdata(ge03d2ex)$sex[2] <- NA
> descriptives.trait(ge03d2ex,by.var=phdata(ge03d2ex)$sex)
       No(by.var=0)    Mean     SD No(by.var=1)    Mean     SD   Ptt   Pkw
id               63      NA     NA           72      NA     NA    NA    NA
sex              63      NA     NA           72      NA     NA    NA    NA
age              63  47.003 12.570           72  50.959 13.107 0.076 0.088
dm2              63   0.540  0.502           72   0.708  0.458 0.045 0.044
height           63 162.573  6.819           71 175.534  7.943 0.000 0.000
weight           63  77.651 26.009           71  95.322 21.441 0.000 0.000
diet             63   0.111  0.317           72   0.014  0.118 0.024 0.017
bmi              63  29.306  9.277           71  30.930  6.547 0.250 0.025
       Pexact
id         NA
sex        NA
age        NA
dm2     0.051
height     NA
weight     NA
diet    0.025
bmi        NA

Bug [#1259] descriptives.trait with by.var argument does not work
(contributed by Richard Ahn)

Description:
https://r-forge.r-project.org/tracker/index.php?func=detail&aid=1259&group_id=505&atid=2058

Comments: The problem was that for one of the traits one of the categories
had all missing data, this made descriptives.trait crush.

Fixed: descriptives.trait does not crush anymore.

Test:

nicola at nicola-VirtualBox:~/Scrivania$ R -f test.R
WARNING: ignoring environment value of R_HOME

R version 2.11.1 (2010-05-31)
Copyright (C) 2010 The R Foundation for Statistical Computing
ISBN 3-900051-07-0

R è un software libero ed è rilasciato SENZA ALCUNA GARANZIA.
Siamo ben lieti se potrai redistribuirlo, ma sotto certe condizioni.
Scrivi 'license()' o 'licence()' per dettagli su come distribuirlo.

R è un progetto di collaborazione con molti contributi esterni.
Scrivi 'contributors()' per maggiori informazioni e 'citation()'
per sapere come citare R o i pacchetti di R nelle pubblicazioni.

Scrivi 'demo()' per una dimostrazione, 'help()' per la guida in linea, o
'help.start()' per l'help navigabile con browser HTML.
Scrivi 'q()' per uscire da R.

> library(GenABEL)
Carico il pacchetto richiesto: MASS
GenABEL v. 1.6-6 (February 24, 2011) loaded

Installed GenABEL version (1.6-6) is not the same as stable
version available from CRAN (1.6-5). Unless used intentionally,
consider updating to the latest CRAN version. For that, use
'install.packages("GenABEL")', or ask your system administrator
to update the package.

> convert.snp.illumina(infile="test_markers", outfile="test.raw")
Reading genotypes from file 'test_markers' ...
Writing to file 'test.raw' ...
... done.
> test = load.gwaa.data(pheno="test_phenos", geno="test.raw", force=T)
ids loaded...
marker names loaded...
chromosome data loaded...
map data loaded...
allele coding data loaded...
strand data loaded...
genotype data loaded...
snp.data object created...
assignment of gwaa.data object FORCED; X-errors were not checked!
> attach(phdata(test))
> descriptives.trait(data=test, by = bt)
Error in t.test.formula(ctrao ~ svar) :
  grouping factor must have exactly 2 levels
Error in kruskal.test.default(c(6L, 32L, 35L, 33L, 52L, 25L), c(1L, 1L,  :
  all observations are in the same group
    No(by.var=0) Mean    SD No(by.var=1)   Mean     SD   Ptt   Pkw Pexact
id             5   NA    NA            6     NA     NA    NA    NA     NA
sex            5  0.2 0.447            6  0.333  0.516 0.657 0.637      1
age            0  NaN    NA            6 30.500 14.977    NA    NA     NA
bt             5   NA    NA            6     NA     NA    NA    NA     NA
>
>






-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch_descriptives.trait
Type: application/octet-stream
Size: 5753 bytes
Desc: not available
URL: <http://lists.r-forge.r-project.org/pipermail/genabel-devel/attachments/20110325/840ba672/attachment.obj>


More information about the genabel-devel mailing list