import java.io.BufferedReader; import java.io.FileReader; /** * COMP 322 S13 * * This file is a template for your UsefulParScoring implementation. You may add * anything to it that you like, but please do not modify the main() function as * declared, though you may add your own code below the existing template. */ public class UsefulParScoring { public static String initString (String fname) throws java.io.IOException { BufferedReader r = new BufferedReader(new FileReader(fname)); StringBuilder text = new StringBuilder(); String line; while( (line = r.readLine()) != null){ text.append(line); } return text.toString(); } /** * This program takes as input two sequences, passed as the only two * command line arguments, seq1 and seq2 */ public static void main(String[] args) throws java.io.IOException { if(args.length != 2) { System.out.println("usage: java UsefulParScoring file1 file2"); return; } String filename1 = args[0]; String filename2 = args[1]; String seq1 = initString(filename1); String seq2 = initString(filename2); System.out.println("Processing sequences \""+ seq1.substring(0, seq1.length() < 5 ? seq1.length() : 5)+ (seq1.length() > 5 ? "..." : "")+ "\" and \""+ seq2.substring(0, seq2.length() < 5 ? seq2.length() : 5)+ (seq2.length() > 5 ? "...\"" : "\"")); // ... } }