Пример #1
0
 private void addLinkedMembers(PeptideCollection cluster, Integer clustNum, Peptide pg) {
   for (String proName : pg.getProteins()) {
     Protein pro = minProteins.get(proName);
     pro.setCluster(clustNum);
     for (String pepName : pro.getPeptides()) {
       Peptide subPg = minPeptides.get(pepName);
       if (subPg.getCluster() == -1) {
         subPg.setCluster(clustNum);
         cluster.addPeptideGroup(subPg);
         addLinkedMembers(cluster, clustNum, subPg);
       }
     }
   }
 }
Пример #2
0
 public void updateClusters() {
   clusters = new HashMap<Integer, PeptideCollection>();
   for (Peptide pg : minPeptides.values()) {
     pg.setCluster(-1);
   }
   int cluster_num = 1;
   for (Peptide pg : minPeptides.values()) {
     if (pg.getCluster() == -1) {
       PeptideCollection newCluster = new PeptideCollection();
       newCluster.setClusterNum(cluster_num);
       pg.setCluster(cluster_num);
       newCluster.addPeptideGroup(pg);
       addLinkedMembers(newCluster, cluster_num, pg);
       newCluster.updateProteins(minProteins);
       newCluster.updateParsimony();
       clusters.put(cluster_num, newCluster);
       cluster_num++;
     }
   }
   int equivGroup = 0;
   HashSet<String> usedProteins = new HashSet<String>();
   ArrayList<Protein> equivOrder = new ArrayList<Protein>();
   equivOrder.addAll(getCountables());
   equivOrder.addAll(getSubsets());
   equivOrder.addAll(getSubsumables());
   for (Protein p : equivOrder) {
     if (!usedProteins.contains(p.getName())) {
       p.setEquivalentGroup(equivGroup);
       usedProteins.add(p.getName());
       for (Protein ps : p.getEquivalent()) {
         ps.setEquivalentGroup(equivGroup);
         usedProteins.add(ps.getName());
       }
       equivGroup++;
     }
   }
 }