public void writeRocs(File outDir,int truePositives,int falsePositives,int falseNegatives,int truePositivesRaw,boolean zip,boolean slope) throws IOException {
  Diagnostic.developerLog("Writing ROC");
  mBestFMeasure=0;
  mBest=null;
  final RocPoint unfiltered=new RocPoint(Double.NaN,truePositives,falsePositives,truePositivesRaw);
  final int totalBaselineVariants=truePositives + falseNegatives;
  final int totalCallVariants=truePositivesRaw + falsePositives;
  for (  Map.Entry<RocFilter,SortedMap<Double,RocPoint>> entry : mRocs.entrySet()) {
    final RocFilter filter=entry.getKey();
    final SortedMap<Double,RocPoint> points=entry.getValue();
    final File rocFile=FileUtils.getZippedFileName(zip,new File(outDir,mFilePrefix + filter.fileName()));
    try (LineWriter os=new LineWriter(new OutputStreamWriter(FileUtils.createOutputStream(rocFile,zip)))){
      final RocPoint cumulative=new RocPoint();
      String prevScore=null;
      final boolean extraMetrics=filter == RocFilter.ALL && totalBaselineVariants > 0;
      rocHeader(os,totalBaselineVariants,totalCallVariants,extraMetrics);
      for (      final Map.Entry<Double,RocPoint> me : points.entrySet()) {
        final RocPoint point=me.getValue();
        final String score=Utils.realFormat(point.mThreshold,SCORE_DP);
        if (prevScore != null && score.compareTo(prevScore) != 0) {
          writeRocLine(os,prevScore,totalBaselineVariants,cumulative,extraMetrics,filter == RocFilter.ALL);
        }
        prevScore=score;
        cumulative.add(point);
        cumulative.mThreshold=point.mThreshold;
      }
      if (prevScore != null) {
        writeRocLine(os,prevScore,totalBaselineVariants,cumulative,extraMetrics,filter == RocFilter.ALL);
      }
      if (extraMetrics && (Math.abs(cumulative.mTruePositives - unfiltered.mTruePositives) > 0.001 || Math.abs(cumulative.mFalsePositives - unfiltered.mFalsePositives) > 0.001)) {
        writeRocLine(os,"None",totalBaselineVariants,unfiltered,extraMetrics,false);
      }
    }
     if (slope) {
      produceSlopeFile(rocFile,zip);
    }
  }
}

public void writeRocs ( File outDir , int truePositives , int falsePositives , int falseNegatives , int truePositivesRaw , boolean zip , boolean slope ) throws IOException { Diagnostic . developerLog ( "Writing ROC" ) ; mBestFMeasure = 0 ; mBest = null ; final RocPoint unfiltered = new RocPoint ( Double . NaN , truePositives , falsePositives , truePositivesRaw ) ; final int totalBaselineVariants = truePositives + falseNegatives ; final int totalCallVariants = truePositivesRaw + falsePositives ; for ( Map . Entry < RocFilter , SortedMap < Double , RocPoint > > entry : mRocs . entrySet ( ) ) { final RocFilter filter = entry . getKey ( ) ; final SortedMap < Double , RocPoint > points = entry . getValue ( ) ; final File rocFile = FileUtils . getZippedFileName ( zip , new File ( outDir , mFilePrefix + filter . fileName ( ) ) ) ; try ( LineWriter os = new LineWriter ( new OutputStreamWriter ( FileUtils . createOutputStream ( rocFile , zip ) ) ) ) { final RocPoint cumulative = new RocPoint ( ) ; String prevScore = null ; final boolean extraMetrics = filter == RocFilter . ALL && totalBaselineVariants > 0 ; rocHeader ( os , totalBaselineVariants , totalCallVariants , extraMetrics ) ; for ( final Map . Entry < Double , RocPoint > me : points . entrySet ( ) ) { final RocPoint point = me . getValue ( ) ; final String score = Utils . realFormat ( point . mThreshold , SCORE_DP ) ; if ( prevScore != null && score . compareTo ( prevScore ) != 0 ) { writeRocLine ( os , prevScore , totalBaselineVariants , cumulative , extraMetrics , filter == RocFilter . ALL ) ; } prevScore = score ; cumulative . add ( point ) ; cumulative . mThreshold = point . mThreshold ; } if ( prevScore != null ) { writeRocLine ( os , prevScore , totalBaselineVariants , cumulative , extraMetrics , filter == RocFilter . ALL ) ; } if ( extraMetrics && ( Math . abs ( cumulative . mTruePositives - unfiltered . mTruePositives ) > 0.001 || Math . abs ( cumulative . mFalsePositives - unfiltered . mFalsePositives ) > 0.001 ) ) { writeRocLine ( os , "None" , totalBaselineVariants , unfiltered , extraMetrics , false ) ; } } if ( slope ) { produceSlopeFile ( rocFile , zip ) ; } } }
output roc data to files . while scanning roc data also keeps a record to the point with highest f - measure .
