- }\r
-\r
- if(sequence==null)\r
- continue;\r
-\r
- if( result[r].indexOf("<property type=\"pdb accession\"")>-1)\r
- {\r
- pdb = parseValue( result[r], "value=" , out);\r
- sequence.setPDBId(pdb);\r
- }\r
-\r
- if(result[r].indexOf("feature type")>-1)\r
- {\r
- type = parseValue( result[r], "type=" , out);\r
- description = parseValue( result[r], "description=" , null );\r
- status = parseValue ( result[r], "status=", null);\r
-\r
- while( result[r].indexOf("position")==-1)\r
- {\r
- r++; //<location>\r
- }\r
- // r++;\r
- if(result[r].indexOf("begin")>-1)\r
- {\r
- start = parseValue( result[r], "position=" , out);\r
- end = parseValue( result[++r], "position=" , out);\r
- }\r
- else\r
- {\r
- start = parseValue( result[r], "position=" , out);\r
- end = parseValue( result[r], "position=" , null);\r
- }\r
- int sstart = Integer.parseInt(start);\r
- int eend = Integer.parseInt(end);\r
- if(out!=null)\r
- try{ out.writeBytes("</feature>\n"); }catch(Exception ex){}\r
-\r
- SequenceFeature sf = new SequenceFeature(type,\r
- sstart,\r
- eend,\r
- description,\r
- status);\r
- features.add(sf);\r
- }\r
-\r
- if(result[r].indexOf("<sequence")>-1)\r
- {\r
- StringBuffer seqString = new StringBuffer();\r
-\r
- if(out!=null)\r
- try { out.writeBytes(result[r]+"\n"); } catch (Exception ex){}\r
-\r
- while(result[++r].indexOf("</sequence>")==-1)\r
- {\r
- seqString.append(result[r]);\r
- if(out!=null)\r
- try { out.writeBytes(result[r]+"\n"); } catch (Exception ex){}\r
- }\r
-\r
- if(out!=null)\r
- try { out.writeBytes(result[r]+"\n"); } catch (Exception ex){}\r
-\r
- StringBuffer nonGapped = new StringBuffer();\r
- for (int i = 0; i < sequence.getSequence().length(); i++)\r
- {\r
- if (!jalview.util.Comparison.isGap(sequence.getCharAt(i)))\r
- nonGapped.append(sequence.getCharAt(i));\r
- }\r
-\r
- int absStart = seqString.toString().indexOf(nonGapped.toString());\r
- if(absStart==-1)\r
- {\r
- unknownSequences.add(sequence.getName());\r
- features = null;\r
- sbuffer.append(sequence.getName()+ " SEQUENCE NOT %100 MATCH \n");\r
- continue;\r
- }\r
-\r
- int absEnd = absStart + nonGapped.toString().length();\r
- absStart+=1;\r
-\r
- if(absStart!=sequence.getStart() || absEnd!=sequence.getEnd())\r
- sbuffer.append("Updated: "+sequence.getName()+" "+\r
- sequence.getStart()+"/"+sequence.getEnd()+" to "+ absStart+"/"+absEnd+"\n");\r
-\r
-\r
- sequence.setStart(absStart);\r
- sequence.setEnd(absEnd);\r
-\r
- }\r
-\r
- if(result[r].indexOf("</entry>")>-1)\r
- {\r
- if(features!=null)\r
- sequence.setSequenceFeatures( features );\r
- features = null;\r
- sequence = null;\r
- if(out!=null)\r
- try{ out.writeBytes("</entry>\n"); }catch(Exception ex){}\r
-\r
- }\r
- }\r
-}\r