[Biojava-l] FramedFeature interface

Schreiber, Mark mark.schreiber@agresearch.co.nz
Mon, 3 Sep 2001 14:27:16 +1200


Hi -

Below is a work up for a possible FramedFeature interface

Any comments?

/*
 *                    BioJava development code
 *
 * This code may be freely distributed and modified under the
 * terms of the GNU Lesser General Public Licence.  This should
 * be distributed with the code.  If you do not have a copy,
 * see:
 *
 *      http://www.gnu.org/copyleft/lesser.html
 *
 * Copyright for this code is held jointly by the individual
 * authors.  These should be listed in @author doc comments.
 *
 * For more information on the BioJava project and its aims,
 * or to join the biojava-l mailing list, visit the home page
 * at:
 *
 *      http://www.biojava.org/
 *
 */

package org.biojava.bio.seq;

import java.io.*;

import org.biojava.bio.symbol.*;

/**
 * Title:         FramedFeature<p>
 * Description:  An feature that includes the concept of frame.<p>
 * By extending stranded
 * Copyright:    Copyright (c) 2001<p>
 * @author Mark Schreiber
 * @version 1.0
 */

public interface FramedFeature extends StrandedFeature {

  public static ReadingFrame FORWARD_1 = new ReadingFrame("FORWARD_1",+1);
  public static ReadingFrame FORWARD_2 = new ReadingFrame("FORWARD_2",+2);
  public static ReadingFrame FORWARD_3 = new ReadingFrame("FORWARD_3",+3);
  public static ReadingFrame REVERSE_1 = new ReadingFrame("REVERSE_1",-1);
  public static ReadingFrame REVERSE_2 = new ReadingFrame("REVERSE_2",-2);
  public static ReadingFrame REVERSE_3 = new ReadingFrame("REVERSE_3",-3);

  /**
   * return the reading frame of the feature.
   */
  ReadingFrame getReadingFrame();

  /**
   * This method should be implemented such that a feature on the reverse
strand  is reverse
   * complemented
   */
  SymbolList getSymbols();

  /**
   * @return the Strand that the feature is found on
   */
  Strand getStrand();

  /**
   * Note that the template does not extend StrandedFeature.Template,
   * This is because the concept of strand is encapsulated in the
ReadingFrame
   */
  public static class Template extends Feature.Template{
    public static ReadingFrame readingFrame;
  }

  public static class ReadingFrame implements Serializable{
    private final String text;
    private final int value;
    private final Strand strand;

    private ReadingFrame(String text, int value){
      this.text = text;
      this.value = value;
      if(value > 0) this.strand = StrandedFeature.POSITIVE;
      else this.strand = StrandedFeature.NEGATIVE;
    }

    public String toString(){
      return text;
    }

    public int getValue(){
      return value;
    }

    public StrandedFeature.Strand getStrand(){
     return strand;
    }
  }
}


Mark Schreiber
Bioinformatics
AgResearch Invermay
PO Box 50034
Mosgiel
New Zealand

PH: +64 3 489 9175

 


=======================================================================
Attention: The information contained in this message and/or attachments
from AgResearch Limited is intended only for the persons or entities
to which it is addressed and may contain confidential and/or privileged
material. Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by persons or
entities other than the intended recipients is prohibited by AgResearch
Limited. If you have received this message in error, please notify the
sender immediately.
=======================================================================