From 8e2163165565fa6f3d65ef2fe28a476a9d6a0da4 Mon Sep 17 00:00:00 2001
From: tjc <tjc@ee4ac58c-ac51-4696-9907-e4b3aa274f04>
Date: Tue, 19 Apr 2005 14:49:47 +0000
Subject: [PATCH] gff features

git-svn-id: svn+ssh://svn.internal.sanger.ac.uk/repos/svn/pathsoft/artemis/trunk@2400 ee4ac58c-ac51-4696-9907-e4b3aa274f04
---
 uk/ac/sanger/artemis/io/GFFStreamFeature.java | 44 ++-----------------
 .../artemis/io/SimpleDocumentEntry.java       |  9 ++--
 2 files changed, 8 insertions(+), 45 deletions(-)

diff --git a/uk/ac/sanger/artemis/io/GFFStreamFeature.java b/uk/ac/sanger/artemis/io/GFFStreamFeature.java
index 4d304947d..6c3bed741 100644
--- a/uk/ac/sanger/artemis/io/GFFStreamFeature.java
+++ b/uk/ac/sanger/artemis/io/GFFStreamFeature.java
@@ -20,7 +20,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  *
- * $Header: //tmp/pathsoft/artemis/uk/ac/sanger/artemis/io/GFFStreamFeature.java,v 1.4 2005-04-19 09:22:18 tjc Exp $
+ * $Header: //tmp/pathsoft/artemis/uk/ac/sanger/artemis/io/GFFStreamFeature.java,v 1.5 2005-04-19 14:49:47 tjc Exp $
  */
 
 package uk.ac.sanger.artemis.io;
@@ -35,15 +35,13 @@ import java.util.StringTokenizer;
  *  A StreamFeature that thinks it is a GFF feature.
  *
  *  @author Kim Rutherford
- *  @version $Id: GFFStreamFeature.java,v 1.4 2005-04-19 09:22:18 tjc Exp $
+ *  @version $Id: GFFStreamFeature.java,v 1.5 2005-04-19 14:49:47 tjc Exp $
  **/
 
 public class GFFStreamFeature extends SimpleDocumentFeature
                        implements DocumentFeature, StreamFeature, ComparableFeature 
 {
 
-  private String region_name = null;
-
   /**
    *  Create a new GFFStreamFeature object.  The feature should be added
    *  to an Entry (with Entry.add()).
@@ -179,10 +177,7 @@ public class GFFStreamFeature extends SimpleDocumentFeature
 
           if(name.equals("ID"))
             name = "systematic_id";
-
-          region_name = line_bits.elementAt(0).trim();
-
-          if(name.equals("Name"))
+          else if(name.equals("Name"))
             name = type;
 
           if(values.size() == 0)
@@ -246,9 +241,7 @@ public class GFFStreamFeature extends SimpleDocumentFeature
                                       start_base); 
       
       final Range location_range = new Range(start_base, end_base);
-
       final RangeVector location_ranges = new RangeVector(location_range);
-
       setLocation(new Location(location_ranges, complement_flag));
     }
     catch(ReadOnlyException e) 
@@ -268,17 +261,6 @@ public class GFFStreamFeature extends SimpleDocumentFeature
   }
 
 
-  /**
-  *
-  * The ID of the landmark used to establish the coordinate 
-  * system for the current feature - GFF3.
-  *
-  */ 
-  protected String getRegionName()
-  {
-    return region_name;
-  }
-
   /**
   *
   * For gff-version 3:
@@ -331,26 +313,6 @@ public class GFFStreamFeature extends SimpleDocumentFeature
     return return_value;
   }
 
-  /**
-   *  Helper method for the constructor - returns a String that is the
-   *  concatenation of the Strings in the given StringVector.  The strings
-   *  will be separated by four spaces
-   **/
-  private String joinStringVector(final StringVector string_vector) 
-  {
-    final StringBuffer return_buffer = new StringBuffer();
-
-    for(int i = 0 ; i < string_vector.size() ; ++i) 
-    {
-      if(i != 0)
-        return_buffer.append("    ");
-      
-      return_buffer.append(string_vector.elementAt(i));
-    }
-
-    return return_buffer.toString();
-  }
-
   /**
    *  Read and return a GFFStreamFeature from a stream.  A feature must be the
    *  next thing in the stream.
diff --git a/uk/ac/sanger/artemis/io/SimpleDocumentEntry.java b/uk/ac/sanger/artemis/io/SimpleDocumentEntry.java
index 7ffff76f6..77e3247de 100644
--- a/uk/ac/sanger/artemis/io/SimpleDocumentEntry.java
+++ b/uk/ac/sanger/artemis/io/SimpleDocumentEntry.java
@@ -20,7 +20,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  *
- * $Header: //tmp/pathsoft/artemis/uk/ac/sanger/artemis/io/SimpleDocumentEntry.java,v 1.8 2005-04-19 09:22:18 tjc Exp $
+ * $Header: //tmp/pathsoft/artemis/uk/ac/sanger/artemis/io/SimpleDocumentEntry.java,v 1.9 2005-04-19 14:49:47 tjc Exp $
  */
 
 package uk.ac.sanger.artemis.io;
@@ -37,7 +37,7 @@ import java.util.Enumeration;
  *  This class contains the methods common to all DocumentEntry objects.
  *
  *  @author Kim Rutherford <kmr@sanger.ac.uk>
- *  @version $Id: SimpleDocumentEntry.java,v 1.8 2005-04-19 09:22:18 tjc Exp $
+ *  @version $Id: SimpleDocumentEntry.java,v 1.9 2005-04-19 14:49:47 tjc Exp $
  **/
 
 abstract public class SimpleDocumentEntry
@@ -244,8 +244,9 @@ abstract public class SimpleDocumentEntry
               while(gff_features.hasMoreElements())
               {
                 GFFStreamFeature feature = (GFFStreamFeature)gff_features.nextElement();
-                String id = feature.getRegionName();
-                if(id != null && id.equals(header_strings[i]))
+                Qualifier qualifier = feature.getQualifierByName("gff_seqname");
+                    
+                if(qualifier.getValues().contains(header_strings[i]))
                 {
                   try
                   {
-- 
GitLab