Changeset 4284


Ignore:
Timestamp:
Feb 10, 2012, 4:25:09 PM (12 years ago)
Author:
Fredrik Levander
Message:

Refs #777. Now summing if multiple values. Corrected so that also writing last cluster. Indicating sequence conflicts.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/plugin/src/org/proteios/plugins/FeatureComparison.java

    r4281 r4284  
    192192    String currentSequence = "";
    193193    String currentAcc = "";
    194     Float[] values = null;
     194    boolean conflict = false;
     195    float[] values = null;
    195196    writer
    196197      .println("Cluster ID\tPeptide Sequence\tExternal IDs\tCharge\tAverage RT");
     
    201202      if (!feature.getClusterId().equals(currentCluster))
    202203      {
    203         if (values != null)
    204         {
    205           writer
    206             .print(currentCluster + "\t" + currentSequence + "\t" + currentAcc + "\t" + currentCharge + "\t" + (rtSum / nValues));
    207           for (Float value : values)
    208           {
    209             writer.print("\t" + value);
    210           }
    211           writer.println();
    212         }
    213         values = new Float[entries];
     204        printRow(writer, values, currentCluster, currentSequence,
     205          currentAcc, currentCharge, rtSum, nValues, conflict);
     206        values = new float[entries];
     207        conflict = false;
    214208        currentAcc = "";
    215209        currentCharge = 0;
     
    219213        nValues = 0;
    220214      }
    221       if (currentSequence.equals("") && feature.getPeptideSequence() != null)
    222       {
    223         currentSequence = feature.getPeptideSequence();
    224         for (Hit hit : feature.getHits())
     215      if (currentSequence.equals(""))
     216      {
     217        if (feature.getPeptideSequence() != null)
    225218        {
    226           if (currentSequence.startsWith(hit.getDescription()))
     219          currentSequence = feature.getPeptideSequence();
     220          for (Hit hit : feature.getHits())
    227221          {
    228             currentAcc = hit.getExternalId();
     222            if (currentSequence.startsWith(hit.getDescription()))
     223            {
     224              currentAcc = hit.getExternalId();
     225            }
    229226          }
    230227        }
    231228      }
    232       values[msFiles.indexOf(feature.getMsFile())] = feature
    233         .getIntegratedIntensity();
     229      else if (!feature.getPeptideSequence().equals(currentSequence))
     230      {
     231        conflict = true;
     232      }
     233      values[msFiles.indexOf(feature.getMsFile())] += feature
     234        .getIntegratedIntensity().floatValue();
    234235      nValues++;
    235236      if (currentCharge == 0)
     
    237238      rtSum += feature.getApexRetentionTimeInMinutes();
    238239
     240    }
     241    printRow(writer, values, currentCluster, currentSequence, currentAcc,
     242      currentCharge, rtSum, nValues, conflict);
     243  }
     244
     245
     246  private void printRow(PrintWriter writer, float[] values,
     247      Long currentCluster, String currentSequence, String currentAcc,
     248      int currentCharge, float rtSum, float nValues, boolean conflict)
     249  {
     250    if (values != null)
     251    {
     252      writer.print(currentCluster + "\t" + currentSequence);
     253      if (conflict)
     254        writer.print(",+");
     255      writer
     256        .print("\t" + currentAcc + "\t" + currentCharge + "\t" + (rtSum / nValues));
     257      for (float value : values)
     258      {
     259        writer.print("\t" + value);
     260      }
     261      writer.println();
    239262    }
    240263
Note: See TracChangeset for help on using the changeset viewer.