Question: PLINK: filter for indels
0
gravatar for bsmith030465
3 months ago by
bsmith030465150
United States
bsmith030465150 wrote:

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 • 292 views
ADD COMMENTlink modified 3 months ago by zx87547.9k • written 3 months ago by bsmith030465150
3
gravatar for chrchang523
3 months ago by
chrchang5235.5k
United States
chrchang5235.5k wrote:

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 COMMENTlink written 3 months ago by chrchang5235.5k

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 REPLYlink written 3 months ago by bsmith030465150
  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 REPLYlink written 3 months ago by chrchang5235.5k

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 REPLYlink written 3 months ago by bsmith030465150
  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 REPLYlink modified 3 months ago • written 3 months ago by chrchang5235.5k

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

ADD REPLYlink written 3 months ago by bsmith030465150
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1302 users visited in the last hour