title: Read file and identify a String between parenthesis
body: <p>I am attempting to name the String that will occur between the last set of parenthesis "genesym". So far, I am swapping the last occurrence of each parenthesis with a tab character. Between these functions, I want to name that existing String genesym. </p>
  
  <p>I realize this is a Scanner function, but this is the only way I know how to say it.</p>
  
  <pre><code>import java.lang.*;
  import java.io.*;
  
  public class TESTING
  {
      public static void main(String[] args)
      {
          try {
              BufferedReader br = new BufferedReader(new FileReader("human.rna.fna"));
              BufferedWriter bw = new BufferedWriter(new FileWriter("FormattedHumanRNA"));
  
              String line
              String genesym;
  
              while ((line = br.readLine()) != null) {
                  if (line.startsWith("&gt;")) {
                      // Replaces the last set of parenthesis with a tab character
                      int openbracket =  line.lastIndexOf("(");
                      line = new StringBuilder(line)
                          .replace(openbracket, openbracket + 1, "\t")
                          .toString();
  
  
                      **genesym = br.nextString();**
  
  
                      // Replaces the last close parenthesis with a tab character
                      int closebracket = line.lastIndexOf(")");
                      line = new StringBuilder(line)
                          .replace(closebracket, closebracket + 1, "\t")
                          .toString();
                  } else {
                      line = line.replaceAll ("\n", "");
                  }
  
                  bw.write(genesym + " : " + line);
              }
              br.close();
              bw.close();
          } catch(IOException e) {
              e.printStackTrace(System.err);
          }
      }
  }
  </code></pre>
  
  <p>Sample: (my data is MUCH larger than this, around 1 million lines)</p>
  
  <p>input file:</p>
  
  <pre><code>&gt;365 (LOC1), long non-coding RNA AGCGTCT
  
  &gt;22 (1*split3**) (FLJ), long RNA AAAATC
  
  &gt;13 (RTV), RNA ATGCG
  </code></pre>
  
  <p>desired output:</p>
  
  <pre><code>LOC1 : &gt;365      LOC1     , long non-coding RNA AGCGTCT
  
  FLJ : &gt;22 (1*split3**)      FLJ     , long RNA  AAAATC
  
  RTV : &gt;13     RTV     ,RNA ATGCG
  </code></pre>