public void compute() throws IOException {

    Map<String, FastaItem> fastaMap = readFasta();
    
    ProteinFilter proteinFilter = new ProteinFilter();

    // optional property
    if (properties.containsKey("minSeqLength")) {
      minSeqLen = Integer.parseInt(properties.getProperty("minSeqLength"));
      proteinFilter.setMinSeqLen(minSeqLen);
    }

    if (properties.containsKey("matchProteinPatterns")) {
      String[] patterns = properties.getProperty(
          "matchProteinPatterns").split("\\|");
      for (String pattern : patterns) {
        String[] kvPair = pattern.split(":");
        String key = kvPair[0];
        String value = kvPair[1];
        proteinFilter.addPattern(key, value);
      }
    }

    swissprotReader = new SwissprotReader(inDat);
    swissprotWriter = new SwissprotWriter(outDat);
    fastaWriter = new FastaWriter(outFasta);

    Protein protein;

    int counter = 1;
    while ((protein = swissprotReader.getNextProtein()) != null) {
      if (proteinFilter.match(protein)
          && fastaMap.containsKey(protein.getAcNum())) {
        swissprotWriter.writeProtein(protein);
        fastaWriter.writeFastaItem(fastaMap.get(protein.getAcNum()));
        
        if (counter % 1000 == 0) {
          System.out
              .println("Wrote " + counter + " fasta items and proteins.");
        }
        ++counter;
      }
    }

  }