/*\r
- * Jalview - A Sequence Alignment Editor and Viewer (Development Version 2.4.1)\r
- * Copyright (C) 2009 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.6)\r
+ * Copyright (C) 2010 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
* \r
- * This program is free software; you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License\r
- * as published by the Free Software Foundation; either version 2\r
- * of the License, or (at your option) any later version.\r
+ * This file is part of Jalview.\r
* \r
- * This program is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
- * GNU General Public License for more details.\r
+ * Jalview is free software: you can redistribute it and/or\r
+ * modify it under the terms of the GNU General Public License \r
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\r
* \r
- * You should have received a copy of the GNU General Public License\r
- * along with this program; if not, write to the Free Software\r
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA\r
+ * Jalview is distributed in the hope that it will be useful, but \r
+ * WITHOUT ANY WARRANTY; without even the implied warranty \r
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR \r
+ * PURPOSE. See the GNU General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.\r
*/\r
package jalview.ws;\r
\r
String[] defdb = null, otherdb = sfetcher\r
.getDbInstances(jalview.ws.dbsources.DasSequenceSource.class);\r
Vector selsources = new Vector(), dasselsrc = (af.featureSettings != null) ? af.featureSettings\r
- .getSelectedSources()\r
- : new jalview.gui.DasSourceBrowser().getSelectedSources();\r
+ .getSelectedSources() : new jalview.gui.DasSourceBrowser()\r
+ .getSelectedSources();\r
Enumeration en = dasselsrc.elements();\r
while (en.hasMoreElements())\r
{\r
{\r
String[] newsrc = new String[dbSources.length + otherdb.length];\r
System.arraycopy(dbSources, 0, newsrc, 0, dbSources.length);\r
- System\r
- .arraycopy(otherdb, 0, newsrc, dbSources.length,\r
- otherdb.length);\r
+ System.arraycopy(otherdb, 0, newsrc, dbSources.length, otherdb.length);\r
dbSources = newsrc;\r
}\r
}\r
for (int j = 0; j < uprefs.length; j++)\r
{\r
addSeqId(sequence, uprefs[j].getAccessionId());\r
- queries\r
- .addElement(uprefs[j].getAccessionId()\r
- .toUpperCase());\r
+ queries.addElement(uprefs[j].getAccessionId().toUpperCase());\r
}\r
}\r
else\r
try\r
{\r
presp = picrClient\r
- .getUPIForAccession(token, null, picrClient\r
- .getMappedDatabaseNames(), null, true);\r
+ .getUPIForAccession(token, null,\r
+ picrClient.getMappedDatabaseNames(),\r
+ null, true);\r
} catch (Exception e)\r
{\r
System.err.println("Exception with Picr for '" + token\r
} // all databases have been queries.\r
if (sbuffer.length() > 0)\r
{\r
- output\r
- .setText("Your sequences have been verified against known sequence databases. Some of the ids have been\n"\r
- + "altered, most likely the start/end residue will have been updated.\n"\r
- + "Save your alignment to maintain the updated id.\n\n"\r
- + sbuffer.toString());\r
+ output.setText("Your sequences have been verified against known sequence databases. Some of the ids have been\n"\r
+ + "altered, most likely the start/end residue will have been updated.\n"\r
+ + "Save your alignment to maintain the updated id.\n\n"\r
+ + sbuffer.toString());\r
Desktop.addInternalFrame(output, "Sequence names updated ", 600, 300);\r
// The above is the dataset, we must now find out the index\r
// of the viewed sequence\r
// taking into account all accessionIds and names in the file\r
Vector sequenceMatches = new Vector();\r
// look for corresponding accession ids\r
- DBRefEntry[] entryRefs = jalview.util.DBRefUtils.selectRefs(entry\r
- .getDBRef(), new String[]\r
- { dbSource });\r
- if (entryRefs==null) {\r
- System.err.println("Dud dbSource string ? no entryrefs selected for "+dbSource+ " on "+entry.getName());\r
+ DBRefEntry[] entryRefs = jalview.util.DBRefUtils.selectRefs(\r
+ entry.getDBRef(), new String[]\r
+ { dbSource });\r
+ if (entryRefs == null)\r
+ {\r
+ System.err\r
+ .println("Dud dbSource string ? no entryrefs selected for "\r
+ + dbSource + " on " + entry.getName());\r
continue;\r
}\r
for (int j = 0; j < entryRefs.length; j++)\r
+ {\r
+ String accessionId = entryRefs[j].getAccessionId(); // .getAccession().elementAt(j).toString();\r
+ // match up on accessionId\r
+ if (seqRefs.containsKey(accessionId.toUpperCase()))\r
{\r
- String accessionId = entryRefs[j].getAccessionId(); // .getAccession().elementAt(j).toString();\r
- // match up on accessionId\r
- if (seqRefs.containsKey(accessionId.toUpperCase()))\r
+ Vector seqs = (Vector) seqRefs.get(accessionId);\r
+ for (int jj = 0; jj < seqs.size(); jj++)\r
{\r
- Vector seqs = (Vector) seqRefs.get(accessionId);\r
- for (int jj = 0; jj < seqs.size(); jj++)\r
+ sequence = (SequenceI) seqs.elementAt(jj);\r
+ if (!sequenceMatches.contains(sequence))\r
{\r
- sequence = (SequenceI) seqs.elementAt(jj);\r
- if (!sequenceMatches.contains(sequence))\r
- {\r
- sequenceMatches.addElement(sequence);\r
- }\r
+ sequenceMatches.addElement(sequence);\r
}\r
}\r
}\r
- if (sequenceMatches.size() == 0)\r
- {\r
- // failed to match directly on accessionId==query so just compare all\r
- // sequences to entry\r
+ }\r
+ if (sequenceMatches.size() == 0)\r
+ {\r
+ // failed to match directly on accessionId==query so just compare all\r
+ // sequences to entry\r
Enumeration e = seqRefs.keys();\r
while (e.hasMoreElements())\r
{\r
// absStart+sequence.getStart()+entrySeq.length()-1},\r
// new int[] { entry.getStart(), entry.getEnd() }, 1, 1);\r
// relocate local features for updated start\r
- if (updateRefFrame) {\r
+ if (updateRefFrame)\r
+ {\r
if (sequence.getSequenceFeatures() != null)\r
{\r
- SequenceFeature[] sf = sequence.getSequenceFeatures();\r
- int start = sequence.getStart();\r
- int end = sequence.getEnd();\r
- int startShift = 1 - absStart - start; // how much the features are\r
- // to be shifted by\r
- for (int sfi = 0; sfi < sf.length; sfi++)\r
- {\r
- if (sf[sfi].getBegin() >= start && sf[sfi].getEnd() <= end)\r
+ SequenceFeature[] sf = sequence.getSequenceFeatures();\r
+ int start = sequence.getStart();\r
+ int end = sequence.getEnd();\r
+ int startShift = 1 - absStart - start; // how much the features\r
+ // are\r
+ // to be shifted by\r
+ for (int sfi = 0; sfi < sf.length; sfi++)\r
{\r
- // shift feature along by absstart\r
- sf[sfi].setBegin(sf[sfi].getBegin() + startShift);\r
- sf[sfi].setEnd(sf[sfi].getEnd() + startShift);\r
+ if (sf[sfi].getBegin() >= start && sf[sfi].getEnd() <= end)\r
+ {\r
+ // shift feature along by absstart\r
+ sf[sfi].setBegin(sf[sfi].getBegin() + startShift);\r
+ sf[sfi].setEnd(sf[sfi].getEnd() + startShift);\r
+ }\r
}\r
}\r
- }\r
}\r
}\r
\r
sequence.setStart(absStart);\r
sequence.setEnd(absEnd);\r
// search for alignment sequences to update coordinate frame for\r
- for (int alsq = 0; alsq<alseqs.length; alsq++)\r
+ for (int alsq = 0; alsq < alseqs.length; alsq++)\r
{\r
- if (alseqs[alsq].getDatasetSequence()==sequence)\r
+ if (alseqs[alsq].getDatasetSequence() == sequence)\r
{\r
String ngAlsq = AlignSeq.extractGaps("-. ",\r
alseqs[alsq].getSequenceAsString()).toUpperCase();\r
int oldstrt = alseqs[alsq].getStart();\r
- alseqs[alsq].setStart(sequence.getSequenceAsString().toUpperCase().indexOf(ngAlsq)+sequence.getStart());\r
- if (oldstrt != alseqs[alsq].getStart()) {\r
- alseqs[alsq].setEnd(ngAlsq.length()+alseqs[alsq].getStart()-1);\r
+ alseqs[alsq].setStart(sequence.getSequenceAsString()\r
+ .toUpperCase().indexOf(ngAlsq)\r
+ + sequence.getStart());\r
+ if (oldstrt != alseqs[alsq].getStart())\r
+ {\r
+ alseqs[alsq].setEnd(ngAlsq.length()\r
+ + alseqs[alsq].getStart() - 1);\r
}\r
}\r
}\r
- // TODO: search for all other references to this dataset sequence, and update start/end\r
- // TODO: update all AlCodonMappings which involve this alignment sequence (e.g. Q30167 cdna translation from exon2 product (vamsas demo)\r
+ // TODO: search for all other references to this dataset sequence, and\r
+ // update start/end\r
+ // TODO: update all AlCodonMappings which involve this alignment\r
+ // sequence (e.g. Q30167 cdna translation from exon2 product (vamsas\r
+ // demo)\r
}\r
// and remove it from the rest\r
// TODO: decide if we should remove annotated sequence from set\r