Answers.Body: <p>Well, it looks like if you're using Windows for managing files - that's not a good idea - it sorts names of your ballgown folders in alphabetical order while you need it differently. </p>
  
  <p>That is why the one should use Linux - when you're <code>ls -ltr</code> your ballgown folder in Linux it gives you the "right" sequence of folder names to be put inside a ballgown object using pData. </p>
  
  <p>This is what helped me to get rid of this error:</p>
  
  <p>In Linux enter your ballgown folder and do <code>ls -ltr | awk '{print$9}'</code> and you will have the <strong>right</strong> sequence that you have to put inside you <code>.csv</code> file using Notepad++, indicating what's what. Below's my example compared to the above mentioned initial example:</p>
  
  <pre><code>id,state
  RNA-CCC_12N_S7_L002,control
  RNA-CCC_12T_S8_L002,tube
  RNA-CCC_13N_S105_L002,control
  RNA-CCC_13T_S106_L002,tube
  RNA-CCC_23N_S107_L002,control
  RNA-CCC_23T_S108_L002,tube
  RNA-CCC_8N_S5_L002,control
  RNA-CCC_8T1_S6_L002,tube
  </code></pre>
  
  <p>I don't have my error anymore and after </p>
  
  <pre><code>phenodata &lt;- read.csv('my_phenodata_file.csv')
  bg = ballgown(dataDir = "ballgown", samplePattern = "RNA-CCC_", pData = phenodata) 
  </code></pre>
  
  <p>my results are nicely wrapped</p>
  
  <pre><code>Sat May 02 22:11:57 2020
  Sat May 02 22:11:57 2020: Reading linking tables
  Sat May 02 22:11:59 2020: Reading intron data files
  Sat May 02 22:12:04 2020: Merging intron data
  Sat May 02 22:12:06 2020: Reading exon data files
  Sat May 02 22:12:14 2020: Merging exon data
  Sat May 02 22:12:16 2020: Reading transcript data files
  Sat May 02 22:12:20 2020: Merging transcript data
  Wrapping up the results
  Sat May 02 22:12:22 2020
  </code></pre>
  
  <p>The problem is explained here as well</p>
  
  <p><a href="https://www.biostars.org/p/228389/" rel="nofollow noreferrer">https://www.biostars.org/p/228389/</a></p>
  
  <p>Hope this will help anyone</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-05-02T21:03:22.557Z
Answers.Text: Thank you very much @'Dmitrii Trubetskoy' it certainly helps.
Answers.UserDisplayName: M__
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-05-02T20:27:58.393Z
Answers.LastActivityDate: 2020-05-02T20:27:58.393Z
Answers.UserDisplayName: Dmitrii Trubetskoy
Body: <p>I am trying to create a ballgown object, and I would like to set a phenodata information.
  For that I do </p>
  
  <pre><code>phenodata &lt;- read.csv('l002.csv')
  </code></pre>
  
  <p>and my l002.csv file contains the following info</p>
  
  <pre><code>id,state
  RNA-CCC_8N_S5_L002,control
  RNA-CCC_8T1_S6_L002,tube
  RNA-CCC_12N_S7_L002,control
  RNA-CCC_12T_S8_L002,tube
  RNA-CCC_13N_S105_L002,control
  RNA-CCC_13T_S106_L002,tube
  RNA-CCC_23N_S107_L002,control
  RNA-CCC_23T_S108_L002,tube
  </code></pre>
  
  <p>A ballgown folder contains folders that have exactly the same names, e.g. RNA-CCC_8N_S5_L002, RNA-CCC_8T1_S6_L002, etc...
  Then, I use this piece of code for bg object creation</p>
  
  <pre><code>bg = ballgown(dataDir = "ballgown", samplePattern = "RNA-CCC_", pData = phenodata )
  </code></pre>
  
  <p>but every time I run it, I have the same error every time:</p>
  
  <pre><code>Error in ballgown(dataDir = "ballgown", samplePattern = "RNA-CCC_", pData = phenodata) : 
    first column of pData does not match the names of the folders containing the ballgown data.
  </code></pre>
  
  <p>What can be a problem since first column of pData matches exactly the names of the folders containing the ballgown data.. </p>
  
  <p>If I get rid of phenodata ballgown object creation works, but I need this phenodata for further manipulations.</p>
  
Tags: <rna-seq><stringtie>
Title: Why this ballgown error (first column of pData does not match the names of the folders) comes out
ThreadText: # Why this ballgown error (first column of pData does not match the names of the folders) comes out
  
  (Asked by: username_0 on 2020-05-02)
  
  I am trying to create a ballgown object, and I would like to set a phenodata information.
  For that I do
  
  ```
  phenodata <- read.csv('l002.csv')
  
  ```
  
  and my l002.csv file contains the following info
  
  ```
  id,state
  RNA-CCC_8N_S5_L002,control
  RNA-CCC_8T1_S6_L002,tube
  RNA-CCC_12N_S7_L002,control
  RNA-CCC_12T_S8_L002,tube
  RNA-CCC_13N_S105_L002,control
  RNA-CCC_13T_S106_L002,tube
  RNA-CCC_23N_S107_L002,control
  RNA-CCC_23T_S108_L002,tube
  
  ```
  
  A ballgown folder contains folders that have exactly the same names, e.g. RNA-CCC\_8N\_S5\_L002, RNA-CCC\_8T1\_S6\_L002, etc...
  Then, I use this piece of code for bg object creation
  
  ```
  bg = ballgown(dataDir = "ballgown", samplePattern = "RNA-CCC_", pData = phenodata )
  
  ```
  
  but every time I run it, I have the same error every time:
  
  ```
  Error in ballgown(dataDir = "ballgown", samplePattern = "RNA-CCC_", pData = phenodata) : 
    first column of pData does not match the names of the folders containing the ballgown data.
  
  ```
  
  What can be a problem since first column of pData matches exactly the names of the folders containing the ballgown data..
  
  If I get rid of phenodata ballgown object creation works, but I need this phenodata for further manipulations.
  
  **Tags:** rna-seq, stringtie
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2020-05-02. Score: 2
  
  Well, it looks like if you're using Windows for managing files - that's not a good idea - it sorts names of your ballgown folders in alphabetical order while you need it differently.
  
  That is why the one should use Linux - when you're `ls -ltr` your ballgown folder in Linux it gives you the "right" sequence of folder names to be put inside a ballgown object using pData.
  
  This is what helped me to get rid of this error:
  
  In Linux enter your ballgown folder and do `ls -ltr | awk '{print$9}'` and you will have the **right** sequence that you have to put inside you `.csv` file using Notepad++, indicating what's what. Below's my example compared to the above mentioned initial example:
  
  ```
  id,state
  RNA-CCC_12N_S7_L002,control
  RNA-CCC_12T_S8_L002,tube
  RNA-CCC_13N_S105_L002,control
  RNA-CCC_13T_S106_L002,tube
  RNA-CCC_23N_S107_L002,control
  RNA-CCC_23T_S108_L002,tube
  RNA-CCC_8N_S5_L002,control
  RNA-CCC_8T1_S6_L002,tube
  
  ```
  
  I don't have my error anymore and after
  
  ```
  phenodata <- read.csv('my_phenodata_file.csv')
  bg = ballgown(dataDir = "ballgown", samplePattern = "RNA-CCC_", pData = phenodata) 
  
  ```
  
  my results are nicely wrapped
  
  ```
  Sat May 02 22:11:57 2020
  Sat May 02 22:11:57 2020: Reading linking tables
  Sat May 02 22:11:59 2020: Reading intron data files
  Sat May 02 22:12:04 2020: Merging intron data
  Sat May 02 22:12:06 2020: Reading exon data files
  Sat May 02 22:12:14 2020: Merging exon data
  Sat May 02 22:12:16 2020: Reading transcript data files
  Sat May 02 22:12:20 2020: Merging transcript data
  Wrapping up the results
  Sat May 02 22:12:22 2020
  
  ```
  
  The problem is explained here as well
  
  <https://www.biostars.org/p/228389/>
  
  Hope this will help anyone
  
  > **Comments:**
  > **username_1**: Thank you very much @'username_0' it certainly helps.  
  
  ---
  
  