Program: 37728
Project: 37728
Buggy source:
public static void performJointSegmentation(String id1,String id2,File spliced_exons1,File spliced_exons2,File bam1,File bam2,File table,File gtf,Strandedness strandedness1,Strandedness strandedness2,int maxBins,int binSize,int minCP,double alpha_0,double beta_0,int nb_r,int r,double p,double min_fold) throws FileNotFoundException {
  StrandedGenomicIntervalTree<Map<String,Object>> exons1=IntervalTools.buildRegionsTree(new TranscriptIterator(spliced_exons1),true,true,true);
  StrandedGenomicIntervalTree<Map<String,Object>> exons2=IntervalTools.buildRegionsTree(new TranscriptIterator(spliced_exons2),true,true,true);
  StrandedGenomicIntervalTree<Map<String,Object>> maxCommonExons=getMaxCommonExons(exons1,exons2,strandedness1,strandedness2);
  StrandedGenomicIntervalTree<Map<String,Object>> t5p=IntervalTools.buildTerminiTree(maxCommonExons,true,true,false);
  SAMFileReader.setDefaultValidationStringency(ValidationStringency.SILENT);
  String[] ids=new String[]{id1,id2};
  SAMFileReader[] sfrs=new SAMFileReader[]{new SAMFileReader(bam1),new SAMFileReader(bam2)};
  Strandedness[] strandednesses=new Strandedness[]{strandedness1,strandedness2};
  GTFWriter gw=new GTFWriter(IO.bufferedPrintstream(gtf));
  PrintStream tabular=IO.bufferedPrintstream(table);
  tabular.printf("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
  int changepoint_id=0;
  for (  AnnotatedRegion region : t5p) {
    AnnotatedRegion u=IntervalTools.BoundaryIntervals(maxCommonExons,region.chr,region.get5Prime(),region.strand,true).iterator().next();
    Map<String,Object> attributes=new HashMap<String,Object>();
    String locus_ID=Util.sprintf("String_Node_Str",changepoint_id);
    attributes.put("String_Node_Str",locus_ID);
    changepoint_id++;
    gw.write("String_Node_Str",u.chr,u.start,u.end,u.strand,AnnotatedRegion.GTFAttributeString(attributes));
    boolean constrained_decreasing=!u.isNegativeStrand();
    List<ChangePoint> changepoints=IdentifyChangePoints.identifyConstrainedNegativeBinomialPoints(ids,sfrs,strandednesses,u.chr,u.start,u.end,maxBins,binSize,minCP,u.isNegativeStrand(),alpha_0,beta_0,nb_r,r,p,constrained_decreasing,min_fold);
    for (    ChangePoint cp : changepoints) {
      AnnotatedRegion changepoint=new AnnotatedRegion("String_Node_Str",cp.pos.chr,cp.pos.start,cp.pos.end,cp.pos.strand,new HashMap<String,Object>());
      changepoint.addAttribute("String_Node_Str",id1);
      changepoint.addAttribute("String_Node_Str",id2);
      changepoint.addAttribute("String_Node_Str",StringUtils.join(Util.list(changepoint.getAttribute("String_Node_Str")),"String_Node_Str"));
      changepoint.addAttribute("String_Node_Str",StringUtils.join(Util.list(changepoint.getAttribute("String_Node_Str")),"String_Node_Str"));
      changepoint.addAttribute("String_Node_Str",StringUtils.join(Util.list(cp.cov_upstream),"String_Node_Str"));
      changepoint.addAttribute("String_Node_Str",StringUtils.join(Util.list(cp.cov_downstream),"String_Node_Str"));
      changepoint.addAttribute("String_Node_Str",locus_ID);
      gw.write("String_Node_Str",u.chr,changepoint.start,changepoint.end,u.strand,AnnotatedRegion.GTFAttributeString(changepoint.attributes));
      double[] usage=new double[sfrs.length];
      for (int i=0; i < sfrs.length; i++) {
        usage[i]=1 - (cp.cov_downstream[i] / cp.cov_upstream[i]);
      }
      tabular.printf("String_Node_Str",StringUtils.join(ids,"String_Node_Str"),locus_ID,changepoint,cp.upstream_region,cp.downstream_region,u,cp.pos.strand,StringUtils.join(Util.list(cp.cov_upstream),"String_Node_Str"),StringUtils.join(Util.list(cp.cov_downstream),"String_Node_Str"),StringUtils.join(Util.list(usage),"String_Node_Str"),usage[0] - usage[1]);
    }
  }
  gw.close();
  tabular.close();
}

Fixed version (ground truth):
public static void performJointSegmentation(String id1,String id2,File spliced_exons1,File spliced_exons2,File bam1,File bam2,File table,File gtf,Strandedness strandedness1,Strandedness strandedness2,int maxBins,int binSize,int minCP,double alpha_0,double beta_0,int nb_r,int r,double p,double min_fold) throws FileNotFoundException {
  StrandedGenomicIntervalTree<Map<String,Object>> exons1=IntervalTools.buildRegionsTree(new TranscriptIterator(spliced_exons1),true,true,true);
  StrandedGenomicIntervalTree<Map<String,Object>> exons2=IntervalTools.buildRegionsTree(new TranscriptIterator(spliced_exons2),true,true,true);
  StrandedGenomicIntervalTree<Map<String,Object>> maxCommonExons=getMaxCommonExons(exons1,exons2,strandedness1,strandedness2);
  StrandedGenomicIntervalTree<Map<String,Object>> t5p=IntervalTools.buildTerminiTree(maxCommonExons,true,true,false);
  SAMFileReader.setDefaultValidationStringency(ValidationStringency.SILENT);
  String[] ids=new String[]{id1,id2};
  SAMFileReader[] sfrs=new SAMFileReader[]{new SAMFileReader(bam1),new SAMFileReader(bam2)};
  Strandedness[] strandednesses=new Strandedness[]{strandedness1,strandedness2};
  GTFWriter gw=new GTFWriter(IO.bufferedPrintstream(gtf));
  PrintStream tabular=IO.bufferedPrintstream(table);
  tabular.printf("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
  int changepoint_id=0;
  for (  AnnotatedRegion region : t5p) {
    AnnotatedRegion u=IntervalTools.BoundaryIntervals(maxCommonExons,region.chr,region.get5Prime(),region.strand,true).iterator().next();
    Map<String,Object> attributes=new HashMap<String,Object>();
    String locus_ID=Util.sprintf("String_Node_Str",changepoint_id);
    attributes.put("String_Node_Str",locus_ID);
    changepoint_id++;
    gw.write("String_Node_Str",u.chr,u.start,u.end,u.strand,AnnotatedRegion.GTFAttributeString(attributes));
    boolean constrained_decreasing=!u.isNegativeStrand();
    List<ChangePoint> changepoints=IdentifyChangePoints.identifyConstrainedNegativeBinomialPoints(ids,sfrs,strandednesses,u.chr,u.start,u.end,maxBins,binSize,minCP,u.isNegativeStrand(),alpha_0,beta_0,nb_r,r,p,constrained_decreasing,min_fold);
    for (    ChangePoint cp : changepoints) {
      AnnotatedRegion changepoint=new AnnotatedRegion("String_Node_Str",cp.pos.chr,cp.pos.start,cp.pos.end,cp.pos.strand,new HashMap<String,Object>());
      changepoint.addAttribute("String_Node_Str",id1);
      changepoint.addAttribute("String_Node_Str",id2);
      changepoint.addAttribute("String_Node_Str",StringUtils.join(Util.list(changepoint.getAttribute("String_Node_Str")),"String_Node_Str"));
      changepoint.addAttribute("String_Node_Str",StringUtils.join(Util.list(changepoint.getAttribute("String_Node_Str")),"String_Node_Str"));
      changepoint.addAttribute("String_Node_Str",StringUtils.join(Util.list(cp.cov_upstream),"String_Node_Str"));
      changepoint.addAttribute("String_Node_Str",StringUtils.join(Util.list(cp.cov_downstream),"String_Node_Str"));
      changepoint.addAttribute("String_Node_Str",locus_ID);
      gw.write("String_Node_Str",u.chr,changepoint.start,changepoint.end,u.strand,AnnotatedRegion.GTFAttributeString(changepoint.attributes));
      double[] usage=new double[sfrs.length];
      for (int i=0; i < sfrs.length; i++) {
        usage[i]=1 - Math.min((cp.cov_downstream[i] / cp.cov_upstream[i]),1);
      }
      tabular.printf("String_Node_Str",StringUtils.join(ids,"String_Node_Str"),locus_ID,changepoint,cp.upstream_region,cp.downstream_region,u,cp.pos.strand,StringUtils.join(Util.list(cp.cov_upstream),"String_Node_Str"),StringUtils.join(Util.list(cp.cov_downstream),"String_Node_Str"),StringUtils.join(Util.list(usage),"String_Node_Str"),usage[0] - usage[1]);
    }
  }
  gw.close();
  tabular.close();
}