recode pgen file to specific ref-alt

28 views
Skip to first unread message

Giulia Pontali

unread,
Jun 27, 2024, 10:22:28 AMJun 27
to plink2-users
Hi,
we write to you because we encountered some problems when we try to recode the pgen file to different reference allele (alphabetical order) and then when we compute the --freq, it seems that the actual code of pgen file is not updated. We were expecting that the new frequency would be updated when the alleles are flipped. 
We attach an example with the respective code that we used to illustrate the step and the problem. 

Please let us know if you have some suggestions to how we can proceed.
Thank you,
Giulia 

freq.xlsx

Chris Chang

unread,
Jun 27, 2024, 10:24:36 AMJun 27
to Giulia Pontali, plink2-users

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/plink2-users/d6c2bedb-4d31-4a27-8403-43312f7b191an%40googlegroups.com.

Giulia Pontali

unread,
Jun 27, 2024, 10:47:41 AMJun 27
to Chris Chang, plink2-users
Thank you for your reply, so basically to update the SNP ids, the alleles labels and recode genotypes do we need three steps?
1. Update SNP ids with --update-name:
plink2 \
--update-name {params.table_mapping} 1 2 \
--pfile {params.pfile} \
--make-pgen \
--out {params.prefix} \
--threads {resources.threads} \
--memory 1900 'require'
2. Update allele labels with --update-alleles:
plink2 \
--update-alleles {params.mapping_table_right_alleles} \
--make-pgen \
--pfile {params.pfile} \
--out {params.out_file} \
--threads {resources.threads} \
--memory 1900 'require'
3. Recode the pgen with --ref-allele:
plink2 \
--ref-allele {params.mapping_table_right_alleles} 1 4 \
--make-pgen \
--pfile {params.pfile} \
--out {params.out_file} \
--threads {resources.threads} \
--memory 1900 'require'
However when we compute the --freq from the last file we still have the freq related to the old effect allele.
Thank you for your advice

Chris Chang

unread,
Jun 27, 2024, 10:58:07 AMJun 27
to Giulia Pontali, plink2-users
You are probably misusing —update-alleles.

Giulia Pontali

unread,
Jun 27, 2024, 11:06:20 AMJun 27
to Chris Chang, plink2-users
So what do you suggest to do? When we update the alleles using --update-alleles (this works) then plink2 does not recode the genotype.

Chris Chang

unread,
Jun 27, 2024, 11:12:46 AMJun 27
to Giulia Pontali, plink2-users
More precisely, you probably shouldn’t use —update-alleles at all.  It is doing exactly what it is documented to do.  I already told you that you are using the wrong flag, and what flag(s) to be using INSTEAD, not IN ADDITION.

Giulia Pontali

unread,
Jun 27, 2024, 11:27:59 AMJun 27
to Chris Chang, plink2-users
Thank you.
Using the command that you suggest to me works, but the genotype still has not been updated.

plink2 \
--ref-allele snp_mapping_right_alleles_2.tsv 1 4 \
--alt1-allele snp_mapping_right_alleles_2.tsv 1 2 \
--make-pgen \
--pfile impute_recoded_selected_sample_filter_hq_var_new_id_alleles_2 \
--out 2_test \
--threads 8 \
--memory 1900 'require'

Chris Chang

unread,
Jun 27, 2024, 11:31:13 AMJun 27
to Giulia Pontali, plink2-users
Please provide a replicable example (could be a dataset with just one variant) of a genotype that you think should be updated, but isn’t.

Reply all
Reply to author
Forward
0 new messages