title: Create an applescript from a perl and a ruby script?
body: <p>I download protein sequences from <a href="http://ncbi.nlm.nih.gov/genomes/FLU/Database/nph-select.cgi#mainform" rel="nofollow">http://ncbi.nlm.nih.gov/genomes/FLU/Database/nph-select.cgi#mainform</a>, which are downloaded with filename FASTA.FA. For each protein in the file, it includes one describing row, and then protein sequence separated with a new row after each 70 characters.</p>
  
  <p>Example:</p>
  
  <p>>CAA47401 B/Yamagata/16/88 1988// NA
  MLPSTIQTLTLFLTSGGVLLSLYVSASLSYLLYSDILLKFSPTEITAPKVPLDCANASNVQAVNRSATKG
  MTLLLSEPEWTYPRLSCQGSTFQKALLISPHRFGESRGNSAPLIIREPFIACGPKECKHFALTHYAAQPG
  >AAB26739 Influenza B virus 1973// NA
  MLPSTIQTLTLFLTSGGVLLSLYVSASLSYLLYSDILLKFSPTKITAPTMSLDCANVSNVQAVNRSATKE
  DVPCIGIEMVHDGGKETWHSAATAIYCLMGSGQLLWDIVTGVAMAL</p>
  
  <p>I have a ruby script that converts this to a file that fits Excel better, where the first line gets one cell and the entire protein sequence gets one another cell (perl makes a tab between and Excel puts stuff separated with tab in a new cell).</p>
  
  <p>This is my script:</p>
  
  <pre><code>ruby -e 'first_line = true; while line = STDIN.gets; line.chomp!; 
  if line =~ /^&gt;/; puts unless first_line; print line[1..-1]; print "\t"; 
  else; print line; end; first_line = false; end; puts' &lt; ~/Downloads/FASTA.fa &gt; ~/Downloads/Sequences.xls
  </code></pre>
  
  <p>On the website where I download the files you can change how the first line should be formatted, and I include a "+" between each description, and I then have a perl script that converts + to tab (some descriptions have a space within it, so I cant use space as a separator).</p>
  
  <pre><code>perl -p -i -e "s/\+/\t/g" ~/Downloads/Sequences.xls
  </code></pre>
  
  <p>These two hacks successfully creates a nice excel file for me, and I have made an Automator program from these two scripts that sits in my dock.</p>
  
  <p>However, now my group wants me to create an applescript out of this. If I have understood this correctly, it's not as simple as just typing "do shell script" and then paste the script, but you have to format the actual script itself so that applescript understands it. Could anyone please help me in creating this?</p>
  
  <p>Thanks!</p>