Arbitrary decision to keep friendly id name when reading in uniprot headered fastA...
authorjprocter <Jim Procter>
Tue, 14 Jun 2005 15:44:03 +0000 (15:44 +0000)
committerjprocter <Jim Procter>
Tue, 14 Jun 2005 15:44:03 +0000 (15:44 +0000)
src/jalview/io/FastaFile.java

index 7e7e06b..adfa967 100755 (executable)
@@ -53,6 +53,9 @@ public class FastaFile extends AlignFile {
         while ((line = nextLine()) != null) {\r
             if (line.length() > 0) {\r
                 // Do we have an id line?\r
+                // JBPNote - this code needs to be standardised to EBI/whatever for the\r
+                // >dbref/dbref/dbref|refid1|refid2|refid3 'human-readable' style of naming (should it really exist)\r
+\r
                 if (line.substring(0, 1).equals(">")) {\r
                     if (count != 0) {\r
                         if (sstart != 0) {\r
@@ -73,17 +76,18 @@ public class FastaFile extends AlignFile {
                     id = id.substring(1);\r
 \r
                     com.stevesoft.pat.Regex dbId = new com.stevesoft.pat.Regex(\r
-                            "[A-Za-z-]+/[A-Za-z-]+\\|(\\w+)\\|(.+)");\r
-\r
+                            "[A-Za-z-]+/?[A-Za-z-]+\\|(\\w+)\\|(.+)");\r
+                    // JBPNote At the moment - we don't get rid of the friendly names but this\r
+                    // behaviour is probably wrong in the long run.\r
                     if (dbId.search(id)) {\r
                         String dbid = dbId.stringMatched(1);\r
                         String idname = dbId.stringMatched(2);\r
-\r
-                        if ((idname.length() > 0) &&\r
-                                (idname.indexOf("_") > -1)) {\r
-                            id = idname; // just use friendly name // JBPNote: we may lose uniprot standardised ID here.\r
-                        } else {\r
-                            id = dbid; // use dbid to ensure sensible queries\r
+                        if ( (idname.length() > 0) &&\r
+                             (idname.indexOf("_") > -1)) {\r
+                          id = idname; // use the friendly name - apparently no dbid\r
+                        } else\r
+                        if (dbid.length()>1) {\r
+                            id = dbid; // ignore the friendly name - we lose uniprot accession ID otherwise\r
                         }\r
                     }\r
 \r