magnusdv / pedtools

Tools for working with pedigrees in R
GNU General Public License v3.0
23 stars 3 forks source link

sorted output from getAlleles #13

Closed thoree closed 5 years ago

thoree commented 5 years ago

In the first case below getAlleles() output is not sorted according to the names of individuals, as expected. In the second case the output is sorted

# Case 1
library(pedtools)
x = nuclearPed(1, father = "a", mother ="b")
m = marker(x, a = 1, b = 2)
x = addMarkers(x, m)
getAlleles(x, c("b", "a"))
#>   na1.1 na1.2
#> b "2"   "2"  
#> a "1"   "1"

#Case 2
s1 = singleton(1)
s2 = singleton(2)
m1 = marker(s1, name =  "l1", "1" = 1)
s1 = addMarkers(s1,m1)
m2 = marker(s2, name = "l1", "2" = 2)
s2 = addMarkers(s2, m2)
getAlleles(list(s1,s2), ids = c("2", "1"))
#>   l1.1 l1.2
#> 1 "1"  "1" 
#> 2 "2"  "2"

Created on 2018-11-24 by the reprex package (v0.2.1)

magnusdv commented 5 years ago

Ok, thanks - I appreciate the clear/minimal reprex. This is closely related to, and should fixed together with, #14.