From 3eca2c1e7ccfc5014f2a268f04180ec87c094bb6 Mon Sep 17 00:00:00 2001
From: tjc <tjc@ee4ac58c-ac51-4696-9907-e4b3aa274f04>
Date: Fri, 3 Mar 2006 11:34:26 +0000
Subject: [PATCH] uniprot version no. fix

git-svn-id: svn+ssh://svn.internal.sanger.ac.uk/repos/svn/pathsoft/artemis/trunk@4130 ee4ac58c-ac51-4696-9907-e4b3aa274f04
---
 .../sanger/artemis/editor/FastaTextPane.java  | 27 +++++++++++++++++--
 uk/ac/sanger/artemis/editor/HitInfo.java      | 21 +++++++++++++--
 2 files changed, 44 insertions(+), 4 deletions(-)

diff --git a/uk/ac/sanger/artemis/editor/FastaTextPane.java b/uk/ac/sanger/artemis/editor/FastaTextPane.java
index 55b034223..9ff581903 100644
--- a/uk/ac/sanger/artemis/editor/FastaTextPane.java
+++ b/uk/ac/sanger/artemis/editor/FastaTextPane.java
@@ -231,7 +231,17 @@ public class FastaTextPane extends JScrollPane
             currentID = line.substring(1,ind);
             int indDot;
             if( (indDot = currentID.indexOf(".")) > 5)
-              currentID= currentID.substring(0,indDot);
+            {
+              String version = currentID.substring(indDot+1);
+              try
+              {
+                int version_no = Integer.parseInt(version);
+                // version number looks like uniprot so strip this
+                if(version_no < 50)
+                  currentID= currentID.substring(0,indDot);
+              }
+              catch(NumberFormatException nfe){}
+            }
           }
 
           int ind2 = currentID.indexOf(":");
@@ -416,7 +426,19 @@ public class FastaTextPane extends JScrollPane
  
           int indDot;
           if( (indDot = currentID.indexOf(".")) > 5)
-            currentID= currentID.substring(0,indDot);
+          {
+            String version = currentID.substring(indDot+1);
+            try
+            {
+              int version_no = Integer.parseInt(version);
+              // version number looks like uniprot so strip this
+              if(version_no < 50)
+                currentID= currentID.substring(0,indDot);
+            }
+            catch(NumberFormatException nfe){}
+
+            // HERE currentID= currentID.substring(0,indDot);
+          }
 
           if(hi != null)
             hi.setEndPosition(textPosition);
@@ -431,6 +453,7 @@ public class FastaTextPane extends JScrollPane
           if(ind1 > -1)
           {
             ind2 = line.indexOf(";",ind1);
+
             hi.setScore(line.substring(ind1+6,ind2));
      
             ind1 = ind2+1;
diff --git a/uk/ac/sanger/artemis/editor/HitInfo.java b/uk/ac/sanger/artemis/editor/HitInfo.java
index c2af1258d..c5aacf725 100644
--- a/uk/ac/sanger/artemis/editor/HitInfo.java
+++ b/uk/ac/sanger/artemis/editor/HitInfo.java
@@ -117,7 +117,16 @@ public class HitInfo
         // uniprot fasta headers
         // >pac.sv id desc
         //
-        id = id.substring(0,indDot);
+        String version = id.substring(indDot+1);
+        try
+        {
+          int version_no = Integer.parseInt(version);
+          // version number looks like uniprot so strip this
+          if(version_no < 50)
+            id = id.substring(0,indDot);
+        }
+        catch(NumberFormatException nfe){}
+
         acc = id;
       }
     }
@@ -177,7 +186,15 @@ public class HitInfo
         // uniprot fasta headers
         // >pac.sv id desc
         //
-        id = id.substring(0,indDot);
+        String version = id.substring(indDot+1);
+        try
+        {
+          int version_no = Integer.parseInt(version);
+          // version number looks like uniprot so strip this
+          if(version_no < 50)
+            id = id.substring(0,indDot);
+        }
+        catch(NumberFormatException nfe){}
         acc = id;
       }
     }
-- 
GitLab