OpenMendel / MendelKinship.jl

This analysis option computes kinship and other identity coefficients.
MIT License
1 stars 1 forks source link

ArgumentError: Person 5101360 is his or her own ancestor. #9

Open fingerfen opened 3 years ago

fingerfen commented 3 years ago

Background I have a pedigree file with roughly 35,000 rows and around 700 families. The file looks something like this

...
fam20,5101470,5101420,5101410,M,0
fam20,5101340,,,F,0
fam20,5101350,5101340,5101250,M,0
fam20,5101360,5101340,5101250,F,0                        <---- Error refers to this line
fam20,5101370,,,F,0
fam20,5101380,5101370,5101260,F,0
fam20,5101390,,,F,0
fam20,5101400,5101390,5101270,F,0
...

Issue

The command I used to calculate the theoretical kinship matrix is

Kinship("C.../.../filepath...bla..bla.bla...../.../control.txt")

but it throws ArgumentError: Person 5101360 is his or her own ancestor error

I checked my pedigree file and saw that this is person is NOT his or her own ancestor. This person's ID appears once in the Person column of the entire pedigree file and that's it. So there is no way that this person is his or her own ancestor.

I am wondering if I can get some insight into the error and maybe figure out why it's throwing this error. Is there maybe a file size limit to the program?

Thank you,

fingerfen commented 3 years ago

The Stacktrace is as followed:

Stacktrace:
 [1] person_information(::DataFrames.DataFrame, ::DataFrames.DataFrame, ::DataFrames.DataFrame, ::MendelBase.Locus, ::MendelBase.Pedigree, ::Dict{AbstractString,Any}) at C:\Users\duong\.julia\packages\MendelBase\y8mGn\src\read_data.jl:1635
 [2] read_external_data_files(::Dict{AbstractString,Any}) at C:\Users\duong\.julia\packages\MendelBase\y8mGn\src\read_data.jl:98
 [3] Kinship(::String; args::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{,Tuple{}}}) at C:\Users\duong\.julia\packages\MendelKinship\UUNNi\src\MendelKinship.jl:83
 [4] Kinship(::String) at C:\Users\duong\.julia\packages\MendelKinship\UUNNi\src\MendelKinship.jl:35
 [5] top-level scope at In[47]:1
 [6] include_string(::Function, ::Module, ::String, ::String) at .\loading.jl:1091
 [7] execute_code(::String, ::String) at C:\Users\duong\.julia\packages\IJulia\rWZ9e\src\execute_request.jl:27
 [8] execute_request(::ZMQ.Socket, ::IJulia.Msg) at C:\Users\duong\.julia\packages\IJulia\rWZ9e\src\execute_request.jl:86
 [9] #invokelatest#1 at .\essentials.jl:710 [inlined]
 [10] invokelatest at .\essentials.jl:709 [inlined]
 [11] eventloop(::ZMQ.Socket) at C:\Users\duong\.julia\packages\IJulia\rWZ9e\src\eventloop.jl:8
 [12] (::IJulia.var"#15#18")() at .\task.jl:356

I am not familiar with Julia so, sadly, I don't really understand this.

biona001 commented 3 years ago

I'm sure @ericsobel has a better idea of how to help you, but I'll try to explain what's going on.

According to your stack trace, the error is a result of this line in MendelBase.jl. To reach this error, the per variable returned by this loop function is non-zero, which can only happen via this line. The loop() function appears to be a complicated way of permuting your pedigree. My best guess is that it is somehow impossible to rearrange your pedigree so that all parents precede their children + everything the loop() function needs to do. If this is the case, the printed error message needs to be updated.

Do you think you can upload your data and control file so I can play with it?

fingerfen commented 3 years ago

Thank you for the quick reply and the thorough explanation, it is very much appreciated! :)

There is an important observation that I think you might be interested in.

As seen from above, fam20 is the pedigree that has the erroneous entry. If I was to toss out fam20 from my entire pedigree file, and run the command again, the same error would happen, but for a different person from a different family. Interestingly, if I was to put fam20 into its own pedigree file, the program runs fine and was actually able to produce a kinship matrix output file.

This tells me that there doesn't seem to be anything wrong with fam20's pedigree itself, but maybe it has something to do with the combination of different pedigrees.

Is this piece of information useful to you?

Sadly, I don't think I can provide you with the pedigree file since this data is private as of now.

Thank you

biona001 commented 3 years ago

I will have to consult my advisors who know more about the loop function to better understand what might cause the issue. I will try to get back to you asap.