Changeset 4285


Ignore:
Timestamp:
Feb 10, 2012, 4:52:03 PM (12 years ago)
Author:
marianne
Message:

Refs #774. Progress report and tolerance distribution calculation.

File:
1 edited

Legend:

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

    r4283 r4285  
    294294         
    295295         
    296           /*if (progress != null)
    297           {
    298             progress.display(100 * (fileNbr / nbrOfFiles),
    299               "Processing file " + fileNbr + " of " + nbrOfFiles);
    300           }*/
     296         
    301297          //String frac1 = getFirstAnnotationValue(annotator,
    302298          //fractionAnnotationType, currentMsFile);
     
    305301        writer.println("===============================");
    306302       
     303       
     304       
     305        int countNbrMatches=0;
     306       
    307307        for(int fileNbr=0; fileNbr<nbrOfFiles-1; fileNbr++ )
    308308        {
     
    312312          {
    313313           
     314            countNbrMatches++;
     315           
     316            if (progress != null)
     317            {
     318              progress.display((100 *countNbrMatches)/((nbrOfFiles*(nbrOfFiles-1)/2)),
     319                "Calculating similarities. Processing file nr " + (fileNbr+1) + " and " +(secFileNbr+1));
     320            }
     321           
     322            writer.println("Calculating similarities. Processing file nr " + (fileNbr+1) + " and " +(secFileNbr+1) +". Progress is: " +(100 *countNbrMatches)/((nbrOfFiles*(nbrOfFiles-1)/2)));
    314323            //double simValue = pearCorr.correlation(mzDist[fileNbr], mzDist[secFileNbr]);
    315324            //writer.println("Similarity for file number" +fileNbr + " and " + secFileNbr +": " +simValue);
     
    340349
    341350            int indexKey = (secFileNbr+1)*(secFileNbr-2)/2+fileNbr+1;
     351           
     352           
     353           
    342354            //  writer.println("The index key :" + indexKey);
    343355            // 
     
    373385           
    374386            writer.println("Removing " +(totNbrMatches-points.size()) + " outliers. Total number of sequence matches is now: " +points.size());
    375              
     387           
     388            medianQuartile = points.get((int) Math.round(0.5*points.size())).getDiff();
     389           
     390            writer.println("Median RT difference is now: " +medianQuartile);
    376391            writer.println("Largest RT difference is now: " +points.get(points.size()-1).getDiff());
     392           
     393            Collections.sort(points,new MzDiffComparator());
     394            double medianQuartileMz = points.get((int) Math.round(0.5*points.size())).getMzDiff();
     395            writer.println("Median mz difference before alignment: " +medianQuartileMz);
     396            writer.println("Largest mz difference before alignment: " +points.get(points.size()-1).getMzDiff());
     397           
     398            tolerance=points.get(points.size()-1).getMzDiff();
     399            timeTol=medianQuartile;
     400           
    377401           
    378402            ArrayList<Point> evalPoints = new ArrayList<Point>();
     
    441465       
    442466        // Propagate and get count
     467       
     468        countNbrMatches=0;
    443469        for(FilePoint f:simList)
    444470        {
    445471         
     472          countNbrMatches++;
     473         
     474          if (progress != null)
     475          {
     476            progress.display((100 *countNbrMatches/simList.length),
     477              "Aligning files " +(f.getFirstFile()+1) + " and " + (f.getSecondFile()+1) +". File-pair " +countNbrMatches +" of " +simList.length);
     478          }
     479         
     480         
     481         
    446482          //TODO: här ska allFeatures skickas in för ytterligare utvärdering
    447           count += matchFeatureLists(f,factory, project,writer,featureQuery,uniqueMsFiles);
     483          count += matchFeatureLists(f,factory, project,writer,featureQuery,uniqueMsFiles,tolerance,timeTol);
     484         
    448485        }
    449486
     
    686723   */
    687724  private int matchFeatureLists(FilePoint fp, ItemFactory factory,
    688       Project project, PrintWriter writer, ItemQuery<Feature> featureQuery,List<File> uniqueMsFiles)
     725      Project project, PrintWriter writer, ItemQuery<Feature> featureQuery,List<File> uniqueMsFiles, double tolerance, double timeTolin)
    689726  {
    690727   
     
    727764    List<Long> bestMatchClusterIDList = new ArrayList<Long>();
    728765
    729     double tolerance = 0.01;
     766    //double tolerance = 0.01;
    730767    //double timeTol = 0.5;
    731     double[] timeTol = {0.25,0.5,0.75,1,1.5,2,3,4,5};
     768    //double[] timeTol = {0.25,0.5,0.75,1,1.5,2,3,4,5};
     769    double[] timeTol = {0, timeTolin};
    732770   
    733771    writer.println("===============================");
     
    836874   
    837875 
    838     //TODO: lägg in clusterID
    839    
    840876    for(Feature f:allFeatures){
    841877     
     
    13061342  }
    13071343 
    1308   private class WeightComparator implements Comparator<Point>{
     1344  private class MzDiffComparator implements Comparator<Point>{
    13091345
    13101346
     
    13121348    public int compare(Point p, Point p2)
    13131349    {
    1314       return (new Double(p.getWeight())).compareTo(new Double(p2.getWeight()));
     1350      return (new Double(p.getMzDiff())).compareTo(new Double(p2.getMzDiff()));
    13151351
    13161352    }
     
    14241460      return this.y.getApexRetentionTimeInMinutes().doubleValue();
    14251461    }
     1462   
     1463    public double getMzX()
     1464    {
     1465      return this.x.getMassToChargeRatio();
     1466    }
     1467
     1468    public double getMzY()
     1469    {
     1470      return this.y.getMassToChargeRatio();
     1471    }
    14261472
    14271473    public void setWeight(double weight)
     
    14391485    {
    14401486      return Math.abs(this.getX()-this.getY());
     1487    }
     1488   
     1489    public double getMzDiff()
     1490    {
     1491      return Math.abs(this.getMzX()-this.getMzY());
    14411492    }
    14421493
Note: See TracChangeset for help on using the changeset viewer.