import java.util.*; /** * A dummy SequenceSearch class, to allow classes using SequenceSearch * to compile. Returns meaningless values with the correct types. * Replace with the real GeneDataSearch. */ public class GeneDataSearch implements SequenceSearch { /** * Search through all gene sequences and find matches to the given * pattern that have a Hamming distance no more than the given value. * Return a Collection containing a SearchResult object for each sequence * with at least one sufficiently close match. * * @param pattern - the pattern to be used in the distance comparison * @param maxDistance - the largest distance that should be accepted * as a match * @return a Collection containing a SearchResult object for each sequence * with matches */ public Collection searchGenesByHammingDistance( String pattern, int maxDistance) { return null; } /** * Search through all protein sequences and find matches to the given * pattern that have a Hamming distance no more than the given value. * Return a Collection containing a SearchResult object for each sequence * with at least one sufficiently close match. * * @param pattern - the pattern to be used in the distance comparison * @param maxDistance - the largest distance that should be accepted * as a match * @return a Collection containing a SearchResult object for each sequence * with matches */ public Collection searchProteinsByHammingDistance( String pattern, int maxDistance) { return null; } /** * Search through all gene sequences and find matches to the given * pattern that have an edit distance no more than the given value. * Return a Collection containing a SearchResult object for each sequence * with at least one sufficiently close match. * * @param pattern - the pattern to be used in the distance comparison * @param maxDistance - the largest distance that should be accepted * as a match * @return a Collection containing a SearchResult object for each sequence * with matches */ public Collection searchGenesByEditDistance( String pattern, int maxDistance) { return null; } /** * Search through all protein sequences and find matches to the given * pattern that have an edit distance no more than the given value. * Return a Collection containing a SearchResult object for each sequence * with at least one sufficiently close match. * * @param pattern - the pattern to be used in the distance comparison * @param maxDistance - the largest distance that should be accepted * as a match * @return a Collection containing a SearchResult object for each sequence * with matches */ public Collection searchProteinsByEditDistance( String pattern, int maxDistance) { return null; } // Methods that search one sequence of any sort, finding match locations. /** * Searches a sequence for substrings that match a given pattern, using * Hamming distance. A substring matches if its distance is no more * than the given maximum. Returns the locations of the matches in a * List of Integers. The location is the index in the sequence of the * beginning of the substring that was a sufficiently close match. * * @param sequence - the sequence to search for matches * @param pattern - the pattern to be used in the distance comparison * @param maxDistance - the largest distance that should be accepted * as a match * @return a List of Integers containing locations of matches in this * sequence */ public List searchOneSequenceByHammingDistance( String sequence, String pattern, int maxDistance) { return null; } /** * Searches a sequence for substrings that match a given pattern, using * edit distance. A substring matches if its distance is no more * than the given maximum. Returns the locations of the matches in a * List of Integers. The location is the index in the sequence of the * beginning of the substring that was a sufficiently close match. * * @param sequence - the sequence to search for matches * @param pattern - the pattern to be used in the distance comparison * @param maxDistance - the largest distance that should be accepted * as a match * @return a List of Integers containing locations of the matches in this * sequence */ public List searchOneSequenceByEditDistance( String sequence, String pattern, int maxDistance) { return null; } // Methods that compare strings and return a "distance" that measures // how dissimilar the strings are. /** * Computes the Hamming distance between two strings. * * @param a - one string to compare * @param b - the other string to compare * @return the Hamming distance between the two strings */ public int hammingDistance( String a, String b ) { return -1; } /** * Computes the edit distance between two strings. * * @param a - one string to compare * @param b - the other string to compare * @return the edit distance between the two strings */ public int editDistance( String a, String b ) { return -1; } /** * Returns the "version number" of the protein translation procedure. * This should be 1 if the class provides the original translation * procedure, or 2 if it uses the updated procedure. * * @return version number of the protein translation procedure */ public int translationVersion() { return 0; } }