Changeset 1516


Ignore:
Timestamp:
Oct 24, 2006, 4:27:46 PM (16 years ago)
Author:
fredrik
Message:

Modified the counting of false positives

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/proteios/query/CombinedProteinHitsReportQuery.java

    r1500 r1516  
    428428    FdrRow[] fdrarray=hitlist.toArray(new FdrRow[0]);
    429429    // Now all the forward hits are in fdrarray, sorted with ascending p_values
     430    // To correct for multiple possibilities we multiply by the number of search engines
    430431    for (int i=0;i<fdrarray.length;++i)
    431432    {
    432       fdrarray[i].corrected_p=fdrarray[i].pValue*((double) total_number)/(((double)(i+1)));
     433      fdrarray[i].corrected_p=factor*fdrarray[i].pValue*((double) total_number)/(((double)(i+1)));
    433434    }
    434435    for (int i=0;i<fdrarray.length;++i)
     
    444445      fdrarray[i].fdr=min;
    445446      /* for debugging:
    446       if (i<20)
    447       {
    448         System.out.print("mascot:"+fdrarray[i].mascot_score+" tandem:"+fdrarray[i].tandem_eValue);
    449         System.out.println(" p_value:"+fdrarray[i].pValue+" corrected:"+fdrarray[i].corrected_p);
    450       }*/
     447      System.out.print("mascot:"+fdrarray[i].mascot_score+" tandem:"+fdrarray[i].tandem_eValue);
     448      System.out.println(" p_value:"+fdrarray[i].pValue+" corrected:"+fdrarray[i].corrected_p+" fdr:"+fdrarray[i].fdr);
     449      */
    451450    }
    452451    int truecount=0, falsecount=0, tandem_count=0, mascot_count=0,combined_count=0;
     
    508507      }
    509508    }
    510     System.out.println("fdr:"+lasthit.fdr+" pValue:"+lasthit.pValue+ " corrected:"+lasthit.corrected_p+" spot+ipi:"+lasthit.spotId+" "+lasthit.ipi);
     509    System.out.println("Worst hit fdr:"+lasthit.fdr+" pValue:"+lasthit.pValue+ " corrected:"+lasthit.corrected_p+" spot+ipi:"+lasthit.spotId+" "+lasthit.ipi);
    511510    System.out.println("Lowest mascot only score:"+mascot_only_limit+" Tandem:"+tandem_only_limit);
    512511    System.out.println("Lowest scores in combined. Mascot:"+mascot_combined+" tandem:"+tandem_combined);
    513512    System.out.println("Positives:"+truecount+" Combined:"+combined_count+" tandem:"+tandem_count+" mascot:"+mascot_count);
    514513    // now count false tandem and mascot hits in order to find out if OK. Print the reverse db hits.
     514
    515515    int mascot_scores_above=0,tandem_scores_below=0, both_scores=0;
    516516    Iterator<FdrRow> reverse_it=reverselist.iterator();
     
    535535        }
    536536      }
    537       else if ((currentrow.mascot_score==0) && (currentrow.tandem_eValue!=0))
    538       {
    539         if (currentrow.tandem_eValue<=tandem_only_limit && currentrow.mascot_score>=mascot_only_limit)
    540         {
    541           both_scores++;
    542           System.out.println("spot+accession:"+currentrow.spotId+" "+currentrow.ipi+" tandem:"+currentrow.tandem_eValue+" mascot:"+currentrow.mascot_score);
     537      else if ((currentrow.mascot_score!=0) && (currentrow.tandem_eValue!=0))
     538      {
     539        if (currentrow.tandem_eValue<=tandem_combined && currentrow.mascot_score>=mascot_combined)
     540        {
     541          // This one is tricky, since the score limit is a curve
     542          // We have to calculate a p-value for the reverse hit as we did for
     543          // the forward hits and find out if it is lower than the limit.
     544          Iterator<FdrRow> reverseit=reverselist.iterator();
     545          int reversehits=0;
     546          // Count how many reverse hits have both scores better
     547          while (reverseit.hasNext())
     548          {
     549            FdrRow currentreverse=reverseit.next();
     550            if (currentreverse.mascot_score!=0 && currentreverse.tandem_eValue!=0)
     551            {
     552              if (currentreverse.mascot_score>=currentrow.mascot_score && currentreverse.tandem_eValue<=currentrow.tandem_eValue)
     553              {
     554                reversehits++;
     555              }
     556            }
     557          }
     558          currentrow.pValue=(double)(reversehits+1)/(double)(total_number+1);
     559          if (currentrow.pValue<lasthit.pValue)
     560          {
     561            both_scores++;
     562            System.out.println("spot+accession:"+currentrow.spotId+" "+currentrow.ipi+" tandem:"+currentrow.tandem_eValue+" mascot:"+currentrow.mascot_score);
     563          }
    543564        }
    544565      }
    545566    }
    546567    info = "FPR:"+cutOff+" Tandem only limit:"+tandem_only_limit+" Mascot only limit:"+mascot_only_limit+". Worst scores passing in combined hits: (Tandem, Mascot):"+tandem_combined+", "+mascot_combined;
     568    info += ". Hits passing:"+truecount+" Tandem:"+tandem_count+" Mascot:"+mascot_count+" Combined:"+combined_count;
    547569    info += ". Reverse db hits passing - Tandem:"+tandem_scores_below+" Mascot:"+mascot_scores_above+" Combined:"+both_scores;
    548570    System.out.println("Reverse mascot above:"+mascot_scores_above);
     
    705727  private String date2;
    706728  private String reverseText;
    707   private double cutOff=0.01;
     729  private double cutOff=0.01, factor=2.0;
    708730}
Note: See TracChangeset for help on using the changeset viewer.