PLINK: filter for indels
2
0
Entering edit mode
5.6 years ago
bsmith030465 ▴ 240

Hi,

How do I filter my plink files so that only indels are kept? I used the following command to keep only snps:

plink --bfile myfile --snps-only --out myfile.snps

Which command/option should I use to retain only indels?

Thanks

plink • 6.8k views
ADD COMMENT
3
Entering edit mode
5.6 years ago

If your variant IDs are unique, this can be done in two steps: use --write-snplist + --snps-only in the first step, and then run --exclude on the .snplist file in the second step.

ADD COMMENT
0
Entering edit mode

Since my variants IDs weren't unique, I did some file processing to my snps output file (myfile.snps above) and got the snp ids that I want to exclude ('snp.pos.txt'):

1 10101 10101 10101
1 10493 10493 10493
1 10560 10560 10560
1 11994 11994 11994
.
.

and then I ran

plink --bfile myfile --exclude snp.pos.txt --out myfile.indels

However, this doesn't seem to exclude the positions. Is the formatting wrong? Each field is separated by whitespace as recommended in PLINK documentation...

ADD REPLY
0
Entering edit mode
  1. Variant IDs cannot contain spaces, so your snp.pos.txt really does not look like it does what you want it to do. plink 2.0's --set-all-var-ids flag provides a way to assign new position-based IDs to all your variants, if it's okay to throw away the old IDs.

  2. You need --make-bed in your last command to generate a new filtered fileset.

ADD REPLY
0
Entering edit mode

I am trying to exclude the 'range' of snps with this file format.

plink --bfile myfile --exclude snp.pos.txt --range --out myfile.indels --make-bed

but it says " Note: --range flag deprecated. Use e.g. '--extract range [filename]'."

It also gives an error if I use:

plink --bfile myfile --exclude range snp.pos.txt  --out myfile.indels --make-bed

I don't want to use plink2, because I can't seem to do other things (e.g. --mendel )

How should I set my options with plink 1.9?

Many thanks for all your help. I appreciate it!

ADD REPLY
0
Entering edit mode
  1. You can use plink2 for just —set-all-var-ids, and return to plink 1.x for the remaining steps.

  2. The problem with “—exclude range” here is that, when a SNP and an indel start from the same position, it’ll get rid of both; —set-all-var-ids at least makes it possible to get rid of only the indel in this case. With that said, don’t worry about the Note for now.

ADD REPLY
0
Entering edit mode

Thanks for the help and explanation. That worked! Much appreciated.

ADD REPLY

Login before adding your answer.

Traffic: 2053 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6