Closed luceamso closed 2 years ago
I wanted to extract variants shared by all patient
I'll assume that "patient" means affected, so you want variants where affected samples are het or hom_alt. in which case, you simply need:
--family-expr 'aff:fam.every(function(s) {return !s.affected || ((s.het || s.hom_alt) && s.affected && s.GQ >= 20) })'
Thanks for the quick reply. You're right. 'patient' means 'affected' It worked perfectly. Unfortunately I didn't understand how that code works. Could you please explain?
!s.affected
means return true for any unaffected sample. so those are ignored. the rest:
(s.het || s.hom_alt) && s.affected && s.GQ >= 20
requires the affected samples to be het or hom_alt and have a GQ >= 20.
Sorry for all question. Why return if unaffected is ignored?
the function is fam.every
that means that it will only pass if the expression returns true for every member in the family. You could also do:
return S.GQ >= 20 \ # all samples have GQ >= 20
&& (
(!s.affected && s.hom_ref) \ # unaffected samples are hom_ref
||
((s.het || s.hom_alt) && s.affected) \ # affected samples are het or hom_alt
)
(note you must remove the "# ... " if you want to try that expression.
Thank you for your kindness. It really helped a lot!
Hi, thanks again for this useful tool.
I wanted to extract variants shared by all patients, so I tried several times, but didn't get the results I wanted. This is the code that produced similar results.
How can I get the results I want? I would highly appreciate if you could have a look. Thank you so much! Seoon