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 July 12, 2010 021 * Author: Mark Chapman 022 */ 023 024package org.biojava.nbio.alignment; 025 026import org.biojava.nbio.core.alignment.SimpleSequencePair; 027import org.biojava.nbio.core.alignment.template.AlignedSequence; 028import org.biojava.nbio.alignment.template.PairInProfileScorer; 029import org.biojava.nbio.core.alignment.template.Profile; 030import org.biojava.nbio.core.sequence.template.Compound; 031import org.biojava.nbio.core.sequence.template.Sequence; 032 033/** 034 * Implements an algorithm which computes a score for a sequence alignment pair picked from an alignment 035 * {@link Profile}. The reported score is the number of alignment columns which have identical {@link Compound}s. 036 * 037 * @author Mark Chapman 038 * @param <S> each {@link Sequence} of the alignment pair is of type S 039 * @param <C> each element of an {@link AlignedSequence} is a {@link Compound} of type C 040 */ 041public class FractionalIdentityInProfileScorer<S extends Sequence<C>, C extends Compound> 042 extends FractionalIdentityScorer<S, C> implements PairInProfileScorer<S, C> { 043 044 private Profile<S, C> profile; 045 046 /** 047 * Creates a fractional identity scorer for an aligned pair of sequences in the given alignment profile. 048 * 049 * @param profile alignment profile containing pair of sequences 050 * @param query index in the profile of the first sequence of the pair 051 * @param target index in the profile of the second sequence of the pair 052 */ 053 public FractionalIdentityInProfileScorer(Profile<S, C> profile, int query, int target) { 054 super(new SimpleSequencePair<S, C>(profile.getAlignedSequence(query), profile.getAlignedSequence(target))); 055 this.profile = profile; 056 } 057 058 @Override 059 public Profile<S, C> getProfile() { 060 return profile; 061 } 062 063}