Program: 37721
Project: 37721
Buggy source:
public static void performJointSegmentation(String id1,String id2,File exons1,File 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>> isoscm1=IntervalTools.buildRegionsTree(new TranscriptIterator(exons1),true,true,true);
  StrandedGenomicIntervalTree<Map<String,Object>> isoscm2=IntervalTools.buildRegionsTree(new TranscriptIterator(exons2),true,true,true);
  StrandedGenomicIntervalTree<Map<String,Object>> t5p=new StrandedGenomicIntervalTree<Map<String,Object>>();
  for (  StrandedGenomicIntervalTree<Map<String,Object>> isoscm : Util.list(isoscm1,isoscm2)) {
    for (    AnnotatedRegion exon : isoscm) {
      if ("String_Node_Str".equals(exon.getAttribute("String_Node_Str"))) {
        if (!t5p.contains(exon.chr,exon.get5Prime(),exon.get5Prime(),exon.strand))         t5p.add(exon.chr,exon.get5Prime(),exon.get5Prime(),exon.strand);
      }
    }
  }
  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) {
    List<AnnotatedRegion> iso_ends1=IntervalTools.BoundaryIntervals(isoscm1,region.chr,region.get5Prime(),region.strand,true);
    List<AnnotatedRegion> iso_ends2=IntervalTools.BoundaryIntervals(isoscm2,region.chr,region.get5Prime(),region.strand,true);
    for (    List<AnnotatedRegion> i : Util.list(iso_ends1,iso_ends2)) {
      Iterator<AnnotatedRegion> it=i.iterator();
      while (it.hasNext()) {
        AnnotatedRegion n=it.next();
        if (!"String_Node_Str".equals(n.getAttribute("String_Node_Str")))         it.remove();
      }
    }
    if (iso_ends1.size() > 0 && iso_ends2.size() > 0) {
      StrandedGenomicIntervalSet union=IntervalTools.buildStrandedIntervalSet(iso_ends1);
      IntervalTools.addRegions(union,iso_ends2);
      for (      AnnotatedRegion u : union) {
        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 - (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();
}