filter SNPs at several ranges

117 views
Skip to first unread message

Peiyuan Zhu

unread,
Oct 15, 2023, 5:28:08 PM10/15/23
to plink2-users
I can understand the command from-bp to-bp but is it possible to filter the SNPs at several ranges if I have a table like this?

Would -snp 55013806 - 55100417, 55074849 - 55089200, ... work in this case?

Also is it possible to use a text file as input of ranges. This will be more convenient.


Screenshot 2023-10-15 at 2.24.36 PM.png

Peiyuan Zhu

unread,
Oct 15, 2023, 5:48:50 PM10/15/23
to plink2-users
Looks like snps only take in rsid. How to do it for position input only?

Christopher Chang

unread,
Oct 16, 2023, 11:41:17 AM10/16/23
to plink2-users
See the second sentence of the plink2 --extract documentation.
Message has been deleted

Peiyuan Zhu

unread,
Oct 16, 2023, 1:32:16 PM10/16/23
to plink2-users
--extract normally accepts one or more text file(s) with variant IDs (usually one per line, but it's okay for them to just be separated by spaces), and removes all unlisted variants from the current analysis. With the 'bed0' or 'bed1' modifier, the input file should be in 0-based or 1-based interval-BED format instead. For backward compatibility, 'range' is an alias for 'bed1'.

"With the 'bed0' or 'bed1' modifier, ..." is it what you're referring to?

Peiyuan Zhu

unread,
Oct 16, 2023, 1:38:19 PM10/16/23
to plink2-users
Still can't see why it's relevant, Could you explain a bit more?

Christopher Chang

unread,
Oct 16, 2023, 1:39:49 PM10/16/23
to plink2-users
You were asking how to use a "text file as input of ranges".

Peiyuan Zhu

unread,
Oct 16, 2023, 1:59:34 PM10/16/23
to plink2-users
I see. So I can only use bed files as input for this but not pgen?

Christopher Chang

unread,
Oct 16, 2023, 2:02:41 PM10/16/23
to plink2-users
No.  "BED" here refers to the "UCSC BED" interval file format, which is totally different from plink's .bed and .pgen formats.

"--extract bed0" works just fine with both plink2 .pgen and plink .bed files.

Reply all
Reply to author
Forward
0 new messages