magnusdv / forrel

Forensic pedigree analysis and relatedness inference
GNU General Public License v2.0
10 stars 0 forks source link

readFam problem #32

Closed thoree closed 4 years ago

thoree commented 4 years ago

After quite a bit of testing I manage to to find a problem:

x = forrel::readFam("http://familias.name/foo.fam")
#> Familias version: 3.2.9 (DVI)
#> Read DVI: Yes
#> 
#> Number of individuals (excluding 'extras'): 0
#> 
#> Number of pedigrees: 0
#> 
#> Database: New database
#> Number of loci: 1
#>   D3S1358: 9 alleles, model = equal, rate = 0 (unisex)
#> 
#> *** Reading DVI section ***
#> Unidentified persons: 2
#>   BS1
#>   BS2
#> 
#> Reference families: 1
#>   F14 (3 persons, 2 pedigrees)
#>     Reference pedigree
#> Error in this.fidx[child.idx[par.is.male]] <- parent.idx[par.is.male]: NAs are not allowed in subscripted assignments

Created on 2020-02-12 by the reprex package (v0.3.0)

magnusdv commented 4 years ago

Thanks! This error is interesting, and I'm not sure if it can be fixed.

The file specifies that "Missing person" is a parent of "RS31 [Son]", but with no sex information about "Missing person". Hence the program runs into a problem when trying to decide if it is the father or mother.

Note that such "extra" individuals are ok as children, because then the gender info is not needed to create the pedigree.

I'm not really sure how to deal with this, but at least I'll add a more sensible error message.

magnusdv commented 4 years ago

Ok, I've pushed a partial fix for this, see daecbbf .

The new code uses tries to deduce the sex of "nosex-parents" by looking at spouses, and fails gracefully if unsuccessful.

I think this is the closest we can get to a solution here, but further ideas are welcome. (Closing this now.)