package ests; import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; public class SeqExtractor2 { public static void main(String[] args) throws IOException { final double COPYTHRESH = 0.2f; String infile = args[0]; int seqsneeded = Integer.parseInt(args[1]); int seqs=0; boolean copymode=false; while (seqs 0 && line.charAt(0) == '>') { // randomly activate copy mode if (Math.random() < COPYTHRESH) { copymode = true; seqs++; } else copymode = false; if (seqs>seqsneeded) break; } if (copymode) System.out.println(line); } reader.close(); } } }