001/*
002 *                    BioJava development code
003 *
004 * This code may be freely distributed and modified under the
005 * terms of the GNU Lesser General Public Licence.  This should
006 * be distributed with the code.  If you do not have a copy,
007 * see:
008 *
009 *      http://www.gnu.org/copyleft/lesser.html
010 *
011 * Copyright for this code is held jointly by the individual
012 * authors.  These should be listed in @author doc comments.
013 *
014 * For more information on the BioJava project and its aims,
015 * or to join the biojava-l mailing list, visit the home page
016 * at:
017 *
018 *      http://www.biojava.org/
019 *
020 * Created on June 22, 2010
021 * Author: Mark Chapman
022 */
023
024package org.biojava.nbio.core.alignment;
025
026import org.biojava.nbio.core.alignment.template.AlignedSequence;
027import org.biojava.nbio.core.alignment.template.AlignedSequence.Step;
028import org.biojava.nbio.core.alignment.template.Profile;
029import org.biojava.nbio.core.alignment.template.ProfilePair;
030import org.biojava.nbio.core.sequence.template.Compound;
031import org.biojava.nbio.core.sequence.template.Sequence;
032
033import java.util.List;
034
035/**
036 * Implements a data structure for the results of the alignment of a pair of {@link Profile}s.
037 *
038 * @author Mark Chapman
039 * @author Paolo Pavan
040 * @param <S> each element of an alignment {@link Profile} is of type S
041 * @param <C> each element of an {@link AlignedSequence} is a {@link Compound} of type C
042 */
043public class SimpleProfilePair<S extends Sequence<C>, C extends Compound> extends SimpleProfile<S, C>
044                implements ProfilePair<S, C> {
045
046
047        private static final long serialVersionUID = 1L;
048
049        private Profile<S, C> query, target;
050
051        /**
052         * Creates a pair profile for the given profiles.
053         *
054         * @param query the first profile of the pair
055         * @param target the second profile of the pair
056         * @param sx lists whether the query profile aligns a {@link Compound} or gap at each index of the alignment
057         * @param sy lists whether the target profile aligns a {@link Compound} or gap at each index of the alignment
058         * @throws IllegalArgumentException if alignments differ in size or given profiles do not fit in alignments
059         */
060        public SimpleProfilePair(Profile<S, C> query, Profile<S, C> target, List<Step> sx, List<Step> sy) {
061                super(query, target, sx, sy);
062                this.query = query;
063                this.target = target;
064        }
065
066        @Override
067        public Profile<S, C> getQuery() {
068                return query;
069        }
070
071        @Override
072        public Profile<S, C> getTarget() {
073                return target;
074        }
075
076}