File Conversion from VCF to .bed format (goal is to use it in the admixture)

920 views
Skip to first unread message

Safiqul Islam

unread,
Feb 5, 2021, 5:41:31 AM2/5/21
to plink2-users
Dear All
I am new plink user. 
I am trying to convert vcf file to bed format. command was  plink --vcf M29F30_BiSnps.recode.vcf --make-bed --recode --write-covar --out ./; and it looks it worked. But of course sex information was not there because i did not add then, Could you please suggest how can I specify the sex information (Male=ZZ and Female ZW), I tried via text file like this, definitely this wrong. could you please suggest me how can I add sex information in ped file. 
L63604 male
L63605 Female 
L63591 male
L63592 male
L63600 male
L63601 male
L57007 male
L63620 male

Thank you in an advance 
best
Safz

Christopher Chang

unread,
Feb 5, 2021, 11:00:48 AM2/5/21
to plink2-users
See the --update-sex flag.

Chris Chang

unread,
Feb 5, 2021, 2:41:58 PM2/5/21
to Safiqul Islam, plink2-users
If you want to use a single ID column with plink --update-sex:
* Use plink 2.0 instead of plink 1.9.
* Add a "#IID SEX" header column to your --update-sex file.

Then,

  "plink2 --vcf M29F30_BiSnps.record.vcf --update-sex <sex info file> --make-bed --out ..."

should work.

On Fri, Feb 5, 2021 at 11:32 AM Safiqul Islam <safi...@gmail.com> wrote:
Dear Chang

I am trying to update the sex information but i did not get couple of things.

my pop file is like this 

L63604 M
L63605 F
L63591 M
L63592 M
L63600 M

but manual says i have to add two more columns of FIDs and IIDs, I dont get what I have to add here.
could you please suggest a sample pop file please or reply to this email please.

best
Safi



On Fri, Feb 5, 2021 at 8:28 PM Safiqul Islam <safi...@gmail.com> wrote:
D

--update-sex expects a file with FIDs and IIDs in the first two columns, and sex information (1 or M = male, 2 or F = female, 0 = missing) in the (n+2)th column

--
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/afad7a57-6479-421c-9a0a-6cb41844ddebn%40googlegroups.com.


--
Safiqul Islam
Founder & CEO, wildmentor (http://www.wildmentor.org/)
Scientific Assistant at Senckenberg Naturhistorische Sammlungen Dresden (http://www.senckenberg.de/)
Doctoral Student (Phylogeography-Ornithology) at Ludwig-Maximilians-Universität München (http://www.uni-muenchen.de/)



--
Safiqul Islam
Founder & CEO, wildmentor (http://www.wildmentor.org/)
Scientific Assistant at Senckenberg Naturhistorische Sammlungen Dresden (http://www.senckenberg.de/)
Doctoral Student (Phylogeography-Ornithology) at Ludwig-Maximilians-Universität München (http://www.uni-muenchen.de/)

Christopher Chang

unread,
Feb 5, 2021, 2:43:39 PM2/5/21
to plink2-users
oops, "header column" should be "header line".  Anyway, your --update-sex file should look something like

#IID  SEX
L63604  M
L63605  F
L63591  M
L63592  M
L63600  M
...

Chris Chang

unread,
Feb 5, 2021, 3:45:36 PM2/5/21
to Safiqul Islam, plink2-users
1. Again, you need to use plink 2.0 (so your command line should start with "plink2 ..." instead of "plink ...") for the single-ID-column --update-sex file to work.

2. Since you are working with a nonhuman chromosome set, you need to use the --chr-set flag to describe the chromosome set.

On Fri, Feb 5, 2021 at 12:38 PM Safiqul Islam <safi...@gmail.com> wrote:
Dear Chang
sorry for disturbing you, Really sorry.

My command was like this: $ plink --vcf M29F30_BiSnps.recode.vcf --update-sex ./SexInfo-M1-F2.txt --make-bed --out ./

Population file was like this.
#IID SEX
L63604 M
L63605 M
L63608 M
L63609 M
L56980 M

For the chromosome: I want to modify only sex chromosomes.
Inside the vcf file sex chromosome X=29 and Y=30.

I got this error. Could you please suggest to me how I can fix it.

Output was

Logging to ./.log.

Options in effect:

  --make-bed

  --out ./

  --update-sex ./SexInfo-M1-F2.txt

  --vcf M29F30_BiSnps.recode.vcf


16384 MB RAM detected; reserving 8192 MB for main workspace.

Error: Invalid chromosome code '29' on line 12 of .vcf file.

(This is disallowed for humans.  Check if the problem is with your data, or if

you forgot to define a different chromosome set with e.g. --chr-set.)


Thanks a lot for your kind help. I spent couple of days to solve this issue,you are really great , Thanks a lot for your help

best

Safi



Chris Chang

unread,
Feb 5, 2021, 4:07:23 PM2/5/21
to Safiqul Islam, plink2-users
Actually, the biggest issue here is that I forgot to mention that you need to REVERSE male/female if you want plink to work with species with ZW sex-determination.  Sorry about that; hopefully this isn't too much of a pain.

After you have done that in your --update-sex file, "--chr-set 28" should work.  This makes 29 get treated as chrX and 30 get treated as chrY... which ends up working the same way as 29=Z, 30=W if the sexes are reversed.

On Fri, Feb 5, 2021 at 12:59 PM Safiqul Islam <safi...@gmail.com> wrote:
Dear Chang

I read the that looks really complex to me. I am working with birds. for the birds Male ZZ and females has ZW.
I am using ref based genome. here I am only using sex chromosomes. and Chromosome number 29=ZZ and 30=ZW

plink2 --vcf M29F30_BiSnps.recode.vcf --update-sex ./SexInfo-M1-F2.txt --chr-set --make-bed --out ./



what I should specify here "--chr-set " after this please please help. 

thank you in an advance 


Reply all
Reply to author
Forward
0 new messages