Пример #1
0
  public Collection<NamedRegion> parseProbes() throws IOException {
    double ethreshold = 1.0e-3;
    Parser<BlastTabEntry> parser =
        new Parser<BlastTabEntry>(blasttab, new BlastTabEntry.ParsingMapper());
    Iterator<BlastTabEntry> itr =
        new FilterIterator<BlastTabEntry, BlastTabEntry>(
            new BlastTabEntry.ExpectedScoreFilter(ethreshold), parser);

    Map<String, Set<Region>> primerHits = new TreeMap<String, Set<Region>>();
    Set<String> primerNames = new TreeSet<String>();

    while (itr.hasNext()) {
      BlastTabEntry entry = itr.next();
      NamedRegion r = createNamedRegion(entry);
      if (!primerHits.containsKey(entry.getQuery())) {
        primerHits.put(entry.getQuery(), new HashSet<Region>());
      }
      primerHits.get(entry.getQuery()).add(r);
      primerNames.add(removePrimerLR(entry.getQuery()));
    }

    LinkedList<NamedRegion> probes = new LinkedList<NamedRegion>();

    for (String primerName : primerNames) {
      Pair<Region, Region> hits = findProbePair(primerName, primerHits);
      if (hits != null) {
        Region left = hits.getFirst(), right = hits.getLast();
        int start = Math.min(left.getStart(), right.getStart());
        int end = Math.max(left.getEnd(), right.getEnd());

        NamedRegion probe = new NamedRegion(genome, left.getChrom(), start, end, primerName);
        probes.addLast(probe);
      }
    }

    return probes;
  }
Пример #2
0
  public void loadNetwork() throws IOException {
    logger.log(Level.INFO, "Loading metabolism network...");

    File file = props.getNetworkFile();
    Mapper<String, MetabolicEntry> entryMapper = new MetabolicEntry.MetabolicMapper();
    Parser<MetabolicEntry> parser = new Parser<MetabolicEntry>(file, entryMapper);

    while (parser.hasNext()) {
      MetabolicEntry entry = parser.next();
      entries.add(entry);

      Rxn rxn =
          new Rxn(
              props,
              entry.getReaction(),
              entry.getAbbreviation(),
              entry.getReactionName(),
              entry.getORF());
      reactions.put(entry.getAbbreviation(), rxn);

      locations.add(rxn.getLocation());

      LogicalORFTree lot = new LogicalORFTree(entry.getORF());
      ORFSet os = new ORFSet(entry.getORF());

      totalORFs.addAll(os.getORFs());
      orfSets.put(entry.getAbbreviation(), lot);
    }

    logger.log(Level.FINE, String.format("Loaded %d entries.", entries.size()));

    abbrevs = new MetabolismAbbreviations(props);
    abbrevs.loadAbbreviations();

    logger.log(Level.FINEST, "Loaded abbrevations.");
  }