X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fio%2Fvamsas%2FSequencemapping.java;h=2bcef3a9b55815914eee27c8a82de2bda1e50366;hb=16d109024847af92482237e43f99b82fd997451a;hp=d8c2a95f3e2559328f838261783c70846db05a47;hpb=a8f483d04205bb8273ee311c12968b7e86d205fa;p=jalview.git diff --git a/src/jalview/io/vamsas/Sequencemapping.java b/src/jalview/io/vamsas/Sequencemapping.java index d8c2a95..2bcef3a 100644 --- a/src/jalview/io/vamsas/Sequencemapping.java +++ b/src/jalview/io/vamsas/Sequencemapping.java @@ -1,31 +1,34 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2) - * Copyright (C) 2014 The Jalview Authors + * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) + * Copyright (C) $$Year-Rel$$ The Jalview Authors * * This file is part of Jalview. * * 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. + * as published by the Free Software Foundation, either version 3 + * of the License, or (at your option) any later version. * * 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 . + * You should have received a copy of the GNU General Public License + * along with Jalview. If not, see . * The Jalview Authors are detailed in the 'AUTHORS' file. */ package jalview.io.vamsas; -import java.util.Vector; - import jalview.datamodel.AlignedCodonFrame; +import jalview.datamodel.AlignmentI; import jalview.datamodel.Mapping; import jalview.datamodel.SequenceI; import jalview.gui.Desktop; import jalview.io.VamsasAppDatastore; -import uk.ac.vamsas.client.Vobject; + +import java.util.Vector; + import uk.ac.vamsas.objects.core.AlignmentSequence; import uk.ac.vamsas.objects.core.DataSet; import uk.ac.vamsas.objects.core.Sequence; @@ -99,10 +102,8 @@ public class Sequencemapping extends Rangetype if (ds != null && sequenceMapping.is__stored_in_document() && sequenceMapping.getV_parent() != ds) { - jalview.bin.Cache.log - .warn("Probable IMPLEMENTATION ERROR: " - + ds - + " doesn't match the parent of the bound sequence mapping object."); + jalview.bin.Cache.log.warn("Probable IMPLEMENTATION ERROR: " + ds + + " doesn't match the parent of the bound sequence mapping object."); } } @@ -149,8 +150,8 @@ public class Sequencemapping extends Rangetype SequenceType to = (SequenceType) getjv2vObj(jvto); if (to == null) { - jalview.bin.Cache.log - .warn("FIXME NONFATAL - do a second update: Ignoring Forward Reference to seuqence not yet bound to vamsas seuqence object"); + jalview.bin.Cache.log.warn( + "FIXME NONFATAL - do a second update: Ignoring Forward Reference to seuqence not yet bound to vamsas seuqence object"); return; } SequenceMapping sequenceMapping = new SequenceMapping(); @@ -180,8 +181,8 @@ public class Sequencemapping extends Rangetype if (!dnaToProt) { - jalview.bin.Cache.log - .warn("Ignoring Mapping - don't support protein to protein mapping in vamsas document yet."); + jalview.bin.Cache.log.warn( + "Ignoring Mapping - don't support protein to protein mapping in vamsas document yet."); return; } if (ds == null) @@ -208,8 +209,8 @@ public class Sequencemapping extends Rangetype true); } ds.addSequenceMapping(sequenceMapping); - sequenceMapping.setProvenance(this - .dummyProvenance("user defined coding region translation")); // TODO: + sequenceMapping.setProvenance( + this.dummyProvenance("user defined coding region translation")); // TODO: // correctly // construct // provenance @@ -220,8 +221,8 @@ public class Sequencemapping extends Rangetype // mapping bindjvvobj(mjvmapping.getMap(), sequenceMapping); - jalview.bin.Cache.log.debug("Successfully created mapping " - + sequenceMapping.getVorbaId()); + jalview.bin.Cache.log.debug( + "Successfully created mapping " + sequenceMapping.getVorbaId()); } // private void update(jalview.util.MapList mjvmapping, @@ -241,8 +242,8 @@ public class Sequencemapping extends Rangetype private void update(jalview.datamodel.Mapping mjvmapping, SequenceMapping sequenceMapping) { - jalview.bin.Cache.log - .error("Not implemented: Jalview Update Sequence DBRef Mapping"); + jalview.bin.Cache.log.error( + "Not implemented: Jalview Update Sequence DBRef Mapping"); } /** @@ -281,12 +282,12 @@ public class Sequencemapping extends Rangetype jalview.bin.Cache.log.info("Ignoring non sequence-sequence mapping"); return; } - mobj = this.getvObj2jv((Vobject) sdloc); + mobj = this.getvObj2jv(sdloc); if (mobj instanceof SequenceI) { from = (SequenceI) mobj; } - mobj = this.getvObj2jv((Vobject) sdmap); + mobj = this.getvObj2jv(sdmap); if (mobj instanceof SequenceI) { to = (SequenceI) mobj; @@ -294,8 +295,8 @@ public class Sequencemapping extends Rangetype if (from == null || to == null) { - jalview.bin.Cache.log - .error("Probable Vamsas implementation error : unbound dataset sequences involved in a mapping are being parsed!"); + jalview.bin.Cache.log.error( + "Probable Vamsas implementation error : unbound dataset sequences involved in a mapping are being parsed!"); return; } @@ -323,19 +324,17 @@ public class Sequencemapping extends Rangetype } // create mapping storage object and make each dataset alignment reference // it. - jalview.datamodel.AlignmentI dsLoc = (jalview.datamodel.AlignmentI) getvObj2jv(sdloc - .getV_parent()); - jalview.datamodel.AlignmentI dsMap = (jalview.datamodel.AlignmentI) getvObj2jv(sdmap - .getV_parent()); - AlignedCodonFrame afc = new AlignedCodonFrame(0); + AlignmentI dsLoc = (AlignmentI) getvObj2jv(sdloc.getV_parent()); + AlignmentI dsMap = (AlignmentI) getvObj2jv(sdmap.getV_parent()); + AlignedCodonFrame acf = new AlignedCodonFrame(); if (dsLoc != null && dsLoc != dsMap) { - dsLoc.addCodonFrame(afc); + dsLoc.addCodonFrame(acf); } if (dsMap != null) { - dsMap.addCodonFrame(afc); + dsMap.addCodonFrame(acf); } // create and add the new mapping to (each) dataset's codonFrame @@ -348,24 +347,23 @@ public class Sequencemapping extends Rangetype mapping = new jalview.util.MapList(mapping.getToRanges(), mapping.getFromRanges(), mapping.getToRatio(), mapping.getFromRatio()); - afc.addMap(to, from, mapping); + acf.addMap(to, from, mapping); } else { mapping = this.parsemapType(sequenceMapping, 3, 1); // correct sense - afc.addMap(from, to, mapping); + acf.addMap(from, to, mapping); } } else { mapping = this.parsemapType(sequenceMapping, 1, 1); // correct sense - afc.addMap(from, to, mapping); + acf.addMap(from, to, mapping); } bindjvvobj(mapping, sequenceMapping); jalview.structure.StructureSelectionManager - .getStructureSelectionManager(Desktop.instance).addMappings( - new AlignedCodonFrame[] - { afc }); + .getStructureSelectionManager(Desktop.instance) + .registerMapping(acf); // Try to link up any conjugate database references in the two sequences // matchConjugateDBRefs(from, to, mapping); // Try to propagate any dbrefs across this mapping. @@ -386,7 +384,7 @@ public class Sequencemapping extends Rangetype private void matchConjugateDBRefs(SequenceI from, SequenceI to, jalview.util.MapList smap) { - if (from.getDBRef() == null && to.getDBRef() == null) + if (from.getDBRefs() == null && to.getDBRefs() == null) { if (jalview.bin.Cache.log.isDebugEnabled()) { @@ -400,11 +398,11 @@ public class Sequencemapping extends Rangetype jalview.bin.Cache.log.debug("Matching conjugate refs for " + from.getName() + " and " + to.getName()); } - jalview.datamodel.DBRefEntry[] fdb = from.getDBRef(); + jalview.datamodel.DBRefEntry[] fdb = from.getDBRefs(); jalview.datamodel.DBRefEntry[] tdb = new jalview.datamodel.DBRefEntry[to - .getDBRef().length]; - int tdblen = to.getDBRef().length; - System.arraycopy(to.getDBRef(), 0, tdb, 0, tdblen); + .getDBRefs().length]; + int tdblen = to.getDBRefs().length; + System.arraycopy(to.getDBRefs(), 0, tdb, 0, tdblen); Vector matched = new Vector(); jalview.util.MapList smapI = smap.getInverse(); for (int f = 0; f < fdb.length; f++) @@ -442,8 +440,9 @@ public class Sequencemapping extends Rangetype boolean smaptolocal2tm = (tmpnnl) ? smap.equals(tmp.getMap()) : false; // smap to maps from te.map to te.local - boolean smaptotemap2local = (tmpnnl) ? smapI.equals(fmp - .getMap()) : false; + boolean smaptotemap2local = (tmpnnl) + ? smapI.equals(fmp.getMap()) + : false; if (smapfromlocal2fe && smaptotemap2local) { // smap implies mapping from to to from