brentp / slivar

genetic variant expressions, annotation, and filtering for great good.
MIT License
248 stars 23 forks source link

multiplex pedigrees #80

Closed atimms closed 3 years ago

atimms commented 3 years ago

I have some pedigrees I wish to analyze that are over more than two generations or are more complex than simple trios or quads. When I run an expression such as:

--family-expr "aff_only:fam.every(function(s) { s.het == s.affected && s.GQ > 5 })"

I don't seem to get any impactful variants.

I just want an expression that would retrieve either all het or hom_alt variants in a pedigree (I don't want to filter by unaffected genotypes as there may be a carrier with incomplete penetrance.

Thanks for your time.

Andrew

brentp commented 3 years ago

be sure to use return inside your function. I make this mistake a lot too. so:

fam.every(function(s) { return s.het == s.affected && s.GQ > 5 })
atimms commented 3 years ago

Sorry, that was my fault for cutting and pasting the wrong thing, this was the expression I actually used.

--family-expr 'aff_het:fam.every(function(s) {return s.het == s.affected && s.GQ > 20 && s.AB > 0.20 == s.affected})'

I'm not sure why this returned no variants with the pedigree I tested i.e. the ped file was:

family_id name paternal_id maternal_id sex phenotype

LR05-203 LR05-203a1 LR05-203f1 LR05-203m 1 2 LR05-203 LR05-203a2 LR05-203f2 LR05-203m 2 2 LR05-203 LR05-203f1 -9 -9 1 1 LR05-203 LR05-203f2 -9 -9 1 1 LR05-203 LR05-203m -9 -9 2 1

brentp commented 3 years ago

In order for that inheritance to work, you'd need a de novo (the same variant) in both kids which should be quite rare. other than that, I don't see any problem with the expression.

I assume you've also considered a variant coming from the mom? or a compound het where each dad gave a potentially different allele and mom passed on the same impactful variant?

atimms commented 3 years ago

that's my mistake, I didn't want to look for de novo variants, but just variants that are het in all affected individuals. So that would find the variant where mom is a carrier, and the inheritance you mentioned I'd definitely be interested in.

how would I find those variants?

brentp commented 3 years ago

for the compound het from mom, just run slivar in trio mode with the comphet_side function in slivar-functions.js then run slivar compound-hets and look for genes in both kids. If you want to find variants that are het in the kids and also the mom, you can do:

i think for your single variant expression, to just find variants that are het in affected samples (and GQ > 20 in all samples):

(s.unaffected && s.GQ > 20) || (s.affected && s.het && s.GQ > 20 && s.AB > 0.2)

you can also get to the mom from an affected sample so you could check e.g.:

(s.unaffected && s.GQ > 20) || (s.affected && s.het && s.GQ > 20 && s.AB > 0.2 && s.mom.het)

to check that the variant came from (unaffected mom).

atimms commented 3 years ago

when I run: --family-expr 'aff_het:fam.every(function(s) {return (s.unaffected && s.GQ > 20) || (s.affected && s.het && s.GQ > 20 && s.AB > 0.2)})'

I get the following error:

[slivar] javascript error. this can some times happen when a field is missing. error from duktape: unknown attribute:unaffected for expression:fam.every(function(s) {return (s.unaffected && s.GQ > 20) || (s.affected && s.het && s.GQ > 20 && s.AB > 0.2)})

Have I got the format incorrect somehow.

Thanks for your time.

Andrew

brentp commented 3 years ago

oops. s.unaffected doesn't exist. it is:

--family-expr 'aff_het:fam.every(function(s) {return (!s.affected && s.GQ > 20) || (s.affected && s.het && s.GQ > 20 && s.AB > 0.2)})'
atimms commented 3 years ago

thank you.

unfortunately I still see 0 variants using that expression:

sample aff_het comphet_side LR05-203a1 0 757 LR05-203a2 0 757 LR05-203f2 0 0 LR05-203m 0 0

It doesn't make sense that there wouldn't be any variants that are shared by these half siblings. Is the expression still taking into account the genotype of the parents somehow?

brentp commented 3 years ago

hmm. maybe i'm missing something about the expression. can you try removing parts until you get some variants (starting with the s.AB criteria)? is this a GATK VCF?

atimms commented 3 years ago

this is a GATK vcf, and processed in same way as the 100s of trios, duos and singletons that run well through slivar over the last few weeks.

I tried:

"aff_het:fam.every(function(s) {return (s.affected && s.GQ > 20) || (s.affected && s.het)})"

and

"aff_het:fam.every(function(s) {return (s.affected && s.het)})"

but still no variants.

Andrew

brentp commented 3 years ago

be careful, because:

"aff_het:fam.every(function(s) {return (s.affected && s.GQ > 20) || (s.affected && s.het)})"

cant work. you're missing a ! in one of those. likewise:

"aff_het:fam.every(function(s) {return (s.affected && s.het)})"

would require everyone to be het and affected.

brentp commented 3 years ago

also note that your shell will sometimes interpret ! and mess up the command unless you use single quotes.

brentp commented 3 years ago

I'm interested to hear if you got this working to your satisfaction.

atimms commented 3 years ago

I did, now for multiplex pedigrees I get a generic set of variants that can be subsequently filtered by either myself or the PIs I work with.

Thanks for your help.