brentp / slivar

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

group alias description for multiple alleles #76

Open vdejager opened 3 years ago

vdejager commented 3 years ago

I'm trying to find differing alleles in a proband with multiple unaffected siblings My alias file looks as follows:

#proband    sibling
s1    s2,s3,s4

with my group expression as

--group-expr "affected:proband.alts==1 && sibling.alts==0 && proband.DP>10 && sibling.DP>10"

I'm getting the error:Error: unhandled exception: slivar/groups:got > 1 sample in line........

It seems to work if I change the alias file to

#proband    sibling    sibling    sibling
s1    s2    s3    s4

However, I don't know it only the first sibling is used in this case.

vdejager commented 3 years ago

never mind. I found that I should call the column siblings, similar to the multi generation pedigree example. Any other hints are welcome though, maybe a better group expression to find any differing variants between the proband and siblings. (unfortunately we do not have parents in this case)

brentp commented 3 years ago

yes so with siblings you can do:

--group-expr 'interesting:s.het  && s.GQ > 20 && siblings.every(function(s) { return s.GQ > 20 && s.hom_ref })

if you describe more what you're tring to do, we can make the expression more specific.

axz91 commented 1 year ago

similar issue, i have multiple f1affs, f2affs, but this seems not working

"got:mom.alts == 1 && dad.alts == 1 && f1affs.alts == 2 && f1naff.alts == 1 && f2affs.alts == 2"

brentp commented 1 year ago

@axz91 can you show your groups/alias file, the full slivar command and the error you are seeing?

brentp commented 1 year ago

so if the column ends with "s" as in f1affs, then it will be treated as a javascript array. And you can add multiple samples to that group using a "," in that column. I think that simplest way is to remove the "s" from the groups file and your expressions, but you could also do something like:

"got:mom.alts == 1 && dad.alts == 1 && f1affs.every(function(s) { return s.alts == 0}) && f1naff.alts == 1 && f2affs.every(function(s) { return s.alts == 0 })"

without changing your groups file.

brentp commented 1 year ago

note that I just typed that into the github text area, so you'll probably need to adjust the exact expression.

brentp commented 1 year ago

also, you can see why this didn't work once you know that s columns are treated as arrays because:

a = [];
console.log(a.alts == 0)

gives false.

brentp commented 1 year ago

now your groups header looks like this:

#dad    mom f1aff   f1aff   f1naff  f2aff   f2aff   f2aff   f2aff

you can't have repeated column headers as those are used to address a single column.