swap instead of flip by plink

480 views
Skip to first unread message

Tomas K

unread,
Feb 9, 2016, 10:18:50 AM2/9/16
to plink2-users
Hi All, 

Is it possible to swap instead of flipping the SNPs by Plink? 
For example: 
rs123:  AG -> GA
rs234:  CT -> TC 

Thank you!!

Christopher Chang

unread,
Feb 9, 2016, 11:06:45 AM2/9/16
to plink2-users
This isn't built into plink, but it shouldn't be too difficult to write a Python/Perl script to do this since only the .bim file needs to be processed.

Tomas Keller

unread,
Feb 9, 2016, 1:32:58 PM2/9/16
to Christopher Chang, plink2-users
Great! Thanks so much!

--
You received this message because you are subscribed to a topic in the Google Groups "plink2-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/plink2-users/d1NaMvcacAw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to plink2-users...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Till Andlauer

unread,
Feb 10, 2016, 3:45:26 AM2/10/16
to Tomas Keller, Christopher Chang, plink2-users
I would suggest to use the --reference-allele option and a file listing
SNPs and forced reference alleles.

Best,
Till

On 09.02.2016 19:32, Tomas Keller wrote:
> Great! Thanks so much!
>
> On 9 February 2016 at 17:06, Christopher Chang <chrch...@gmail.com
> <mailto:chrch...@gmail.com>> wrote:
>
> This isn't built into plink, but it shouldn't be too difficult to
> write a Python/Perl script to do this since only the .bim file needs
> to be processed.
>
>
> On Tuesday, February 9, 2016 at 7:18:50 AM UTC-8, Tomas K wrote:
>
> Hi All,
>
> Is it possible to swap instead of flipping the SNPs by Plink?
> For example:
> rs123: AG -> GA
> rs234: CT -> TC
>
> Thank you!!
>
> --
> You received this message because you are subscribed to a topic in
> the Google Groups "plink2-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/plink2-users/d1NaMvcacAw/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> plink2-users...@googlegroups.com
> <mailto:plink2-users...@googlegroups.com>.
> For more options, visit https://groups.google.com/d/optout.
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "plink2-users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to plink2-users...@googlegroups.com
> <mailto:plink2-users...@googlegroups.com>.

Christopher Chang

unread,
Feb 12, 2016, 2:02:33 PM2/12/16
to plink2-users, tomas....@gmail.com, chrch...@gmail.com, till_a...@psych.mpg.de
Oh, it looks like I misinterpreted Tomas's question.  For some reason I thought he was referring to allele codes with 2 bases, which makes no sense upon rereading.

The important thing to realize here is that, if you change the allele order, PLINK 1.07 and 1.9 will *always try to change it back to major/minor*.  On every single run where the allele order matters, you need to tell PLINK 1.x not to do this (with e.g. --reference-allele, --a2-allele, or --keep-allele-order).

(PLINK 2.0 will eliminate this headache, but a significant amount of backward compatibility will be lost in the process.)


On Wednesday, February 10, 2016 at 12:45:26 AM UTC-8, Till Andlauer wrote:
I would suggest to use the --reference-allele option and a file listing
SNPs and forced reference alleles.

Best,
Till

On 09.02.2016 19:32, Tomas Keller wrote:
> Great! Thanks so much!
>
> On 9 February 2016 at 17:06, Christopher Chang wrote:
>
>     This isn't built into plink, but it shouldn't be too difficult to
>     write a Python/Perl script to do this since only the .bim file needs
>     to be processed.
>
>
>     On Tuesday, February 9, 2016 at 7:18:50 AM UTC-8, Tomas K wrote:
>
>         Hi All,
>
>         Is it possible to swap instead of flipping the SNPs by Plink?
>         For example:
>         rs123:  AG -> GA
>         rs234:  CT -> TC
>
>         Thank you!!
>
>     --
>     You received this message because you are subscribed to a topic in
>     the Google Groups "plink2-users" group.
>     To unsubscribe from this topic, visit
>     https://groups.google.com/d/topic/plink2-users/d1NaMvcacAw/unsubscribe.
>     To unsubscribe from this group and all its topics, send an email to
>     For more options, visit https://groups.google.com/d/optout.
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "plink2-users" group.
> To unsubscribe from this group and stop receiving emails from it, send

Tomas Keller

unread,
Feb 12, 2016, 4:11:44 PM2/12/16
to Christopher Chang, plink2-users, till_a...@psych.mpg.de
I also realized that. I tried just swapping, but MAF won't change of those snps. Thanks for the tip!

>     For more options, visit https://groups.google.com/d/optout.
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "plink2-users" group.
> To unsubscribe from this group and stop receiving emails from it, send

Tomas Keller

unread,
Feb 17, 2016, 10:04:16 AM2/17/16
to Christopher Chang, plink2-users, till_a...@psych.mpg.de
Is there an easy way to convert .bim bed fam files to a matrix which contains only numbers (0, 1, 2) , taking --reference-allele into account? The R package GenABEL can do this job, however, it only considers the minor allele as dataset specific. 

Tomas Keller

unread,
Feb 17, 2016, 10:59:51 AM2/17/16
to Christopher Chang, plink2-users, till_a...@psych.mpg.de
By using plink --recodeA --reference-allele it works. 
Reply all
Reply to author
Forward
0 new messages