Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Repeatedly filtering Plink files based on integer indices #41

Open
kose-y opened this issue Jun 13, 2019 · 2 comments
Open

Repeatedly filtering Plink files based on integer indices #41

kose-y opened this issue Jun 13, 2019 · 2 comments

Comments

@kose-y
Copy link
Member

kose-y commented Jun 13, 2019

When using filter() with integer indices multiple times, the result is overwritten on the existing filtered SnpArray.

versioninfo()
Julia Version 1.0.1
Commit 0d713926f8 (2018-09-29 19:05 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
  CPU: Intel(R) Xeon(R) CPU E5-2680 v2 @ 2.80GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-6.0.0 (ORCJIT, ivybridge)
const mouse = SnpArray(SnpArrays.datadir("mouse.bed"))
s0 = SnpArrays.filter(SnpArrays.datadir("mouse"), 1:2, 1:5)
s0
2×5 SnpArray:
 0x02  0x02  0x02  0x02  0x03
 0x02  0x02  0x03  0x02  0x02
s1 = SnpArrays.filter(SnpArrays.datadir("mouse"), 1:2, 1:3)
s2 = SnpArrays.filter(SnpArrays.datadir("mouse"), 1:2, 4:5)
#s3 = SnpArrays.filter(SnpArrays.datadir("mouse"), 3:4, 1:3);
s1
2×3 SnpArray:
 0x02  0x03  0x00
 0x02  0x02  0x00
s2
2×2 SnpArray:
 0x02  0x03
 0x02  0x02
s0
2×5 SnpArray:
 0x02  0x03  0x00  0x00  0x00
 0x02  0x02  0x00  0x00  0x00
@biona001
Copy link
Member

biona001 commented Jun 13, 2019

One workaround is to make a copy in memory:

s0 = copy(SnpArrays.filter(SnpArrays.datadir("mouse"), 1:2, 1:5))
s1 = SnpArrays.filter(SnpArrays.datadir("mouse"), 1:2, 1:3)
s2 = SnpArrays.filter(SnpArrays.datadir("mouse"), 1:2, 4:5)
julia> s0
2×5 Array{UInt8,2}:
 0x02  0x02  0x02  0x02  0x03
 0x02  0x02  0x03  0x02  0x02

Though I'm not sure if this is expected behavior..

@kose-y
Copy link
Member Author

kose-y commented Jun 13, 2019

Oh, I got it. The destination file (default argument is used) is unchanged for each filtering. Maybe we can change the default name each time the filter function is called?

@kose-y kose-y changed the title [BUG] filtering Plink files based on integer indices Repeatedly filtering Plink files based on integer indices Jun 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants