X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fio%2Fvamsas%2FSequencemapping.java;h=241ff8560346da1ac8dd38f479f63ba0afa76f52;hb=865a855a4ca87eadb3e5ff284ed32ed307d9c34b;hp=b0a3dd4124ab90ad9035efce973c74af28422a09;hpb=2de8acfae59aced665e4c37ad0f7dcc2ed68818e;p=jalview.git diff --git a/src/jalview/io/vamsas/Sequencemapping.java b/src/jalview/io/vamsas/Sequencemapping.java index b0a3dd4..241ff85 100644 --- a/src/jalview/io/vamsas/Sequencemapping.java +++ b/src/jalview/io/vamsas/Sequencemapping.java @@ -1,20 +1,20 @@ /* - * 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.8.0b1) + * Copyright (C) 2014 The Jalview Authors * - * 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. + * + * 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 this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + * 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; @@ -23,27 +23,25 @@ import java.util.Vector; import jalview.datamodel.AlignedCodonFrame; import jalview.datamodel.Mapping; import jalview.datamodel.SequenceI; +import jalview.gui.Desktop; import jalview.io.VamsasAppDatastore; import uk.ac.vamsas.client.Vobject; import uk.ac.vamsas.objects.core.AlignmentSequence; import uk.ac.vamsas.objects.core.DataSet; -import uk.ac.vamsas.objects.core.Local; -import uk.ac.vamsas.objects.core.RangeType; -import uk.ac.vamsas.objects.core.Seg; import uk.ac.vamsas.objects.core.Sequence; import uk.ac.vamsas.objects.core.SequenceMapping; import uk.ac.vamsas.objects.core.SequenceType; /** - * binds a vamsas sequence mapping object from the vamsas document to - * a maplist object associated with a mapping in the Jalview model. - * We use the maplist object because these are referred to both in - * the Mapping object associated with a jalview.datamodel.DBRefEntry - * and in the array of jalview.datamodel.AlCodonFrame objects that - * Jalview uses to propagate sequence mapping position highlighting - * across the views. + * binds a vamsas sequence mapping object from the vamsas document to a maplist + * object associated with a mapping in the Jalview model. We use the maplist + * object because these are referred to both in the Mapping object associated + * with a jalview.datamodel.DBRefEntry and in the array of + * jalview.datamodel.AlCodonFrame objects that Jalview uses to propagate + * sequence mapping position highlighting across the views. + * * @author JimP - * + * */ public class Sequencemapping extends Rangetype { @@ -53,10 +51,13 @@ public class Sequencemapping extends Rangetype super(datastore, sequenceMapping, jalview.util.MapList.class); doJvUpdate(); } + private SequenceType from; + private DataSet ds; + private Mapping mjvmapping; - + /** * create or update a vamsas sequence mapping corresponding to a jalview * Mapping between two dataset sequences @@ -78,14 +79,15 @@ public class Sequencemapping extends Rangetype validate(); doSync(); } + /** * local check that extant mapping context is valid */ public void validate() { - + SequenceMapping sequenceMapping = (SequenceMapping) vobj; - if (sequenceMapping==null) + if (sequenceMapping == null) { return; } @@ -102,7 +104,7 @@ public class Sequencemapping extends Rangetype + ds + " doesn't match the parent of the bound sequence mapping object."); } - } + } public void addToDocument() { @@ -117,18 +119,19 @@ public class Sequencemapping extends Rangetype public void conflict() { conflict(mjvmapping, (SequenceMapping) vobj); - + } public void updateToDoc() { update(mjvmapping, (SequenceMapping) vobj); } + public void updateFromDoc() { update((SequenceMapping) vobj, (jalview.datamodel.Mapping) jvobj); } - + private void conflict(Mapping mjvmapping, SequenceMapping sequenceMapping) { System.err.println("Conflict in update of sequenceMapping " @@ -222,7 +225,7 @@ public class Sequencemapping extends Rangetype } // private void update(jalview.util.MapList mjvmapping, - // SequenceMapping sequenceMapping) + // SequenceMapping sequenceMapping) { jalview.bin.Cache.log .error("Not implemented: Jalview Update Alcodon Mapping:TODO!"); @@ -234,6 +237,7 @@ public class Sequencemapping extends Rangetype jalview.bin.Cache.log .error("Not implemented: Update DBRef Mapping from Jalview"); } + private void update(jalview.datamodel.Mapping mjvmapping, SequenceMapping sequenceMapping) { @@ -242,9 +246,9 @@ public class Sequencemapping extends Rangetype } /** - * bind a SequenceMapping to a live AlCodonFrame element - * limitations: Currently, jalview only deals with mappings between dataset - * sequences, and even then, only between those that map from DNA to Protein. + * bind a SequenceMapping to a live AlCodonFrame element limitations: + * Currently, jalview only deals with mappings between dataset sequences, and + * even then, only between those that map from DNA to Protein. * * @param sequenceMapping */ @@ -341,9 +345,9 @@ public class Sequencemapping extends Rangetype if (!sense) { mapping = this.parsemapType(sequenceMapping, 1, 3); // invert sense - mapping = new jalview.util.MapList(mapping.getToRanges(), mapping - .getFromRanges(), mapping.getToRatio(), mapping - .getFromRatio()); + mapping = new jalview.util.MapList(mapping.getToRanges(), + mapping.getFromRanges(), mapping.getToRatio(), + mapping.getFromRatio()); afc.addMap(to, from, mapping); } else @@ -351,13 +355,15 @@ public class Sequencemapping extends Rangetype mapping = this.parsemapType(sequenceMapping, 3, 1); // correct sense afc.addMap(from, to, mapping); } - } else { + } + else + { mapping = this.parsemapType(sequenceMapping, 1, 1); // correct sense afc.addMap(from, to, mapping); } bindjvvobj(mapping, sequenceMapping); jalview.structure.StructureSelectionManager - .getStructureSelectionManager().addMappings( + .getStructureSelectionManager(Desktop.instance).addMappings( new AlignedCodonFrame[] { afc }); // Try to link up any conjugate database references in the two sequences @@ -371,12 +377,11 @@ public class Sequencemapping extends Rangetype * associated with conjugate DBRefEntry under given mapping * * @param from - * sequence corresponding to from reference for sequence - * mapping + * sequence corresponding to from reference for sequence mapping * @param to - * sequence correspondeing to to reference for sequence mapping + * sequence correspondeing to to reference for sequence mapping * @param smap - * maplist parsed in same sense as from and to + * maplist parsed in same sense as from and to */ private void matchConjugateDBRefs(SequenceI from, SequenceI to, jalview.util.MapList smap)