Answers.Body: <p>The reason is (likely) that plink is expecting a space separated file for the <code>--update-name</code> argument:</p>
  <pre><code>--update-name &lt;filename&gt; [new ID col. number] [old ID col.] [skip]
  </code></pre>
  <p>You've given it a comma-separated file, so it thinks there is only one column, hence the error. You also don't want column names.</p>
  <p>Change the sep by:</p>
  <pre><code>sed 's/,/ /g' updated_ref.csv &gt; updated_ref.txt
  </code></pre>
  <p>Or, edit the file in place, and keep a backup of the original named <code>updated_ref.csv.bak</code> :</p>
  <pre><code>sed -i.bak 's/,/ /g' updated_ref.csv &gt; updated_ref.txt
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-06-10T13:01:11.080Z
Answers.Text: Do you mean cat updated_ref.csv | sed -i 's/,/ /g' > updated_ref.txt 
   according to my data and it will convert my .csv into .txt?
Answers.UserDisplayName: Aryh
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-06-10T13:03:43.197Z
Answers.Text: See update to my post
Answers.UserDisplayName: user438383
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-06-10T12:49:39.123Z
Answers.LastActivityDate: 2021-06-10T13:19:48.300Z
Answers.LastEditDate: 2021-06-10T13:19:48.300Z
Answers.UserDisplayName: user438383
Body: <p>I am trying to update my rsIDs in .bim file by using --update-name flag in plink but getting this error message. what could be the reason of it?</p>
  <pre><code>plink --bfile updated_ff  --update-name updated_ref.csv --make-bed --out test_updatedrs
  
  PLINK v1.90b6.21 64-bit (19 Oct 2020)
  Options in effect:
    --bfile updated_ff
    --make-bed
    --out test_updatedrs
    --update-name updated_ref.csv
  
  Hostname: login1
  Working directory: /gpfs/home/bsc08/bsc08856/phs001273_dbgap
  Start time: Thu Jun 10 14:23:44 2021
  
  Random number seed: 1623327824
  96310 MB RAM detected; reserving 48155 MB for main workspace.
  Allocated 15236 MB successfully, after larger attempt(s) failed.
  Error: Line 1 of updated_ref.csv has fewer tokens than expected.
  </code></pre>
  <p>My updated_ref.csv file looks like this</p>
  <pre><code>Name,chrpos
  rs3793692,chr10_100008436
  rs1983865,chr10_100016339
  newrs150271620,chr10_100017402
  rs10736126,chr10_100025924
  chr10_100044928_A_G,chr10_100044928
  rs7905091,chr10_100046078
  rs6584182,chr10_100055644
  chr10_100058710_C_T,chr10_100058710
  rs4360594,chr10_10007547
  rs927739,chr10_100077732
  rs4917817,chr10_100085888
  </code></pre>
  <p>while my .bim looks like this</p>
  <pre><code>1 rs3094315 0 752566 G A
  1 rs3131972 0 752721 A G
  1 chr1770377 0 770377 T A
  1 rs11240777 0 798959 A G
  1 chr1834753 0 834753 C G
  1 rs72890788 0 836924 A G
  1 rs4970383 0 838555 A C
  1 chr1840753 0 840753 G A
  
  1 rs4475691 0 846808 A G
  </code></pre>
  
Tags: <plink>
Title: Error: "fewer tokens than expected" while using --update-name flag in plink
ThreadText: # Error: "fewer tokens than expected" while using --update-name flag in plink
  
  (Asked by: username_0 on 2021-06-10)
  
  I am trying to update my rsIDs in .bim file by using --update-name flag in plink but getting this error message. what could be the reason of it?
  
  ```
  plink --bfile updated_ff  --update-name updated_ref.csv --make-bed --out test_updatedrs
  
  PLINK v1.90b6.21 64-bit (19 Oct 2020)
  Options in effect:
    --bfile updated_ff
    --make-bed
    --out test_updatedrs
    --update-name updated_ref.csv
  
  Hostname: login1
  Working directory: /gpfs/home/bsc08/bsc08856/phs001273_dbgap
  Start time: Thu Jun 10 14:23:44 2021
  
  Random number seed: 1623327824
  96310 MB RAM detected; reserving 48155 MB for main workspace.
  Allocated 15236 MB successfully, after larger attempt(s) failed.
  Error: Line 1 of updated_ref.csv has fewer tokens than expected.
  
  ```
  
  My updated\_ref.csv file looks like this
  
  ```
  Name,chrpos
  rs3793692,chr10_100008436
  rs1983865,chr10_100016339
  newrs150271620,chr10_100017402
  rs10736126,chr10_100025924
  chr10_100044928_A_G,chr10_100044928
  rs7905091,chr10_100046078
  rs6584182,chr10_100055644
  chr10_100058710_C_T,chr10_100058710
  rs4360594,chr10_10007547
  rs927739,chr10_100077732
  rs4917817,chr10_100085888
  
  ```
  
  while my .bim looks like this
  
  ```
  1 rs3094315 0 752566 G A
  1 rs3131972 0 752721 A G
  1 chr1770377 0 770377 T A
  1 rs11240777 0 798959 A G
  1 chr1834753 0 834753 C G
  1 rs72890788 0 836924 A G
  1 rs4970383 0 838555 A C
  1 chr1840753 0 840753 G A
  
  1 rs4475691 0 846808 A G
  
  ```
  
  **Tags:** plink
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2021-06-10. Score: 2 | Accepted answer
  
  The reason is (likely) that plink is expecting a space separated file for the `--update-name` argument:
  
  ```
  --update-name <filename> [new ID col. number] [old ID col.] [skip]
  
  ```
  
  You've given it a comma-separated file, so it thinks there is only one column, hence the error. You also don't want column names.
  
  Change the sep by:
  
  ```
  sed 's/,/ /g' updated_ref.csv > updated_ref.txt
  
  ```
  
  Or, edit the file in place, and keep a backup of the original named `updated_ref.csv.bak` :
  
  ```
  sed -i.bak 's/,/ /g' updated_ref.csv > updated_ref.txt
  
  ```
  
  > **Comments:**
  > **username_0**: Do you mean cat updated_ref.csv | sed -i 's/,/ /g' > updated_ref.txt   according to my data and it will convert my .csv into .txt?  
  > **username_1**: See update to my post  
  
  ---
  
  