X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fws%2FDBRefFetcher.java;h=ad8c0f090de983a099e69c82841db784e2a7790a;hb=153dd62dc91da13ae732600e6ea55ddbe15eab39;hp=73d106a85fb60a9701d08bdc01ed3223fb05b24f;hpb=4ec235370b49c38ae7e7b3a46f92f926fc430bf1;p=jalview.git diff --git a/src/jalview/ws/DBRefFetcher.java b/src/jalview/ws/DBRefFetcher.java index 73d106a..ad8c0f0 100644 --- a/src/jalview/ws/DBRefFetcher.java +++ b/src/jalview/ws/DBRefFetcher.java @@ -1,20 +1,19 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer (Development Version 2.4.1) - * Copyright (C) 2009 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.6) + * Copyright (C) 2010 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. + * This file is part of Jalview. * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . */ package jalview.ws; @@ -500,6 +499,13 @@ public class DBRefFetcher implements Runnable DBRefEntry[] entryRefs = jalview.util.DBRefUtils.selectRefs(entry .getDBRef(), new String[] { dbSource }); + if (entryRefs == null) + { + System.err + .println("Dud dbSource string ? no entryrefs selected for " + + dbSource + " on " + entry.getName()); + continue; + } for (int j = 0; j < entryRefs.length; j++) { String accessionId = entryRefs[j].getAccessionId(); // .getAccession().elementAt(j).toString(); @@ -612,24 +618,26 @@ public class DBRefFetcher implements Runnable // absStart+sequence.getStart()+entrySeq.length()-1}, // new int[] { entry.getStart(), entry.getEnd() }, 1, 1); // relocate local features for updated start - if (updateRefFrame) { + if (updateRefFrame) + { if (sequence.getSequenceFeatures() != null) { - SequenceFeature[] sf = sequence.getSequenceFeatures(); - int start = sequence.getStart(); - int end = sequence.getEnd(); - int startShift = 1 - absStart - start; // how much the features are - // to be shifted by - for (int sfi = 0; sfi < sf.length; sfi++) - { - if (sf[sfi].getBegin() >= start && sf[sfi].getEnd() <= end) + SequenceFeature[] sf = sequence.getSequenceFeatures(); + int start = sequence.getStart(); + int end = sequence.getEnd(); + int startShift = 1 - absStart - start; // how much the features + // are + // to be shifted by + for (int sfi = 0; sfi < sf.length; sfi++) { - // shift feature along by absstart - sf[sfi].setBegin(sf[sfi].getBegin() + startShift); - sf[sfi].setEnd(sf[sfi].getEnd() + startShift); + if (sf[sfi].getBegin() >= start && sf[sfi].getEnd() <= end) + { + // shift feature along by absstart + sf[sfi].setBegin(sf[sfi].getBegin() + startShift); + sf[sfi].setEnd(sf[sfi].getEnd() + startShift); + } } } - } } } @@ -645,21 +653,28 @@ public class DBRefFetcher implements Runnable sequence.setStart(absStart); sequence.setEnd(absEnd); // search for alignment sequences to update coordinate frame for - for (int alsq = 0; alsq