[Biojava-l] Biojava tutorial revisisted

Chun-Nuan Chen chun@bioweircom.org
Wed, 08 May 2002 09:22:54 -0700


--------------040902000806050208020102
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

Hi,
I revisisted the biojava tutorial and found a few things that may need 
correction. I believe most of them are just typos:

1.  in BioJava Blast-like parsing tutorial 0.1 by Cambridge Antibody 
Technology.
|"java *eventbasedparsing/TutorialEx1* files/ncbiblast/shortBlastn.out"

should be:

||"java *eventbasedparsing.TutorialEx1* files/ncbiblast/shortBlastn.out"|
|
2.in Keith James' "|Parsing Fasta search output":
 
java *search/FastaSearchParse* files/fp_queries.db files/fp_demo.db 
files/fp_demo.m10

should be:

java *search.FastaSearchParse* files/fp_queries.db files/fp_demo.db 
files/fp_demo.m10

(NB: Although this sample code has been obsoleted in the latest cvs tree 
and the functions have been moved to 
org/biojava/bio/program/sax/FastaSearchParser.java, the tutorial has not 
been updated for this change and the compilation of this old sample code 
is not successful due to the removal of some classes it depends on.)

3. in Matthew's Roulet.java example, I have to change a few things to 
make the compilation and execution work:

 1). The changeSupport viable in the inner RedBlackDist class cannot be 
inherited from the super.super class AbstractChangeable since it is 
defined as a private variable there (there was a thread discussing this 
issue earlier in this mailing list). The workaround is to either modify 
the source code of AbstractChangeable.java to make this variable 
inheritable and rebuild the biojava.jar or modify the source code of 
Roulet.java like the following:

class RedBlackDist extends AbstractDistribution {
  ...
 * private ChangeSupport changeSupport;*
  private ChangeListener parentL;
  private ChangeListener propUpdater;

  public RedBlackDist(final Distribution parent) {
    this.parent = parent;
  *  changeSupport=get*ChangeSupport(Distribution.WEIGHTS);

 2). the generateChangeSupport(Distribution.WEIGHTS) method should be 
changed to *get*ChangeSupport(Distribution.WEIGHTS); as shown above.

 3). I need to do a few cast-downs in order to make code to compile:
   
    change lines like the following:

             Symbol s = (Symbol) i.next();
    to:
             FundamentalAtomicSymbol s = (FundamentalAtomicSymbol) i.next();


Otherwise, the *getToken *method will not be recognized. Using/casting 
back to interface is a good programming practice but will cause a little 
bit of headache when debugging problems like above because we need to 
trace back to get the exact class to cast down to.

With all above changes, I can complie and run the Roulet applet 
successfully.* It is a nice program!*

4. This is not an error or typo and is related to the style of the code 
blocks in the tutorial. The css class for the code block is nice for 
displaying on the screen but is not printer-friendly. It consumes a lot 
of ink but the code is barely readable.

Please correct me if my above statements are not valid.

Thanks,

Chun-Nuan



--------------040902000806050208020102
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1">
  <title></title>
</head>
<body>
Hi,<br>
I revisisted the biojava tutorial and found a few things that may need correction.
I believe most of them are just typos:<br>
 <br>
 1.&nbsp; in  BioJava Blast-like parsing tutorial 0.1 by Cambridge  Antibody Technology.<br>
  <code>"java <b>eventbasedparsing/TutorialEx1</b> files/ncbiblast/shortBlastn.out"<br>
 <br>
 should be:<br>
 <br>
 </code><code>"java <b>eventbasedparsing.TutorialEx1</b> files/ncbiblast/shortBlastn.out"</code><br>
 <code><br>
 2.in Keith James' "</code>Parsing Fasta search output":<br>
 &nbsp; <br>
 java <b>search/FastaSearchParse</b> files/fp_queries.db       files/fp_demo.db
files/fp_demo.m10 <br>
 <br>
 should be:<br>
 <br>
 java <b>search.FastaSearchParse</b> files/fp_queries.db       files/fp_demo.db
files/fp_demo.m10 <br>
 <br>
 (NB: Although this sample code has been obsoleted in the latest cvs tree 
and the functions have been moved to org/biojava/bio/program/sax/FastaSearchParser.java, 
the tutorial has not been updated for this change and the compilation of this
old sample code is not successful due to the removal of some classes it depends
on.)<br>
 <br>
 3. in Matthew's Roulet.java example, I have to change a few things to make
the compilation and execution work:<br>
<br>
 &nbsp;1). The changeSupport viable in the inner RedBlackDist class cannot be
inherited from the super.super class AbstractChangeable since it is defined
as a private variable there (there was a thread discussing this issue earlier
in this mailing list). The workaround is to either modify the source code 
of AbstractChangeable.java to make this variable inheritable and rebuild
the biojava.jar or modify the source code of Roulet.java like the following:<br>
 <br>
 class RedBlackDist extends AbstractDistribution {<br>
 &nbsp; ...<br>
 &nbsp;<b> private ChangeSupport changeSupport;</b><br>
 &nbsp; private ChangeListener parentL;<br>
 &nbsp; private ChangeListener propUpdater;<br>
 <br>
 &nbsp; public RedBlackDist(final Distribution parent) {<br>
 &nbsp;&nbsp;&nbsp; this.parent = parent;<br>
 &nbsp;&nbsp;<b>&nbsp; changeSupport=get</b>ChangeSupport(Distribution.WEIGHTS);<br>
 <br>
 &nbsp;2). the generateChangeSupport(Distribution.WEIGHTS) method should be changed
to <b>get</b>ChangeSupport(Distribution.WEIGHTS); as shown above.<br>
 <br>
 &nbsp;3). I need to do a few cast-downs in order to make code to compile:<br>
 &nbsp; &nbsp; <br>
 &nbsp; &nbsp; change lines like the following:<br>
 <br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Symbol s = (Symbol) i.next();<br>
 &nbsp; &nbsp; to:<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; FundamentalAtomicSymbol s = (FundamentalAtomicSymbol) i.next();<br>
<br>
<br>
Otherwise, the <b>getToken </b>method will not be recognized. Using/casting
back to interface is a good programming practice but will cause a little
bit of headache when debugging problems like above because we need to trace
back to get the exact class to cast down to. <br>
<br>
With all above changes, I can complie and run the Roulet applet successfully.<b>
It is a nice program!</b><br>
<br>
4. This is not an error or typo and is related to the style of the code blocks
in the tutorial. The css class for the code block is nice for displaying
on the screen but is not printer-friendly. It consumes a lot of ink but the
code is barely readable.<br>
<br>
Please correct me if my above statements are not valid.<br>
<br>
Thanks,<br>
<br>
Chun-Nuan<br>
<br>
<br>
</body>
</html>

--------------040902000806050208020102--