Answers.Body: <p>You can use <code>--pheno</code> 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. <code>--make-pheno</code> 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.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-02-18T02:29:35.570Z
Answers.Text: 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.
Answers.UserDisplayName: MHiller
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-02-18T03:12:56.977Z
Answers.Text: Sure, by BED files I mean the PLINK BED format, which includes the three files types, not the `.bed` file.
Answers.UserDisplayName: Phoenix Mu
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-02-18T00:29:05.007Z
Answers.LastActivityDate: 2021-02-18T00:29:05.007Z
Answers.UserDisplayName: Phoenix Mu
Body: <p>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</p>
  <p><code>plink --vcf file.vcf.gz --make-bed --out out</code></p>
  <p>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 <code>--pheno</code> flag that allows specifying a txt file for the phenotypes and a <code>--make-pheno</code> flag that can be used for the same effect.</p>
  <p>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</p>
  <p><code>plink --vcf file --pheno phenotype_file --make_bed --out out_file</code></p>
  <p>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?</p>
  <p>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.</p>
  <p>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?).</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-02-17T14:43:27.320Z
Comments.Text: cross-posted https://www.biostars.org/p/491146/
Comments.UserDisplayName: user438383
Tags: <vcf><gwas><plink>
Title: Making PLINK compatible files from VCF file without phenotype information
ThreadText: # Making PLINK compatible files from VCF file without phenotype information
  
  (Asked by: username_0 on 2021-02-16)
  
  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?).
  
  **Tags:** vcf, gwas, plink
  
  > **Comments:**
  > **username_1**: cross-posted https://www.biostars.org/p/491146/  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2021-02-18. Score: 2
  
  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.
  
  > **Comments:**
  > **username_0**: 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.  
  > **username_2**: Sure, by BED files I mean the PLINK BED format, which includes the three files types, not the `.bed` file.  
  
  ---
  
  