import java.util.*; import java.io.*; /**Class for scoring sequences * A sequence is passed to an instance of this class * then the sequence is scored as if it was a -35 sequence. * If this score is above some threshold, the -10 region * is located and scored. If the total score (based on * -10 and -35 scores in addition to a score according to the distance * between the -10 and -35 regions) is above another threshold, a * candidate object is created, and inserted into the @cand vector. * @author Gard Thomassen * @see PromoterSearchManager * @see ScoreTable * @see PromoterSearcher * @see PromoterCandidate */ public class PromoterSequenceScorer{ Vector score; String seq_name; int start, finish; /** * Constructor, gets the scoring table vector * @param s The Vector that holds the scoringtablees */ public PromoterSequenceScorer(Vector s){ score = s; } /** * Method gets a part of a DNA sequence and calculates the score * Calculating score according to the scoring table(es) * Looking first for a -10 match, then if score above * threshold look for a -35 match * If total score >= threshold, then tell caller to create * candidate object. * @param seqv the sequence to be scored * @param i number of scoretable to use * @param tmpCandidates vector to store candidates in * @param m the object calling this method */ public void scoreSequence(String seqv, int i, Vector tmpCandidates, PromoterSearcher m){ double score_35 = 0; double score_10 = 0; String seqv2; int maxDistance, minDistance; score_10 = calculateScore(seqv.toLowerCase(), i , 0 ); ScoreTable n = (ScoreTable)score.elementAt(i); //n = even ie. -10 region scoretable ScoreTable n2; //n2 = odd ie. -35 region maxDistance = n.getMaxDistance(); minDistance = n.getMinDistance(); if(score_10 >= (double)n.threshold){ int dist = minDistance; boolean more = true; while(dist < maxDistance && more) { seqv2 = m.getSeqv(dist, i+1); if(seqv2 != "OOB"){ score_35 = calculateScore(seqv2.toLowerCase(), i+1, dist); n2 = (ScoreTable)score.elementAt(i+1); if(score_35 >= (double)n2.threshold){ //candidate located //create the candidate object PromoterCandidate p_cand = new PromoterCandidate(score_35, score_10, dist, n.threshold, n2.threshold, n.promoter_name,seq_name, start, finish, seqv, seqv2); //add candidate object to candidate Vector tmpCandidates.addElement(p_cand); }//end if } else more = false; dist++; }//end while }//end if }//end iterate /** * Method that calculates the score of this certain sequence * Calculates based upon the scoring table * @param seq the sequence that is to be scored * @param num defines which scoring table to use * @param distance number of bases between the two sequences * @return score the calculated score of this sequence * */ private double calculateScore(String s, int num, int distance){ double base_score = 0; ScoreTable m = (ScoreTable)score.elementAt(num); for(int i=0; i