0
$\begingroup$

I have a big VCF file that I need to convert to, preferably, bed/bim/fam files that are readable by plink. Currently using plink 2. I am aware that this version of plink can be used to convert VCFs into binary peds using

plink --vcf file.vcf.gz --make-bed --out out

Or something similar. I also know that in this case, plink will automatically fill the phenotype and sex columns in the bed and fam files with zeros. I know there is a --pheno flag that allows specifying a txt file for the phenotypes and a --make-pheno flag that can be used for the same effect.

How exactly does this work? How can I encode the phenotype and sex information correctly? Can I just use --make-bed and then manually make a phenotype/sex file to use down the line with the --pheno flag? Or would I do something like

plink --vcf file --pheno phenotype_file --make_bed --out out_file

directly? In this case, will there not be a problem with the fact that the generated .bed in the first step does not have this information? What about with sex?

Another option I can think of is just edit the generated .fam to include the correct information and use it downstream, but that information will still not be in the .bed file.

I have no family relationships, so the FID fields would just be 0s (I guess I can add the --const-fid flag for that effect when I'm converting, right?).

$\endgroup$
1
1
$\begingroup$

You can use --pheno to specify a phenotype file you want to use, the 1st and 2nd columns being FID and IID. These are just used on the fly and cannot be written to the BED files as I understand. --make-pheno is used to write binary phenotypes, which is unsuitable if your phenotype is actually continuous. But I still do not quite understand what you want to do here.

$\endgroup$
2
  • $\begingroup$ I was thinking about the .ped file, not the .bed, hence the confusion. The .bed contains only information about the SNPs (unlike the .ped). Everything working fine now. $\endgroup$
    – MHiller
    Feb 18 at 2:29
  • $\begingroup$ Sure, by BED files I mean the PLINK BED format, which includes the three files types, not the .bed file. $\endgroup$
    – Phoenix Mu
    Feb 18 at 3:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.