/*\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
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
+ *\r
* This file is part of Jalview.\r
- * \r
+ *\r
* Jalview is free software: you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License \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
- * 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
+ *\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
+ *\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.analysis;\r
\r
import java.util.Enumeration;\r
+import java.util.List;\r
import java.util.Vector;\r
import java.util.Hashtable;\r
\r
/**\r
* Functions for cross-referencing sequence databases. user must first specify\r
* if cross-referencing from protein or dna (set dna==true)\r
- * \r
+ *\r
* @author JimP\r
- * \r
+ *\r
*/\r
public class CrossRef\r
{\r
/**\r
* get the DNA or protein references for a protein or dna sequence\r
- * \r
+ *\r
* @param dna\r
* @param rfs\r
* @return\r
public static Hashtable classifyDbRefs(DBRefEntry[] rfs)\r
{\r
Hashtable classes = new Hashtable();\r
- classes.put(DBRefSource.PROTEINDBS, jalview.util.DBRefUtils.selectRefs(\r
- rfs, DBRefSource.PROTEINDBS));\r
+ classes.put(DBRefSource.PROTEINDBS,\r
+ jalview.util.DBRefUtils.selectRefs(rfs, DBRefSource.PROTEINDBS));\r
classes.put(DBRefSource.DNACODINGDBS, jalview.util.DBRefUtils\r
.selectRefs(rfs, DBRefSource.DNACODINGDBS));\r
- classes.put(DBRefSource.DOMAINDBS, jalview.util.DBRefUtils.selectRefs(\r
- rfs, DBRefSource.DOMAINDBS));\r
+ classes.put(DBRefSource.DOMAINDBS,\r
+ jalview.util.DBRefUtils.selectRefs(rfs, DBRefSource.DOMAINDBS));\r
// classes.put(OTHER, )\r
return classes;\r
}\r
/**\r
* Indirect references are references from other sequences from the dataset to\r
* any of the direct DBRefEntrys on the given sequences.\r
- * \r
+ *\r
* @param dna\r
* true if seqs are DNA seqs\r
* @param seqs\r
}\r
\r
/**\r
- * \r
+ *\r
* @param dna\r
* @param seqs\r
* @return\r
}\r
\r
/**\r
- * \r
+ *\r
* @param seqs\r
* @param dna\r
* @param source\r
* find references to lrfs in the cross-reference set of each sequence in\r
* dataset (that is not equal to sequenceI) Identifies matching DBRefEntry\r
* based on source and accession string only - Map and Version are nulled.\r
- * \r
+ *\r
* @param sequenceI\r
* @param lrfs\r
* @param dataset\r
/**\r
* search a given sequence dataset for references matching cross-references to\r
* the given sequence\r
- * \r
+ *\r
* @param sequenceI\r
* @param xrf\r
* @param dataset\r
* TODO: generalise to different protein classifications Search dataset for\r
* DBRefEntrys matching the given one (xrf) and add the associated sequence to\r
* rseq.\r
- * \r
+ *\r
* @param sequenceI\r
* @param xrf\r
* @param dataset\r
System.err.println("Empty dataset sequence set - NO VECTOR");\r
return false;\r
}\r
- Enumeration e = dataset.getSequences().elements();\r
- while (e.hasMoreElements())\r
+ List<SequenceI> ds;\r
+ synchronized (ds=dataset.getSequences())\r
{\r
- SequenceI nxt = (SequenceI) e.nextElement();\r
+ for (SequenceI nxt:ds)\r
if (nxt != null)\r
{\r
if (nxt.getDatasetSequence() != null)\r
}\r
else\r
{\r
- poss = CrossRef.findXDbRefs(dna, poss); // \r
+ poss = CrossRef.findXDbRefs(dna, poss); //\r
cands = jalview.util.DBRefUtils.searchRefs(poss, xrf);\r
}\r
if (cands != null)\r
/**\r
* precalculate different products that can be found for seqs in dataset and\r
* return them.\r
- * \r
+ *\r
* @param dna\r
* @param seqs\r
* @param dataset\r