zhengxwen / SeqArray

Data management of large-scale whole-genome sequence variant calls (Development version only)
http://www.bioconductor.org/packages/SeqArray
43 stars 12 forks source link

"push+intersect" does not behave as expected #20

Closed smgogarten closed 7 years ago

smgogarten commented 7 years ago

Using seqSetFilter with action="push+intersect" does not apply the intersection with the previous filter. "intersect" alone has the correct behavior:

> seqSetFilter(gds, variant.id=1:100)
# of selected variants: 100
> seqSetFilter(gds, variant.id=51:110, action="intersect")
# of selected variants: 50

But "push+intersect" does not:

> seqSetFilter(gds, variant.id=1:100)
# of selected variants: 100
> seqSetFilter(gds, variant.id=51:110, action="push+intersect")
# of selected variants: 60
smgogarten commented 7 years ago

What is the intended use of "push" and "push+intersect"?

zhengxwen commented 7 years ago

I will check seqSetFilter().

The action="pop" and action="push" in seqSetFilter() allow that users temporarily store the filters without copying the filters to a new variable. E.g. define a function with variant.id input:

your_function <- function(gds, sel.variant)
{
    seqSetFilter(gds, variant.id=sel.variant, action="push+set")
    on.exit({ seqSetFilter(gds, action="pop") })

    # your codes
    ...
}
zhengxwen commented 7 years ago

fix it with the last github commit.