Answers.Body: <p>The issue here is we don't have access to all the files:
  Could you:</p>
  <ul>
  <li><p>Check the .ind file: <strong>1)</strong> Count the number of individuals in data_175k.ind. <strong>2)</strong> make sure its equal to the number of rows in output.pca.evec.txt (excluding the header line with #eigvals).</p>
  </li>
  <li><p>Check the .evec file structure: <strong>1)</strong> Count the columns in output.pca.evec.txt; <strong>2)</strong> make sure each row has exactly 12 columns: 10 eigenvectors + 1 individual name + 1 population label.</p>
  </li>
  </ul>
  <hr />
  <p>If the above draw a blank then try:</p>
  <p><code>sed '/#eigvals/d' output.pca.evec.txt &gt; output.pca.evec.new.txt</code></p>
  <p>and rerun.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-12-12T09:09:40.810Z
Answers.LastActivityDate: 2024-12-12T09:09:40.810Z
Answers.UserDisplayName: M__
Body: <p>I have genomic data for already converted in eigensoft format. Specifically I have SNP data for 5 populations and 1 outgroup. I ran <code>smartpca</code> with the following parameter file.</p>
  <pre><code>cat &gt; smartpca.txt &lt;&lt; EOF
  genotypename:    data_175k.geno
  snpname:         data_175k.snp
  indivname:       data_175k.ind
  evecoutname:     output.pca.evec.txt
  evaloutname:     output.pca.eval.txt
  EOF
  </code></pre>
  <p>I then ran it with <code>smartpca -p smartpca.txt  &gt; smartpca.out</code></p>
  <p>I then tried to use <code>smarteigenstrat</code> with the results of the PCA</p>
  <pre><code>cat &gt; smarteigenstrat.txt &lt;&lt; EOF
  genotypename:    data_175k.geno
  snpname:         data_175k.snp
  indivname:       data_175k.ind
  pcaname:         output.pca.evec.txt
  outputname:      chisq_output.txt
  EOF
  </code></pre>
  <p>When I try to run it with <code>smarteigenstrat -p smarteigenstrat.txt &gt; smarteigenstrat.out</code></p>
  <p>I get this error message</p>
  <blockquote>
  <p>OOPS: output.pca.evec.txt contains too many entries</p>
  </blockquote>
  <p>For now I mostly want to run it with default settings. The number of eigen vectors is 10 by default, so there are no changes there. Does anyone know why that happens and how can I make it run correctly?</p>
  <p>Edit: These are the contents of <code>output.pca.evec.txt</code></p>
  <pre><code>      #eigvals:     4.391     3.429     1.484     1.142     1.107     0.981     0.974     0.973     0.964     0.961 
           P.hispida_1    -0.0161     -0.1078      0.1818     -0.0443     -0.2926     -0.1196      0.0406      0.0527      0.0446     -0.0432             popA
           P.hispida_2    -0.0281     -0.1337      0.1914     -0.0709     -0.2925      0.3726     -0.5800      0.0402     -0.4827     -0.1949             popA
           P.hispida_3    -0.0221     -0.1295      0.2011     -0.0657     -0.3748     -0.6472     -0.2970     -0.0772      0.1109      0.3357             popA
           P.hispida_4    -0.0127     -0.1124      0.1788     -0.0354     -0.3433     -0.1252      0.5521     -0.2927     -0.0005     -0.4552             popA
           P.hispida_5    -0.0183     -0.1273      0.1864     -0.0660     -0.3589      0.5494      0.2612      0.2867      0.2953      0.2532             popA
           P.hispida_6    -0.0029     -0.1304     -0.0833     -0.4194      0.1788     -0.0247      0.0278      0.0471     -0.0084      0.0126             popB
           P.hispida_7    -0.0104     -0.1391     -0.0854     -0.3698      0.1794     -0.0270     -0.0018      0.0058     -0.0261     -0.0062             popB
           P.hispida_8    -0.0077     -0.1309     -0.0820     -0.2776      0.1648      0.0034     -0.0116     -0.0737      0.1122      0.0183             popB
           P.hispida_9    -0.0061     -0.1283     -0.0978     -0.3104      0.1419     -0.0148      0.0256      0.0250     -0.0344      0.0130             popB
          P.hispida_10    -0.0093     -0.1367     -0.0782     -0.2940      0.1339      0.0193      0.0299      0.0372      0.0194     -0.0182             popB
          P.hispida_11     0.0024     -0.1318     -0.3306      0.1962     -0.0435     -0.0359      0.0104      0.0124      0.0125      0.0252             popC
          P.hispida_12    -0.0012     -0.1431     -0.3360      0.2281     -0.0924     -0.0001     -0.0043     -0.0383      0.0322     -0.0160             popC
          P.hispida_13     0.0107     -0.1119     -0.2784      0.2172     -0.0422      0.0281      0.0113      0.0165      0.0724     -0.0427             popC
          P.hispida_14    -0.0068     -0.1496     -0.3176      0.1659     -0.0521      0.0092     -0.0443     -0.0285     -0.0648      0.0120             popC
          P.hispida_15     0.0015     -0.1351     -0.3253      0.2110     -0.0710      0.0112     -0.0150     -0.0021     -0.0787      0.0204             popC
          P.hispida_16     0.3355      0.2563      0.0095     -0.0029      0.0009      0.0003     -0.0060     -0.0009     -0.0084      0.0037             popD
          P.hispida_17     0.3134      0.2317      0.0038      0.0038     -0.0038      0.0049     -0.0018     -0.0023     -0.0040      0.0003             popD
          P.hispida_18     0.3268      0.2464      0.0030     -0.0047     -0.0006     -0.0004     -0.0091      0.0002     -0.0045      0.0009             popD
          P.hispida_19     0.3252      0.2425      0.0017     -0.0113     -0.0009      0.0049     -0.0005     -0.0034     -0.0026     -0.0011             popD
          P.hispida_20     0.3250      0.2418      0.0044     -0.0044     -0.0063      0.0030     -0.0123     -0.0009     -0.0071      0.0103             popD
          P.hispida_21    -0.0290     -0.1119      0.2492      0.1604      0.2698      0.1688     -0.1500     -0.6844      0.1075     -0.1788             popE
          P.hispida_22    -0.0283     -0.1065      0.2334      0.2146      0.2166      0.1599      0.0754     -0.1022      0.0965      0.4031             popE
          P.hispida_23    -0.0284     -0.1103      0.2396      0.2044      0.2502     -0.1868      0.3306      0.3067     -0.6316     -0.0196             popE
          P.hispida_24    -0.0247     -0.0987      0.2279      0.1965      0.2163     -0.0297      0.0123     -0.0052     -0.0056      0.3597             popE
          P.hispida_25    -0.0245     -0.0970      0.2241      0.2193      0.2510     -0.1282     -0.2407      0.4861      0.4623     -0.4974             popE
            P.largha_1    -0.3412      0.3136     -0.0305     -0.0105     -0.0068      0.0013     -0.0003     -0.0011     -0.0022      0.0014         outgroup
            P.largha_2    -0.3402      0.3124     -0.0303     -0.0097     -0.0072      0.0012     -0.0005     -0.0010     -0.0006      0.0014         outgroup
            P.largha_3    -0.3413      0.3141     -0.0305     -0.0101     -0.0072      0.0009     -0.0012     -0.0009     -0.0017      0.0015         outgroup
            P.largha_4    -0.3411      0.3131     -0.0301     -0.0103     -0.0076      0.0011     -0.0007     -0.0018     -0.0021      0.0007         outgroup
  
  </code></pre>
  
Tags: <genomics><pca>
Title: How can i resolve "too many entries" error in EIGENSTRAT?
ThreadText: # How can i resolve "too many entries" error in EIGENSTRAT?
  
  (Asked by: username_0 on 2024-12-06)
  
  I have genomic data for already converted in eigensoft format. Specifically I have SNP data for 5 populations and 1 outgroup. I ran `smartpca` with the following parameter file.
  
  ```
  cat > smartpca.txt << EOF
  genotypename:    data_175k.geno
  snpname:         data_175k.snp
  indivname:       data_175k.ind
  evecoutname:     output.pca.evec.txt
  evaloutname:     output.pca.eval.txt
  EOF
  
  ```
  
  I then ran it with `smartpca -p smartpca.txt > smartpca.out`
  
  I then tried to use `smarteigenstrat` with the results of the PCA
  
  ```
  cat > smarteigenstrat.txt << EOF
  genotypename:    data_175k.geno
  snpname:         data_175k.snp
  indivname:       data_175k.ind
  pcaname:         output.pca.evec.txt
  outputname:      chisq_output.txt
  EOF
  
  ```
  
  When I try to run it with `smarteigenstrat -p smarteigenstrat.txt > smarteigenstrat.out`
  
  I get this error message
  
  > OOPS: output.pca.evec.txt contains too many entries
  
  For now I mostly want to run it with default settings. The number of eigen vectors is 10 by default, so there are no changes there. Does anyone know why that happens and how can I make it run correctly?
  
  Edit: These are the contents of `output.pca.evec.txt`
  
  ```
        #eigvals:     4.391     3.429     1.484     1.142     1.107     0.981     0.974     0.973     0.964     0.961 
           P.hispida_1    -0.0161     -0.1078      0.1818     -0.0443     -0.2926     -0.1196      0.0406      0.0527      0.0446     -0.0432             popA
           P.hispida_2    -0.0281     -0.1337      0.1914     -0.0709     -0.2925      0.3726     -0.5800      0.0402     -0.4827     -0.1949             popA
           P.hispida_3    -0.0221     -0.1295      0.2011     -0.0657     -0.3748     -0.6472     -0.2970     -0.0772      0.1109      0.3357             popA
           P.hispida_4    -0.0127     -0.1124      0.1788     -0.0354     -0.3433     -0.1252      0.5521     -0.2927     -0.0005     -0.4552             popA
           P.hispida_5    -0.0183     -0.1273      0.1864     -0.0660     -0.3589      0.5494      0.2612      0.2867      0.2953      0.2532             popA
           P.hispida_6    -0.0029     -0.1304     -0.0833     -0.4194      0.1788     -0.0247      0.0278      0.0471     -0.0084      0.0126             popB
           P.hispida_7    -0.0104     -0.1391     -0.0854     -0.3698      0.1794     -0.0270     -0.0018      0.0058     -0.0261     -0.0062             popB
           P.hispida_8    -0.0077     -0.1309     -0.0820     -0.2776      0.1648      0.0034     -0.0116     -0.0737      0.1122      0.0183             popB
           P.hispida_9    -0.0061     -0.1283     -0.0978     -0.3104      0.1419     -0.0148      0.0256      0.0250     -0.0344      0.0130             popB
          P.hispida_10    -0.0093     -0.1367     -0.0782     -0.2940      0.1339      0.0193      0.0299      0.0372      0.0194     -0.0182             popB
          P.hispida_11     0.0024     -0.1318     -0.3306      0.1962     -0.0435     -0.0359      0.0104      0.0124      0.0125      0.0252             popC
          P.hispida_12    -0.0012     -0.1431     -0.3360      0.2281     -0.0924     -0.0001     -0.0043     -0.0383      0.0322     -0.0160             popC
          P.hispida_13     0.0107     -0.1119     -0.2784      0.2172     -0.0422      0.0281      0.0113      0.0165      0.0724     -0.0427             popC
          P.hispida_14    -0.0068     -0.1496     -0.3176      0.1659     -0.0521      0.0092     -0.0443     -0.0285     -0.0648      0.0120             popC
          P.hispida_15     0.0015     -0.1351     -0.3253      0.2110     -0.0710      0.0112     -0.0150     -0.0021     -0.0787      0.0204             popC
          P.hispida_16     0.3355      0.2563      0.0095     -0.0029      0.0009      0.0003     -0.0060     -0.0009     -0.0084      0.0037             popD
          P.hispida_17     0.3134      0.2317      0.0038      0.0038     -0.0038      0.0049     -0.0018     -0.0023     -0.0040      0.0003             popD
          P.hispida_18     0.3268      0.2464      0.0030     -0.0047     -0.0006     -0.0004     -0.0091      0.0002     -0.0045      0.0009             popD
          P.hispida_19     0.3252      0.2425      0.0017     -0.0113     -0.0009      0.0049     -0.0005     -0.0034     -0.0026     -0.0011             popD
          P.hispida_20     0.3250      0.2418      0.0044     -0.0044     -0.0063      0.0030     -0.0123     -0.0009     -0.0071      0.0103             popD
          P.hispida_21    -0.0290     -0.1119      0.2492      0.1604      0.2698      0.1688     -0.1500     -0.6844      0.1075     -0.1788             popE
          P.hispida_22    -0.0283     -0.1065      0.2334      0.2146      0.2166      0.1599      0.0754     -0.1022      0.0965      0.4031             popE
          P.hispida_23    -0.0284     -0.1103      0.2396      0.2044      0.2502     -0.1868      0.3306      0.3067     -0.6316     -0.0196             popE
          P.hispida_24    -0.0247     -0.0987      0.2279      0.1965      0.2163     -0.0297      0.0123     -0.0052     -0.0056      0.3597             popE
          P.hispida_25    -0.0245     -0.0970      0.2241      0.2193      0.2510     -0.1282     -0.2407      0.4861      0.4623     -0.4974             popE
            P.largha_1    -0.3412      0.3136     -0.0305     -0.0105     -0.0068      0.0013     -0.0003     -0.0011     -0.0022      0.0014         outgroup
            P.largha_2    -0.3402      0.3124     -0.0303     -0.0097     -0.0072      0.0012     -0.0005     -0.0010     -0.0006      0.0014         outgroup
            P.largha_3    -0.3413      0.3141     -0.0305     -0.0101     -0.0072      0.0009     -0.0012     -0.0009     -0.0017      0.0015         outgroup
            P.largha_4    -0.3411      0.3131     -0.0301     -0.0103     -0.0076      0.0011     -0.0007     -0.0018     -0.0021      0.0007         outgroup
  
  ```
  
  **Tags:** genomics, pca
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2024-12-12. Score: 0
  
  The issue here is we don't have access to all the files:
  Could you:
  
  * Check the .ind file: **1)** Count the number of individuals in data\_175k.ind. **2)** make sure its equal to the number of rows in output.pca.evec.txt (excluding the header line with #eigvals).
  * Check the .evec file structure: **1)** Count the columns in output.pca.evec.txt; **2)** make sure each row has exactly 12 columns: 10 eigenvectors + 1 individual name + 1 population label.
  
  ---
  
  If the above draw a blank then try:
  
  `sed '/#eigvals/d' output.pca.evec.txt > output.pca.evec.new.txt`
  
  and rerun.
  
  
  ---
  
  