title: Fasta to dataframe - R
body: <p>In this script which I found in the net (<a href="http://www.slideshare.net/schamber/phylogenetics-in-r" rel="nofollow">http://www.slideshare.net/schamber/phylogenetics-in-r</a>) I generate a cotton list.</p>
  
  <pre><code>require(ape) 
  # make vector of accession numbers, for ITS 1 and 2 region for Gossypium (cotton) species 
  cotton_acc &lt;- c("U56806", "U12712", "U56810", 
                  "U12732", "U12725", "U56786", "U12715", 
                  "AF057758", "U56790", "U12716", "U12729", 
                  "U56798", "U12727", "U12713", "U12719", 
                  "U56811", "U12728", "U12730", "U12731", 
                  "U12722", "U56796", "U12714", "U56789", 
                  "U56797", "U56801", "U56802", "U12718", 
                  "U12710", "U56804", "U12734", "U56809", 
                  "U56812", "AF057753", "U12711", "U12717", 
                  "U12723", "U12726") 
  # get data from Genbank 
  cotton &lt;- read.GenBank(cotton_acc, species.names = T) 
  # name the sequences with species names instead of access numbers 
  names_accs &lt;- data.frame(species = attr(cotton, "species"), accs = names(cotton)) 
  names(cotton) &lt;- attr(cotton, "species")
  write.dna(cotton, "C:/Users/Comp12/Desktop/cotton.fas", format = "fasta") 
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>&gt; cotton
  37 DNA sequences in binary format stored in a list.
  
  Mean sequence length: 681.595 
     Shortest sequence: 667 
      Longest sequence: 687 
  
  Labels: Gossypium_anomalum Gossypium_arboreum Gossypium_areysianum Gossypium_aridum Gossypium_armourianum Gossypium_australe ...
  
  Base composition:
      a     c     g     t 
  0.212 0.302 0.280 0.205 
  </code></pre>
  
  <p>How can I arrange it in a dataframe with the column order of cotton_acc, species.names, sequence, Base composition (total I will get 37 rows).</p>
  
  <p>Thanks</p>