Package filters

Examples of filters.FilterHandler


     *
     * @param settings
     */
    private void fastaReader() {

        FilterHandler filterHandler = new FilterHandler(this.settings);
        try {
            FileReader fr = new FileReader(this.settings.getInput());
            BufferedReader br = new BufferedReader(fr);

            String line = null;
            String header = "";
            StringBuilder seq = new StringBuilder();
            int counter = 0;

            while ((line = br.readLine()) != null) {

                if (line.startsWith(">")) {
                    if (!(header.equals(""))) {

                        counter++;
                        // write to CSV file per protein
                        if (settings.getOutput() != null) {this.writer.writeCSVFile(header, seq);}
                       
                        // filter per protein and show results
                        outputResults(filterHandler.preformFilters(header, seq), counter);
                        seq.delete(0, seq.length());
                    }
                    header = line;
                } else {seq.append(line);}
            }
            if (header.equals("")) {
                System.err.println("The file is empty or it is missing a header");
                System.exit(1);}
           
            // process last protein in the given file
            counter++;
            if (settings.getOutput() != null) {this.writer.writeCSVFile(header, seq);}
            outputResults(filterHandler.preformFilters(header, seq), counter);

        } catch (FileNotFoundException ex) {
            System.err.println("The given file is not found");
        } catch (IOException ex) {
            System.err.println("IOException: " + ex.getLocalizedMessage());
View Full Code Here

TOP

Related Classes of filters.FilterHandler

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.