X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=forester%2Fjava%2Fsrc%2Forg%2Fforester%2Fmsa%2FResampleableMsa.java;h=4427ea7fe47ffed8f652587851c3673c1e9fa4be;hb=327fc7c7a9a46cbe8983b0ca2a54cc6f45cd1695;hp=7476cadc83e9d69548f29166fb0b15a4aab417b3;hpb=48f7a89be9d34f1930a1f863e608235cc27184c5;p=jalview.git diff --git a/forester/java/src/org/forester/msa/ResampleableMsa.java b/forester/java/src/org/forester/msa/ResampleableMsa.java index 7476cad..4427ea7 100644 --- a/forester/java/src/org/forester/msa/ResampleableMsa.java +++ b/forester/java/src/org/forester/msa/ResampleableMsa.java @@ -5,7 +5,7 @@ // Copyright (C) 2010 Christian M Zmasek // Copyright (C) 2010 Sanford-Burnham Medical Research Institute // All rights reserved -// +// // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either @@ -15,16 +15,19 @@ // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. -// +// // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA // // Contact: phylosoft @ gmail . com -// WWW: www.phylosoft.org/forester +// WWW: https://sites.google.com/site/cmzmasek/home/software/forester package org.forester.msa; +import org.forester.sequence.BasicSequence; +import org.forester.sequence.Sequence; + public final class ResampleableMsa extends BasicMsa { private int[] _resampled_column_positions = null; @@ -33,9 +36,16 @@ public final class ResampleableMsa extends BasicMsa { super( msa ); } - public void resample( final int[] resampled_column_positions ) { + @Override + final public char getResidueAt( final int row, final int col ) { + if ( _resampled_column_positions != null ) { + return super.getResidueAt( row, _resampled_column_positions[ col ] ); + } + return super.getResidueAt( row, col ); + } + + final public void resample( final int[] resampled_column_positions ) { if ( resampled_column_positions.length != getLength() ) { - _resampled_column_positions = null; throw new IllegalArgumentException( "illegal attempt to use " + resampled_column_positions.length + " resampled column positions on msa of length " + getLength() ); } @@ -43,15 +53,12 @@ public final class ResampleableMsa extends BasicMsa { } @Override - public char getResidueAt( final int row, final int col ) { - if ( _resampled_column_positions != null ) { - return super.getResidueAt( row, _resampled_column_positions[ col ] ); - } - return super.getResidueAt( row, col ); + final public void setResidueAt( final int row, final int col, final char residue ) { + throw new NoSuchMethodError( "illegal attempt to set residue in resampleable msa" ); } @Override - public void setResidueAt( final int row, final int col, final char residue ) { - throw new NoSuchMethodError( "illegal attempt to set residue in resampleable msa" ); + public Sequence getSequence( final int row ) { + return new BasicSequence( getIdentifier( row ), getSequenceAsString( row ).toString(), getType() ); } }