X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fanalysis%2FCrossRef.java;h=8bc844bc3bc3e46d906fd80f26f0620c96d540ee;hb=506d60f0e188723ddc91c26824b41ac7034df3fe;hp=159d96a2a9a2a76fc3198dd95384cbf3ed38dcd6;hpb=60f2d6c034560415fd0139c8bc7df0c19cae1186;p=jalview.git diff --git a/src/jalview/analysis/CrossRef.java b/src/jalview/analysis/CrossRef.java index 159d96a..8bc844b 100644 --- a/src/jalview/analysis/CrossRef.java +++ b/src/jalview/analysis/CrossRef.java @@ -1,3 +1,21 @@ +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 AM Waterhouse, J Procter, 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 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. + * + * 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 + */ package jalview.analysis; import java.util.Enumeration; @@ -158,7 +176,8 @@ public class CrossRef { if (cdna[c].getSource().equals(DBRefSource.EMBLCDS)) { - System.err.println("TODO: unimplemented sequence retrieval for coding region sequence."); + System.err + .println("TODO: unimplemented sequence retrieval for coding region sequence."); // TODO: retrieve CDS dataset sequences // need global dataset sequence retriever/resolver to reuse refs // and construct Mapping entry. @@ -306,7 +325,10 @@ public class CrossRef xrfs = t; try { - retrieved = sftch.getSequences(xrfs); // problem here is we don't know which of xrfs resulted in which retrieved element + retrieved = sftch.getSequences(xrfs); // problem here is we don't + // know which of xrfs + // resulted in which + // retrieved element } catch (Exception e) { System.err @@ -319,32 +341,39 @@ public class CrossRef for (int rs = 0; rs < retrieved.length; rs++) { // TODO: examine each sequence for 'redundancy' - jalview.datamodel.DBRefEntry[] dbr = retrieved[rs].getDBRef(); + jalview.datamodel.DBRefEntry[] dbr = retrieved[rs] + .getDBRef(); if (dbr != null && dbr.length > 0) { for (int di = 0; di < dbr.length; di++) { - // find any entry where we should put in the sequence being cross-referenced into the map + // find any entry where we should put in the sequence being + // cross-referenced into the map jalview.datamodel.Mapping map = dbr[di].getMap(); if (map != null) { if (map.getTo() != null && map.getMap() != null) { - // should search the local dataset to find any existing candidates for To ! + // should search the local dataset to find any existing + // candidates for To ! try { - // compare ms with dss and replace with dss in mapping if map is congruent + // compare ms with dss and replace with dss in mapping + // if map is congruent SequenceI ms = map.getTo(); int sf = map.getMap().getToLowest(); int st = map.getMap().getToHighest(); SequenceI mappedrg = ms.getSubSequence(sf, st); SequenceI loc = dss.getSubSequence(sf, st); - if (mappedrg.getLength()>0 && mappedrg.getSequenceAsString().equals( - loc.getSequenceAsString())) + if (mappedrg.getLength() > 0 + && mappedrg.getSequenceAsString().equals( + loc.getSequenceAsString())) { System.err .println("Mapping updated for retrieved crossreference"); - // method to update all refs of existing To on retrieved sequence with dss and merge any props on To onto dss. + // method to update all refs of existing To on + // retrieved sequence with dss and merge any props + // on To onto dss. map.setTo(dss); } } catch (Exception e) @@ -445,7 +474,7 @@ public class CrossRef boolean direct, boolean dna) { boolean found = false; - SequenceI[] typer=new SequenceI[1]; + SequenceI[] typer = new SequenceI[1]; if (dataset == null) return false; if (dataset.getSequences() == null) @@ -470,7 +499,7 @@ public class CrossRef { typer[0] = nxt; boolean isDna = jalview.util.Comparison.isNucleotide(typer); - if ((direct && isDna == dna) || (!direct && isDna!=dna)) + if ((direct && isDna == dna) || (!direct && isDna != dna)) { // skip this sequence because it is same molecule type continue; @@ -550,16 +579,17 @@ public class CrossRef * System.out.println("Found " + ((prod == null) ? "no" : "" + * prod.length) + " products"); if (prod!=null) { for (int p=0; p