Body: <p>I would like to get a pca plot from the multiple sequence alignment (fasta file). I extracted snps in vcf format using snp-sites program.</p>
  <pre><code>snp-sites -v -o output.vcf alignment.fasta
  </code></pre>
  <p>SNPRelate package was used to get a pca plot from the vcf file</p>
  <pre class="lang-r prettyprint-override"><code>library(gdsfmt)
  library(SNPRelate)
  
  vcf.fn &lt;- &quot;C:/users/downloads/output.vcf&quot;
  snpgdsVCF2GDS(vcf.fn, &quot;test.gds&quot;, method=&quot;biallelic.only&quot;)
  snpgdsSummary(&quot;test.gds&quot;)
  
  The total number of samples: 266 
  The total number of SNPs: 0 
  SNP genotypes are stored in SNP-major mode (Sample X SNP)
  
  genofile &lt;- openfn.gds(&quot;test.gds&quot;)
  test_pca&lt;-snpgdsPCA(genofile)
  Hint: it is suggested to call `snpgdsOpen' to open a SNP GDS file instead of `openfn.gds'.
  Principal Component Analysis (PCA) on genotypes:
  Excluding 0 SNP on non-autosomes
  Error in .InitFile2(cmd = &quot;Principal Component Analysis (PCA) on genotypes:&quot;,  : 
    There is no SNP!
  </code></pre>
  <p>How do I resolve this error? or Any other methods available to get a PCA plot from the alignment file?</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2024-10-07T10:31:06.727Z
Comments.Text: What is the error? You have no SNPs in your input so cannot do any analysis on SNPs. For more help, you will need to edit your question and explain what you are doing in more detail. What are you aligning here? Do you have any data in the vcf?
Comments.UserDisplayName: terdon
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2024-10-08T00:35:42.183Z
Comments.Text: Please show the first few lines of your VCF file, especially the tiles that include genotypes.
Comments.UserDisplayName: gringer
Tags: <r><vcf><snp><pca><multi-fasta>
Title: pca plot from multiple sequence alignment
ThreadText: # pca plot from multiple sequence alignment
  
  (Asked by: username_0 on 2024-10-07)
  
  I would like to get a pca plot from the multiple sequence alignment (fasta file). I extracted snps in vcf format using snp-sites program.
  
  ```
  snp-sites -v -o output.vcf alignment.fasta
  
  ```
  
  SNPRelate package was used to get a pca plot from the vcf file
  
  ```r
  library(gdsfmt)
  library(SNPRelate)
  
  vcf.fn <- "C:/users/downloads/output.vcf"
  snpgdsVCF2GDS(vcf.fn, "test.gds", method="biallelic.only")
  snpgdsSummary("test.gds")
  
  The total number of samples: 266 
  The total number of SNPs: 0 
  SNP genotypes are stored in SNP-major mode (Sample X SNP)
  
  genofile <- openfn.gds("test.gds")
  test_pca<-snpgdsPCA(genofile)
  Hint: it is suggested to call `snpgdsOpen' to open a SNP GDS file instead of `openfn.gds'.
  Principal Component Analysis (PCA) on genotypes:
  Excluding 0 SNP on non-autosomes
  Error in .InitFile2(cmd = "Principal Component Analysis (PCA) on genotypes:",  : 
    There is no SNP!
  
  ```
  
  How do I resolve this error? or Any other methods available to get a PCA plot from the alignment file?
  
  **Tags:** r, vcf, snp, pca, multi-fasta
  
  > **Comments:**
  > **username_1**: What is the error? You have no SNPs in your input so cannot do any analysis on SNPs. For more help, you will need to edit your question and explain what you are doing in more detail. What are you aligning here? Do you have any data in the vcf?  
  > **username_2**: Please show the first few lines of your VCF file, especially the tiles that include genotypes.  
  
  ---
  
  ## 0 answers
  
  