/*\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.7)\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, 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.analysis;\r
\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
/**\r
* @param dna\r
- * true if seqs are DNA seqs\r
+ * true if seqs are DNA seqs\r
* @param seqs\r
* @return a list of sequence database cross reference source types\r
*/\r
* any of the direct DBRefEntrys on the given sequences.\r
* \r
* @param dna\r
- * true if seqs are DNA seqs\r
+ * true if seqs are DNA seqs\r
* @param seqs\r
* @return a list of sequence database cross reference source types\r
*/\r
* @param dna\r
* @param source\r
* @param dataset\r
- * alignment to search for product sequences.\r
+ * alignment to search for product sequences.\r
* @return products (as dataset sequences)\r
*/\r
public static Alignment findXrefSequences(SequenceI[] seqs, boolean dna,\r
// xrefs on this sequence.\r
if (dataset != null)\r
{\r
- found |= searchDataset(dss, xrfs[r], dataset, rseqs, cf);\r
+ found |= searchDataset(dss, xrfs[r], dataset, rseqs, cf); // ,false,!dna);\r
if (found)\r
xrfs[r] = null; // we've recovered seqs for this one.\r
}\r
* @param xrf\r
* @param dataset\r
* @param rseqs\r
- * set of unique sequences\r
+ * set of unique sequences\r
* @param cf\r
* @return true if one or more unique sequences were found and added\r
*/\r
* @param xrf\r
* @param dataset\r
* @param rseqs\r
- * @param direct -\r
- * search all references or only subset\r
+ * @param direct\r
+ * - search all references or only subset\r
* @param dna\r
- * search dna or protein xrefs (if direct=false)\r
+ * search dna or protein xrefs (if direct=false)\r
* @return true if relationship found and sequence added.\r
*/\r
public static boolean searchDataset(SequenceI sequenceI, DBRefEntry xrf,\r
}\r
\r
// look for direct or indirect references in common\r
- DBRefEntry[] poss = null, cands = null;\r
+ DBRefEntry[] poss = nxt.getDBRef(), cands = null;\r
if (direct)\r
{\r
- cands = jalview.util.DBRefUtils.searchRefs(poss = nxt\r
- .getDBRef(), xrf);\r
+ cands = jalview.util.DBRefUtils.searchRefs(poss, xrf);\r
}\r
else\r
{\r
- cands = jalview.util.DBRefUtils.searchRefs(poss = CrossRef\r
- .findXDbRefs(dna, nxt.getDBRef()), xrf);\r
+ poss = CrossRef.findXDbRefs(dna, poss); //\r
+ cands = jalview.util.DBRefUtils.searchRefs(poss, xrf);\r
}\r
if (cands != null)\r
{\r
* @param dna\r
* @param seqs\r
* @param dataset\r
- * @param fake -\r
- * don't actually build lists - just get types\r
+ * @param fake\r
+ * - don't actually build lists - just get types\r
* @return public static Object[] buildXProductsList(boolean dna, SequenceI[]\r
* seqs, AlignmentI dataset, boolean fake) { String types[] =\r
* jalview.analysis.CrossRef.findSequenceXrefTypes( dna, seqs,\r
* System.out.println("Type: " + types[t]); SequenceI[] prod =\r
* jalview.analysis.CrossRef.findXrefSequences(seqs, dna, types[t]);\r
* System.out.println("Found " + ((prod == null) ? "no" : "" +\r
- * prod.length) + " products"); if (prod!=null) { for (int p=0; p<prod.length;\r
- * p++) { System.out.println("Prod "+p+":\r
+ * prod.length) + " products"); if (prod!=null) { for (int p=0;\r
+ * p<prod.length; p++) { System.out.println("Prod "+p+":\r
* "+prod[p].getDisplayId(true)); } } } } else {\r
* System.out.println("Trying getProducts for\r
* "+al.getSequenceAt(0).getDisplayId(true));\r
- * System.out.println("Search DS Xref for: "+(dna ? "dna" : "prot")); //\r
- * have a bash at finding the products amongst all the retrieved\r
+ * System.out.println("Search DS Xref for: "+(dna ? "dna" : "prot"));\r
+ * // have a bash at finding the products amongst all the retrieved\r
* sequences. SequenceI[] prod =\r
* jalview.analysis.CrossRef.findXrefSequences(al\r
* .getSequencesArray(), dna, null, ds); System.out.println("Found " +\r
* ((prod == null) ? "no" : "" + prod.length) + " products"); if\r
* (prod!=null) { // select non-equivalent sequences from dataset list\r
- * for (int p=0; p<prod.length; p++) { System.out.println("Prod\r
- * "+p+": "+prod[p].getDisplayId(true)); } } } }\r
+ * for (int p=0; p<prod.length; p++) { System.out.println("Prod "+p+":\r
+ * "+prod[p].getDisplayId(true)); } } } }\r
*/\r
}\r