nus-yam/ex-repair huggingface dataset:
Program: 50250
Project: 50250
Buggy source:
protected void estimateSomaticPValue(SampleCountInfo[] sampleCounts){
  pValues.clear();
  for (  int sampleIndex : somaticSampleIndices) {
    SampleCountInfo somaticCounts=sampleCounts[sampleIndex];
    int fatherSampleIndex=sample2FatherSampleIndex[sampleIndex];
    if (fatherSampleIndex != -1) {
      SampleCountInfo fatherCounts=sampleCounts[fatherSampleIndex];
      double fatherP=estimateP(somaticCounts,fatherCounts);
      pValues.add(fatherP);
    }
    int motherSampleIndex=sample2MotherSampleIndex[sampleIndex];
    if (fatherSampleIndex != -1) {
      SampleCountInfo motherCounts=sampleCounts[motherSampleIndex];
      double motherP=estimateP(somaticCounts,motherCounts);
      pValues.add(motherP);
    }
    int germlineSampleIndices[]=sample2GermlineSampleIndices[sampleIndex];
    for (    int germlineSampleIndex : germlineSampleIndices) {
      SampleCountInfo germlineCounts=sampleCounts[germlineSampleIndex];
      double germlineP=estimateP(somaticCounts,germlineCounts);
      pValues.add(germlineP);
    }
    double pValue=max(pValues);
    statsWriter.setInfo(somaticPValueIndex[sampleIndex],pValue);
  }
}

Fixed version (ground truth):
protected void estimateSomaticPValue(SampleCountInfo[] sampleCounts){
  for (  int sampleIndex : somaticSampleIndices) {
    pValues.clear();
    SampleCountInfo somaticCounts=sampleCounts[sampleIndex];
    int fatherSampleIndex=sample2FatherSampleIndex[sampleIndex];
    if (fatherSampleIndex != -1) {
      SampleCountInfo fatherCounts=sampleCounts[fatherSampleIndex];
      double fatherP=estimateP(somaticCounts,fatherCounts);
      pValues.add(fatherP);
    }
    int motherSampleIndex=sample2MotherSampleIndex[sampleIndex];
    if (fatherSampleIndex != -1) {
      SampleCountInfo motherCounts=sampleCounts[motherSampleIndex];
      double motherP=estimateP(somaticCounts,motherCounts);
      pValues.add(motherP);
    }
    int germlineSampleIndices[]=sample2GermlineSampleIndices[sampleIndex];
    for (    int germlineSampleIndex : germlineSampleIndices) {
      SampleCountInfo germlineCounts=sampleCounts[germlineSampleIndex];
      double germlineP=estimateP(somaticCounts,germlineCounts);
      pValues.add(germlineP);
    }
    double pValue=max(pValues);
    statsWriter.setInfo(somaticPValueIndex[sampleIndex],pValue);
  }
}
Program: 50252
Project: 50252
Buggy source:
/** 
 * Load and sort annotations by their start position.
 * @param annotReader
 * @throws java.io.IOException
 */
public void loadAnnotations(final Reader annotReader) throws IOException {
  final ObjectArrayList<Interval> result=new ObjectArrayList<Interval>();
  final Object2ObjectMap<String,ObjectList<Annotation>> map=CompactAlignmentToAnnotationCountsMode.readAnnotations(annotReader);
  for (  final String key : map.keySet()) {
    final ObjectList<Annotation> list=map.get(key);
    if (list != null) {
      Collections.sort(list,compareAnnotationStart);
      for (      final Annotation element : list) {
        final Interval interval=new Interval();
        interval.referenceIndex=references.registerIdentifier(new MutableString(element.getChromosome()));
        interval.start=element.getStart();
        interval.end=element.getEnd();
        interval.id=element.getId();
        result.add(interval);
      }
      final Interval[] intervals=new Interval[list.size()];
      chromosomeToMap.put(key,result.toArray(intervals));
    }
  }
}

Fixed version (ground truth):
/** 
 * Load and sort annotations by their start position.
 * @param annotReader
 * @throws java.io.IOException
 */
public void loadAnnotations(final Reader annotReader) throws IOException {
}
Program: 50253
Project: 50253
Buggy source:
private Interval checkOverlap(final Interval[] intervals,final int insertionPoint,final int start,final int end){
  if (insertionPoint <= 0) {
    return null;
  }
  final Interval previous=intervals[insertionPoint - 1];
  if (previous.start <= start && previous.end >= end) {
    return previous;
  }
  return null;
}

Fixed version (ground truth):
private Interval checkOverlap(final Interval[] intervals,final int insertionPoint,final int start,final int end){
  if (insertionPoint <= 0) {
    return null;
  }
  final Interval previous=intervals[insertionPoint - 1];
  if (previous.start <= start && previous.end >= end) {
    return previous;
  }
  if (insertionPoint < intervals.length) {
    final Interval next=intervals[insertionPoint];
    if (next.start <= start && next.end >= end) {
      return next;
    }
  }
  return null;
}
Program: 50254
Project: 50254
Buggy source:
public void testLoad() throws IOException {
  RandomAccessAnnotations finder=new RandomAccessAnnotations();
  finder.loadAnnotations("String_Node_Str");
  assertNotNull(finder.find("String_Node_Str",11,200));
  assertNotNull(finder.find("String_Node_Str",10,310));
  assertNull(finder.find("String_Node_Str",8,9));
  assertNull(finder.find("String_Node_Str",311,312));
  assertNotNull(finder.find("String_Node_Str",1000,1001));
  assertNull(finder.find("String_Node_Str",1002,1003));
}

Fixed version (ground truth):
public void testLoad() throws IOException {
  RandomAccessAnnotations finder=new RandomAccessAnnotations();
  finder.loadAnnotations("String_Node_Str");
  final Interval interval1=finder.find("String_Node_Str",24165247,24165247);
  assertNotNull(interval1);
  final int chr4Index=finder.references.getInt(new MutableString("String_Node_Str"));
  assertEquals(chr4Index,interval1.referenceIndex);
  final Interval interval2=finder.find("String_Node_Str",11838488,11843885);
  assertNotNull(interval2);
  final int chr11Index=finder.references.getInt(new MutableString("String_Node_Str"));
  assertEquals(chr11Index,interval2.referenceIndex);
}
Program: 50255
Project: 50255
Buggy source:
/** 
 * Returns true if filename belongs to an alignment basename that can be read.
 * @param filename Filename of an alignment component.
 * @return True if the alignment can be read, false otherwise.
 */
public static boolean canRead(final String filename){
  final String filenameNoExtension=FilenameUtils.removeExtension(filename);
  String fileExtension=FilenameUtils.getExtension(filename);
  if (!ArrayUtils.contains(AlignmentReaderImpl.COMPACT_ALIGNMENT_FILE_REQUIRED_EXTS,"String_Node_Str" + fileExtension) && !ArrayUtils.contains(AlignmentReaderImpl.COMPACT_ALIGNMENT_FILE_POSSIBLE_EXTS,"String_Node_Str" + fileExtension)) {
    return false;
  }
  int count=0;
  for (  final String extension : AlignmentReaderImpl.COMPACT_ALIGNMENT_FILE_REQUIRED_EXTS) {
    if (RepositionableInputStream.resourceExist(filenameNoExtension + extension)) {
      count++;
    }
  }
  return count == AlignmentReaderImpl.COMPACT_ALIGNMENT_FILE_REQUIRED_EXTS.length;
}

Fixed version (ground truth):
/** 
 * Returns true if filename belongs to an alignment basename that can be read.
 * @param filename Filename of an alignment component.
 * @return True if the alignment can be read, false otherwise.
 */
public static boolean canRead(final String filename){
  final String filenameNoExtension=FilenameUtils.removeExtension(filename);
  String fileExtension=FilenameUtils.getExtension(filename);
  if (!ArrayUtils.contains(AlignmentReaderImpl.COMPACT_ALIGNMENT_FILE_REQUIRED_EXTS,fileExtension)) {
    return false;
  }
  int count=0;
  for (  final String extension : AlignmentReaderImpl.COMPACT_ALIGNMENT_FILE_REQUIRED_EXTS) {
    if (RepositionableInputStream.resourceExist(filenameNoExtension + extension)) {
      count++;
    }
  }
  return count == AlignmentReaderImpl.COMPACT_ALIGNMENT_FILE_REQUIRED_EXTS.length;
}
Program: 50257
Project: 50257
Buggy source:
protected MutableString trimRight(int length,MutableString sequence,ByteString qualityScores,ByteArrayList newQualScores,MutableString[] adapters){
  int currentLength=sequence.length();
  for (  MutableString adapter : adapters) {
    final int adaptLength=adapter.length();
    for (int j=minRightLength; j < adaptLength; j++) {
      if (sequence.endsWith(adapter.subSequence(j,adaptLength))) {
        final int trimedLength=adaptLength - j;
        if (trimedLength > 10) {
          System.out.printf("String_Node_Str",trimedLength,sequence,adapter);
        }
        if (currentLength == length) {
          copy(qualityScores,newQualScores);
        }
        if (!qualityScores.isEmpty()) {
          newQualScores.removeElements(currentLength - trimedLength,Math.min(currentLength + 1,newQualScores.size()));
        }
        numTrimmedRight++;
        return sequence.substring(0,currentLength - trimedLength);
      }
    }
  }
  return sequence;
}

Fixed version (ground truth):
protected MutableString trimRight(int length,MutableString sequence,ByteString qualityScores,ByteArrayList newQualScores,MutableString[] adapters){
  int currentLength=sequence.length();
  for (  MutableString adapter : adapters) {
    final int adaptLength=adapter.length();
    for (int j=minRightLength; j < adaptLength; j++) {
      if (sequence.endsWith(adapter.subSequence(j,adaptLength))) {
        final int trimedLength=adaptLength - j;
        if (trimedLength > 10) {
          System.out.printf("String_Node_Str",trimedLength,sequence,adapter);
        }
        if (currentLength == length) {
          if (newQualScores.size() == 0) {
            copy(qualityScores,newQualScores);
          }
        }
        if (!qualityScores.isEmpty()) {
          newQualScores.removeElements(currentLength - trimedLength,Math.min(currentLength + 1,newQualScores.size()));
        }
        numTrimmedRight++;
        return sequence.substring(0,currentLength - trimedLength);
      }
    }
  }
  return sequence;
}
Program: 50258
Project: 50258
Buggy source:
protected MutableString trimLeft(int length,MutableString sequence,ByteString qualityScores,ByteArrayList newQualScores,MutableString[] adapters){
  int currentLength=sequence.length();
  for (  MutableString adapter : adapters) {
    final int adaptLength=adapter.length();
    for (int j=adaptLength; j >= minLeftLength; --j) {
      if (sequence.startsWith(adapter.subSequence(0,j))) {
        final int trimedLength=j;
        if (trimedLength > 10) {
          System.out.printf("String_Node_Str",trimedLength,sequence,adapter);
        }
        if (currentLength == length) {
          copy(qualityScores,newQualScores);
        }
        if (!qualityScores.isEmpty()) {
          newQualScores.removeElements(0,trimedLength);
        }
        numTrimmedLeft++;
        return sequence.substring(trimedLength,currentLength);
      }
    }
  }
  return sequence;
}

Fixed version (ground truth):
protected MutableString trimLeft(int length,MutableString sequence,ByteString qualityScores,ByteArrayList newQualScores,MutableString[] adapters){
  int currentLength=sequence.length();
  for (  MutableString adapter : adapters) {
    final int adaptLength=adapter.length();
    for (int j=adaptLength; j >= minLeftLength; --j) {
      if (sequence.startsWith(adapter.subSequence(0,j))) {
        final int trimedLength=j;
        if (trimedLength > 10) {
          System.out.printf("String_Node_Str",trimedLength,sequence,adapter);
        }
        if (currentLength == length) {
          if (newQualScores.size() == 0) {
            copy(qualityScores,newQualScores);
          }
        }
        if (!qualityScores.isEmpty()) {
          newQualScores.removeElements(0,trimedLength);
        }
        numTrimmedLeft++;
        return sequence.substring(trimedLength,currentLength);
      }
    }
  }
  return sequence;
}
Program: 50259
Project: 50259
Buggy source:
/** 
 * Returns true if filename belongs to an alignment basename that can be read.
 * @param filename Filename of an alignment component.
 * @return True if the alignment can be read, false otherwise.
 */
public static boolean canRead(final String filename){
  final String filenameNoExtension=FilenameUtils.removeExtension(filename);
  int count=0;
  for (  final String extension : AlignmentReaderImpl.COMPACT_ALIGNMENT_FILE_REQUIRED_EXTS) {
    if (RepositionableInputStream.resourceExist(filenameNoExtension + extension)) {
      count++;
    }
  }
  return count == AlignmentReaderImpl.COMPACT_ALIGNMENT_FILE_REQUIRED_EXTS.length;
}

Fixed version (ground truth):
/** 
 * Returns true if filename belongs to an alignment basename that can be read.
 * @param filename Filename of an alignment component.
 * @return True if the alignment can be read, false otherwise.
 */
public static boolean canRead(final String filename){
  final String filenameNoExtension=FilenameUtils.removeExtension(filename);
  String fileExtension=FilenameUtils.getExtension(filename);
  if (!ArrayUtils.contains(AlignmentReaderImpl.COMPACT_ALIGNMENT_FILE_REQUIRED_EXTS,fileExtension)) {
    return false;
  }
  int count=0;
  for (  final String extension : AlignmentReaderImpl.COMPACT_ALIGNMENT_FILE_REQUIRED_EXTS) {
    if (RepositionableInputStream.resourceExist(filenameNoExtension + extension)) {
      count++;
    }
  }
  return count == AlignmentReaderImpl.COMPACT_ALIGNMENT_FILE_REQUIRED_EXTS.length;
}
Program: 50260
Project: 50260
Buggy source:
@Override public int getReferenceIndex(String referenceId){
  return (int)namesToIndices.getInt(referenceId);
}

Fixed version (ground truth):
@Override public int getReferenceIndex(final String referenceId){
  return (int)namesToIndices.getInt(referenceId);
}
Program: 50261
Project: 50261
Buggy source:
public void print(int referenceIndex){
  for (int i=0; i < getLength(referenceIndex); i++) {
    if (i % basesPerLine[referenceIndex] == 0) {
      System.out.println("String_Node_Str" + i + "String_Node_Str");
    }
    System.out.print(get(referenceIndex,i));
  }
}

Fixed version (ground truth):
public void print(final int referenceIndex){
  for (int i=0; i < getLength(referenceIndex); i++) {
    if (i % basesPerLine[referenceIndex] == 0) {
      System.out.println("String_Node_Str" + i + "String_Node_Str");
    }
    System.out.print(get(referenceIndex,i));
  }
}
Program: 50262
Project: 50262
Buggy source:
@Override public void getRange(int referenceIndex,int position,int length,MutableString bases){
}

Fixed version (ground truth):
@Override public void getRange(final int referenceIndex,final int position,final int length,final MutableString bases){
}
Program: 50263
Project: 50263
Buggy source:
@Override public int getLength(int targetIndex){
  return (int)lengths[targetIndex];
}

Fixed version (ground truth):
@Override public int getLength(final int targetIndex){
  return (int)lengths[targetIndex];
}
Program: 50264
Project: 50264
Buggy source:
@Override public String getReferenceName(int index){
  return names[index];
}

Fixed version (ground truth):
@Override public String getReferenceName(final int index){
  return names[index];
}
Program: 50265
Project: 50265
Buggy source:
public PicardFastaIndexedSequence(String filename) throws FileNotFoundException {
  delegate=new IndexedFastaSequenceFile(new File(filename));
  indexDelegate=new FastaSequenceIndex(new File(filename + "String_Node_Str"));
  final int numContigs=indexDelegate.size();
  if (!delegate.isIndexed())   throw new FileNotFoundException("String_Node_Str" + filename);
  lengths=new int[numContigs];
  names=new String[numContigs];
  basesPerLine=new long[numContigs];
  final LineIterator lineIt=new LineIterator(new FileReader(filename + "String_Node_Str"));
  int index=0;
  while (lineIt.hasNext()) {
    String line=lineIt.nextLine();
    String[] tokens=line.split("String_Node_Str");
    names[index]=tokens[0];
    namesToIndices.put(tokens[0],index);
    lengths[index]=Integer.parseInt(tokens[1]);
    basesPerLine[index]=Long.parseLong(tokens[2]);
    index++;
  }
}

Fixed version (ground truth):
public PicardFastaIndexedSequence(final String filename) throws FileNotFoundException {
  delegate=new IndexedFastaSequenceFile(new File(filename));
  indexDelegate=new FastaSequenceIndex(new File(filename + "String_Node_Str"));
  final int numContigs=indexDelegate.size();
  if (!delegate.isIndexed())   throw new FileNotFoundException("String_Node_Str" + filename);
  lengths=new int[numContigs];
  names=new String[numContigs];
  basesPerLine=new long[numContigs];
  final LineIterator lineIt=new LineIterator(new FileReader(filename + "String_Node_Str"));
  int index=0;
  while (lineIt.hasNext()) {
    final String line=lineIt.nextLine();
    final String[] tokens=line.split("String_Node_Str");
    names[index]=tokens[0];
    namesToIndices.put(tokens[0],index);
    lengths[index]=Integer.parseInt(tokens[1]);
    basesPerLine[index]=Long.parseLong(tokens[2]);
    index++;
  }
}
Program: 50266
Project: 50266
Buggy source:
public void testRoundTrips() throws IOException {
  File dir=new File("String_Node_Str");
  File[] files=dir.listFiles(new FilenameFilter(){
    @Override public boolean accept(    File file,    String s){
      if (s.startsWith("String_Node_Str") && s.endsWith("String_Node_Str"))       return true;
 else       return false;
    }
  }
);
  for (  File inputFile : files) {
    String filename=inputFile.getAbsolutePath();
    boolean preserveSoftClips=true;
    boolean preserveAllReadQuals=true;
    String importedBasename=importFile(filename,preserveSoftClips,preserveAllReadQuals);
    String exportedSamFilename=exportFile(importedBasename);
    TestFiles tester=new TestFiles();
    tester.assertEquals(inputFile,new File(exportedSamFilename));
  }
}

Fixed version (ground truth):
public void testRoundTrips() throws IOException {
  File dir=new File("String_Node_Str");
  File[] files=dir.listFiles(new FilenameFilter(){
    @Override public boolean accept(    File file,    String s){
      if (s.startsWith("String_Node_Str") && s.endsWith("String_Node_Str"))       return true;
 else       return false;
    }
  }
);
  for (  File inputFile : files) {
    String filename=inputFile.getAbsolutePath();
    boolean preserveSoftClips=true;
    boolean preserveAllReadQuals=true;
    String importedBasename=importFile(filename,preserveSoftClips,preserveAllReadQuals);
    String exportedSamFilename=exportFile(importedBasename,null);
    TestFiles tester=new TestFiles();
    tester.assertEquals(inputFile,new File(exportedSamFilename));
  }
}
Program: 50267
Project: 50267
Buggy source:
private String exportFile(String importedBasename) throws IOException {
  final String outputFilename=FilenameUtils.concat(BASE_TEST_DIR,"String_Node_Str" + counterSam++ + "String_Node_Str");
  CompactToSAMMode exporter=new CompactToSAMMode();
  exporter.setInputBasename(importedBasename);
  exporter.setOutput(outputFilename);
  RandomAccessSequenceInterface genomeTestSupport=new RandomAccessSequenceInterface(){
    @Override public char get(    int referenceIndex,    int position){
      return 'A';
    }
    @Override public int getLength(    int targetIndex){
      return Integer.MAX_VALUE;
    }
    @Override public void getRange(    int referenceIndex,    int position,    int length,    MutableString bases){
      bases.setLength(0);
      for (int i=0; i < length; i++) {
        bases.append('A');
      }
    }
    @Override public int getReferenceIndex(    String referenceId){
      return 0;
    }
    @Override public String getReferenceName(    int index){
      return "String_Node_Str";
    }
    @Override public int size(){
      return 5;
    }
  }
;
  exporter.setGenome(genomeTestSupport);
  exporter.execute();
  return outputFilename;
}

Fixed version (ground truth):
private String exportFile(String importedBasename,String genomePath) throws IOException {
  final String outputFilename=FilenameUtils.concat(BASE_TEST_DIR,"String_Node_Str" + counterSam++ + "String_Node_Str");
  CompactToSAMMode exporter=new CompactToSAMMode();
  exporter.setInputBasename(importedBasename);
  exporter.setOutput(outputFilename);
  if (genomePath != null) {
    exporter.setGenome(new PicardFastaIndexedSequence(genomePath));
  }
 else {
    RandomAccessSequenceInterface genomeTestSupport=new RandomAccessSequenceInterface(){
      @Override public char get(      int referenceIndex,      int position){
        return 'A';
      }
      @Override public int getLength(      int targetIndex){
        return Integer.MAX_VALUE;
      }
      @Override public void getRange(      int referenceIndex,      int position,      int length,      MutableString bases){
        bases.setLength(0);
        for (int i=0; i < length; i++) {
          bases.append('A');
        }
      }
      @Override public int getReferenceIndex(      String referenceId){
        return 0;
      }
      @Override public String getReferenceName(      int index){
        return "String_Node_Str";
      }
      @Override public int size(){
        return 5;
      }
    }
;
    exporter.setGenome(genomeTestSupport);
  }
  exporter.execute();
  return outputFilename;
}
Program: 50268
Project: 50268
Buggy source:
private String importFile(String filename,boolean preserveSoftClips,boolean preserveAllReadQuals) throws IOException {
  SAMToCompactMode importer=new SAMToCompactMode();
  importer.setInputFile(filename);
  final String outputFilename=FilenameUtils.concat(BASE_TEST_DIR,"String_Node_Str" + counterGoby++);
  importer.setOutputFile(outputFilename);
  importer.setPreserveSoftClips(preserveSoftClips);
  importer.setPreserveReadQualityScores(true);
  importer.setPreserveAllTags(true);
  importer.execute();
  return outputFilename;
}

Fixed version (ground truth):
private String importFile(String filename,boolean preserveSoftClips,boolean preserveAllReadQuals) throws IOException {
  SAMToCompactMode importer=new SAMToCompactMode();
  importer.setInputFile(filename);
  final String outputFilename=FilenameUtils.concat(BASE_TEST_DIR,"String_Node_Str" + counterGoby++);
  importer.setOutputFile(outputFilename);
  importer.setPreserveReadName(true);
  importer.setPreserveSoftClips(preserveSoftClips);
  importer.setPreserveReadQualityScores(true);
  importer.setPreserveAllTags(true);
  importer.execute();
  return outputFilename;
}
Program: 50269
Project: 50269
Buggy source:
@Test public void testEncodeDecodeOneSequence() throws IOException {
  final RandomAccessSequenceInterface cache=new PicardFastaIndexedSequence("String_Node_Str");
  int i=0;
  assertEquals('A',cache.get(0,i++));
  assertEquals('C',cache.get(0,i++));
  assertEquals('T',cache.get(0,i++));
  assertEquals('G',cache.get(0,i++));
  assertEquals('N',cache.get(0,i++));
  assertEquals('N',cache.get(0,i++));
  assertEquals('N',cache.get(0,i++));
  assertEquals('A',cache.get(0,i++));
  assertEquals('C',cache.get(0,i++));
  assertEquals('T',cache.get(0,i++));
  assertEquals('G',cache.get(0,i++));
  try {
    cache.get(0,i++);
    fail();
  }
 catch (  AssertionError e) {
  }
}

Fixed version (ground truth):
@Test public void testEncodeDecodeOneSequence() throws IOException {
  final RandomAccessSequenceInterface cache=new PicardFastaIndexedSequence("String_Node_Str");
  int i=0;
  assertEquals('A',cache.get(0,i++));
  assertEquals('C',cache.get(0,i++));
  assertEquals('T',cache.get(0,i++));
  assertEquals('G',cache.get(0,i++));
  assertEquals('N',cache.get(0,i++));
  assertEquals('N',cache.get(0,i++));
  assertEquals('N',cache.get(0,i++));
  assertEquals('A',cache.get(0,i++));
  assertEquals('C',cache.get(0,i++));
  assertEquals('T',cache.get(0,i++));
  assertEquals('G',cache.get(0,i++));
  try {
    cache.get(0,i++);
    fail();
  }
 catch (  AssertionError e) {
  }
catch (  StringIndexOutOfBoundsException e) {
  }
}
Program: 50270
Project: 50270
Buggy source:
@Override public int getReferenceIndex(String referenceId){
  return (int)namesToIndices.getInt(referenceId);
}

Fixed version (ground truth):
@Override public int getReferenceIndex(final String referenceId){
  return (int)namesToIndices.getInt(referenceId);
}
Program: 50271
Project: 50271
Buggy source:
public void print(int referenceIndex){
  for (int i=0; i < getLength(referenceIndex); i++) {
    if (i % basesPerLine[referenceIndex] == 0) {
      System.out.println("String_Node_Str" + i + "String_Node_Str");
    }
    System.out.print(get(referenceIndex,i));
  }
}

Fixed version (ground truth):
public void print(final int referenceIndex){
  for (int i=0; i < getLength(referenceIndex); i++) {
    if (i % basesPerLine[referenceIndex] == 0) {
      System.out.println("String_Node_Str" + i + "String_Node_Str");
    }
    System.out.print(get(referenceIndex,i));
  }
}
Program: 50272
Project: 50272
Buggy source:
@Override public void getRange(int referenceIndex,int position,int length,MutableString bases){
}

Fixed version (ground truth):
@Override public void getRange(final int referenceIndex,final int position,final int length,final MutableString bases){
}
Program: 50273
Project: 50273
Buggy source:
@Override public int getLength(int targetIndex){
  return (int)lengths[targetIndex];
}

Fixed version (ground truth):
@Override public int getLength(final int targetIndex){
  return (int)lengths[targetIndex];
}
Program: 50274
Project: 50274
Buggy source:
@Override public String getReferenceName(int index){
  return names[index];
}

Fixed version (ground truth):
@Override public String getReferenceName(final int index){
  return names[index];
}
Program: 50275
Project: 50275
Buggy source:
public PicardFastaIndexedSequence(String filename) throws FileNotFoundException {
  delegate=new IndexedFastaSequenceFile(new File(filename));
  indexDelegate=new FastaSequenceIndex(new File(filename + "String_Node_Str"));
  final int numContigs=indexDelegate.size();
  if (!delegate.isIndexed())   throw new FileNotFoundException("String_Node_Str" + filename);
  lengths=new int[numContigs];
  names=new String[numContigs];
  basesPerLine=new long[numContigs];
  final LineIterator lineIt=new LineIterator(new FileReader(filename + "String_Node_Str"));
  int index=0;
  while (lineIt.hasNext()) {
    String line=lineIt.nextLine();
    String[] tokens=line.split("String_Node_Str");
    names[index]=tokens[0];
    namesToIndices.put(tokens[0],index);
    lengths[index]=Integer.parseInt(tokens[1]);
    basesPerLine[index]=Long.parseLong(tokens[2]);
    index++;
  }
}

Fixed version (ground truth):
public PicardFastaIndexedSequence(final String filename) throws FileNotFoundException {
  delegate=new IndexedFastaSequenceFile(new File(filename));
  indexDelegate=new FastaSequenceIndex(new File(filename + "String_Node_Str"));
  final int numContigs=indexDelegate.size();
  if (!delegate.isIndexed())   throw new FileNotFoundException("String_Node_Str" + filename);
  lengths=new int[numContigs];
  names=new String[numContigs];
  basesPerLine=new long[numContigs];
  final LineIterator lineIt=new LineIterator(new FileReader(filename + "String_Node_Str"));
  int index=0;
  while (lineIt.hasNext()) {
    final String line=lineIt.nextLine();
    final String[] tokens=line.split("String_Node_Str");
    names[index]=tokens[0];
    namesToIndices.put(tokens[0],index);
    lengths[index]=Integer.parseInt(tokens[1]);
    basesPerLine[index]=Long.parseLong(tokens[2]);
    index++;
  }
}
Program: 50276
Project: 50276
Buggy source:
public void testRoundTrips() throws IOException {
  File dir=new File("String_Node_Str");
  File[] files=dir.listFiles(new FilenameFilter(){
    @Override public boolean accept(    File file,    String s){
      if (s.startsWith("String_Node_Str") && s.endsWith("String_Node_Str"))       return true;
 else       return false;
    }
  }
);
  for (  File inputFile : files) {
    String filename=inputFile.getAbsolutePath();
    boolean preserveSoftClips=true;
    boolean preserveAllReadQuals=true;
    String importedBasename=importFile(filename,preserveSoftClips,preserveAllReadQuals);
    String exportedSamFilename=exportFile(importedBasename);
    TestFiles tester=new TestFiles();
    tester.assertEquals(inputFile,new File(exportedSamFilename));
  }
}

Fixed version (ground truth):
public void testRoundTrips() throws IOException {
  File dir=new File("String_Node_Str");
  File[] files=dir.listFiles(new FilenameFilter(){
    @Override public boolean accept(    File file,    String s){
      if (s.startsWith("String_Node_Str") && s.endsWith("String_Node_Str"))       return true;
 else       return false;
    }
  }
);
  for (  File inputFile : files) {
    String filename=inputFile.getAbsolutePath();
    boolean preserveSoftClips=true;
    boolean preserveAllReadQuals=true;
    String importedBasename=importFile(filename,preserveSoftClips,preserveAllReadQuals);
    String exportedSamFilename=exportFile(importedBasename,null);
    TestFiles tester=new TestFiles();
    tester.assertEquals(inputFile,new File(exportedSamFilename));
  }
}
Program: 50277
Project: 50277
Buggy source:
private String exportFile(String importedBasename) throws IOException {
  final String outputFilename=FilenameUtils.concat(BASE_TEST_DIR,"String_Node_Str" + counterSam++ + "String_Node_Str");
  CompactToSAMMode exporter=new CompactToSAMMode();
  exporter.setInputBasename(importedBasename);
  exporter.setOutput(outputFilename);
  RandomAccessSequenceInterface genomeTestSupport=new RandomAccessSequenceInterface(){
    @Override public char get(    int referenceIndex,    int position){
      return 'A';
    }
    @Override public int getLength(    int targetIndex){
      return Integer.MAX_VALUE;
    }
    @Override public void getRange(    int referenceIndex,    int position,    int length,    MutableString bases){
      bases.setLength(0);
      for (int i=0; i < length; i++) {
        bases.append('A');
      }
    }
    @Override public int getReferenceIndex(    String referenceId){
      return 0;
    }
    @Override public String getReferenceName(    int index){
      return "String_Node_Str";
    }
    @Override public int size(){
      return 5;
    }
  }
;
  exporter.setGenome(genomeTestSupport);
  exporter.execute();
  return outputFilename;
}

Fixed version (ground truth):
private String exportFile(String importedBasename,String genomePath) throws IOException {
  final String outputFilename=FilenameUtils.concat(BASE_TEST_DIR,"String_Node_Str" + counterSam++ + "String_Node_Str");
  CompactToSAMMode exporter=new CompactToSAMMode();
  exporter.setInputBasename(importedBasename);
  exporter.setOutput(outputFilename);
  if (genomePath != null) {
    exporter.setGenome(new PicardFastaIndexedSequence(genomePath));
  }
 else {
    RandomAccessSequenceInterface genomeTestSupport=new RandomAccessSequenceInterface(){
      @Override public char get(      int referenceIndex,      int position){
        return 'A';
      }
      @Override public int getLength(      int targetIndex){
        return Integer.MAX_VALUE;
      }
      @Override public void getRange(      int referenceIndex,      int position,      int length,      MutableString bases){
        bases.setLength(0);
        for (int i=0; i < length; i++) {
          bases.append('A');
        }
      }
      @Override public int getReferenceIndex(      String referenceId){
        return 0;
      }
      @Override public String getReferenceName(      int index){
        return "String_Node_Str";
      }
      @Override public int size(){
        return 5;
      }
    }
;
    exporter.setGenome(genomeTestSupport);
  }
  exporter.execute();
  return outputFilename;
}
Program: 50278
Project: 50278
Buggy source:
private String importFile(String filename,boolean preserveSoftClips,boolean preserveAllReadQuals) throws IOException {
  SAMToCompactMode importer=new SAMToCompactMode();
  importer.setInputFile(filename);
  final String outputFilename=FilenameUtils.concat(BASE_TEST_DIR,"String_Node_Str" + counterGoby++);
  importer.setOutputFile(outputFilename);
  importer.setPreserveSoftClips(preserveSoftClips);
  importer.setPreserveReadQualityScores(true);
  importer.setPreserveAllTags(true);
  importer.execute();
  return outputFilename;
}

Fixed version (ground truth):
private String importFile(String filename,boolean preserveSoftClips,boolean preserveAllReadQuals) throws IOException {
  SAMToCompactMode importer=new SAMToCompactMode();
  importer.setInputFile(filename);
  final String outputFilename=FilenameUtils.concat(BASE_TEST_DIR,"String_Node_Str" + counterGoby++);
  importer.setOutputFile(outputFilename);
  importer.setPreserveReadName(true);
  importer.setPreserveSoftClips(preserveSoftClips);
  importer.setPreserveReadQualityScores(true);
  importer.setPreserveAllTags(true);
  importer.execute();
  return outputFilename;
}
Program: 50279
Project: 50279
Buggy source:
@Test public void testEncodeDecodeOneSequence() throws IOException {
  final RandomAccessSequenceInterface cache=new PicardFastaIndexedSequence("String_Node_Str");
  int i=0;
  assertEquals('A',cache.get(0,i++));
  assertEquals('C',cache.get(0,i++));
  assertEquals('T',cache.get(0,i++));
  assertEquals('G',cache.get(0,i++));
  assertEquals('N',cache.get(0,i++));
  assertEquals('N',cache.get(0,i++));
  assertEquals('N',cache.get(0,i++));
  assertEquals('A',cache.get(0,i++));
  assertEquals('C',cache.get(0,i++));
  assertEquals('T',cache.get(0,i++));
  assertEquals('G',cache.get(0,i++));
  try {
    cache.get(0,i++);
    fail();
  }
 catch (  AssertionError e) {
  }
}

Fixed version (ground truth):
@Test public void testEncodeDecodeOneSequence() throws IOException {
  final RandomAccessSequenceInterface cache=new PicardFastaIndexedSequence("String_Node_Str");
  int i=0;
  assertEquals('A',cache.get(0,i++));
  assertEquals('C',cache.get(0,i++));
  assertEquals('T',cache.get(0,i++));
  assertEquals('G',cache.get(0,i++));
  assertEquals('N',cache.get(0,i++));
  assertEquals('N',cache.get(0,i++));
  assertEquals('N',cache.get(0,i++));
  assertEquals('A',cache.get(0,i++));
  assertEquals('C',cache.get(0,i++));
  assertEquals('T',cache.get(0,i++));
  assertEquals('G',cache.get(0,i++));
  try {
    cache.get(0,i++);
    fail();
  }
 catch (  AssertionError e) {
  }
catch (  StringIndexOutOfBoundsException e) {
  }
}
Program: 50280
Project: 50280
Buggy source:
private synchronized void writeStats() throws IOException {
  if (!statsWritten) {
    stats.put("String_Node_Str",FilenameUtils.getName(basename));
    stats.put("String_Node_Str",Integer.toString(permutator.getBiggestSmallIndex()));
    stats.put("String_Node_Str",Integer.toString(permutator.getSmallestIndex()));
    stats.put("String_Node_Str",Integer.toString(getNumQueries()));
    stats.put("String_Node_Str",basename);
    stats.put("String_Node_Str",Integer.toString(numberOfAlignedReads));
    stats.store(statsWriter,"String_Node_Str");
    statsWritten=true;
  }
}

Fixed version (ground truth):
private synchronized void writeStats() throws IOException {
  if (!statsWritten) {
    stats.put("String_Node_Str",FilenameUtils.getName(basename));
    stats.put("String_Node_Str",Integer.toString(permutator.getSmallestIndex()));
    stats.put("String_Node_Str",Integer.toString(permutator.getBiggestSmallIndex()));
    stats.put("String_Node_Str",Integer.toString(getNumQueries()));
    stats.put("String_Node_Str",basename);
    stats.put("String_Node_Str",Integer.toString(numberOfAlignedReads));
    stats.store(statsWriter,"String_Node_Str");
    statsWritten=true;
  }
}
Program: 50281
Project: 50281
Buggy source:
public void printStats(final PrintStream out){
  this.entriesChunkWriter.printStats(out);
  out.println("String_Node_Str" + minQueryIndex);
  out.println("String_Node_Str" + maxQueryIndex);
  out.println("String_Node_Str" + getNumQueries());
  out.println("String_Node_Str" + (maxTargetIndex + 1));
}

Fixed version (ground truth):
public void printStats(final PrintStream out){
  this.entriesChunkWriter.printStats(out);
  out.println("String_Node_Str" + permutator.getSmallestIndex());
  out.println("String_Node_Str" + permutator.getBiggestSmallIndex());
  out.println("String_Node_Str" + getNumQueries());
  out.println("String_Node_Str" + (maxTargetIndex + 1));
}
Program: 50282
Project: 50282
Buggy source:
/** 
 * Before each file, reset the state, report the filename about to be processed.
 * @param inputFilename the filename to be processed.
 */
private void processingStart(final String inputFilename){
  System.out.printf("String_Node_Str",inputFilename);
  numQualScoresSampled=0;
  sumQualScores=0;
  minQualScore=Integer.MAX_VALUE;
  maxQualScore=Integer.MIN_VALUE;
}

Fixed version (ground truth):
/** 
 * Before each file, reset the state, report the filename about to be processed.
 * @param inputFilename the filename to be processed.
 */
private void processingStart(final String inputFilename){
  System.out.printf("String_Node_Str",inputFilename);
  numQualScoresSampled=0;
  sumQualScores=0;
  minQualScore=Integer.MAX_VALUE;
  maxQualScore=Integer.MIN_VALUE;
  qualityScoresFound=false;
}
Program: 50283
Project: 50283
Buggy source:
/** 
 * Process ONE compact-reads file.
 * @param inputFilename the filename to process
 * @return the number of read entries processed
 * @throws IOException error reading file
 */
private int processCompactReadsFile(final String inputFilename) throws IOException {
  int i=0;
  for (  final Reads.ReadEntry entry : new ReadsReader(inputFilename)) {
    final byte[] qualityScores=entry.getQualityScores().toByteArray();
    final boolean hasQualityScores=entry.hasQualityScores() && !ArrayUtils.isEmpty(qualityScores);
    if (hasQualityScores) {
      for (      final int qualScore : qualityScores) {
        minQualScore=Math.min(qualScore,minQualScore);
        maxQualScore=Math.max(qualScore,maxQualScore);
        numQualScoresSampled++;
        sumQualScores+=Math.abs(qualScore);
      }
      if (++i == numberOfReadEntriesToProcess) {
        break;
      }
    }
  }
  return i;
}

Fixed version (ground truth):
/** 
 * Process ONE compact-reads file.
 * @param inputFilename the filename to process
 * @return the number of read entries processed
 * @throws IOException error reading file
 */
private int processCompactReadsFile(final String inputFilename) throws IOException {
  int i=0;
  for (  final Reads.ReadEntry entry : new ReadsReader(inputFilename)) {
    final byte[] qualityScores=entry.getQualityScores().toByteArray();
    final boolean hasQualityScores=entry.hasQualityScores() && !ArrayUtils.isEmpty(qualityScores);
    if (hasQualityScores) {
      qualityScoresFound=true;
      for (      final int qualScore : qualityScores) {
        minQualScore=Math.min(qualScore,minQualScore);
        maxQualScore=Math.max(qualScore,maxQualScore);
        numQualScoresSampled++;
        sumQualScores+=Math.abs(qualScore);
      }
      if (++i == numberOfReadEntriesToProcess) {
        break;
      }
    }
  }
  return i;
}
Program: 50284
Project: 50284
Buggy source:
/** 
 * Process ONE FASTQ file.
 * @param inputFilename the filename to process
 * @return the number of read entries processed
 * @throws IOException error reading file
 */
private int processFastqFile(final String inputFilename) throws IOException {
  int i=0;
  for (  final FastXEntry entry : new FastXReader(inputFilename)) {
    final MutableString quality=entry.getQuality();
    if (quality.length() != 0) {
      for (      final int qualScore : quality.array()) {
        minQualScore=Math.min(qualScore,minQualScore);
        maxQualScore=Math.max(qualScore,maxQualScore);
        numQualScoresSampled++;
        sumQualScores+=Math.abs(qualScore);
      }
      if (++i == numberOfReadEntriesToProcess) {
        break;
      }
    }
  }
  return i;
}

Fixed version (ground truth):
/** 
 * Process ONE FASTQ file.
 * @param inputFilename the filename to process
 * @return the number of read entries processed
 * @throws IOException error reading file
 */
private int processFastqFile(final String inputFilename) throws IOException {
  int i=0;
  for (  final FastXEntry entry : new FastXReader(inputFilename)) {
    final MutableString quality=entry.getQuality();
    if (quality.length() != 0) {
      qualityScoresFound=true;
      for (      final int qualScore : quality.array()) {
        minQualScore=Math.min(qualScore,minQualScore);
        maxQualScore=Math.max(qualScore,maxQualScore);
        numQualScoresSampled++;
        sumQualScores+=Math.abs(qualScore);
      }
      if (++i == numberOfReadEntriesToProcess) {
        break;
      }
    }
  }
  return i;
}
Program: 50285
Project: 50285
Buggy source:
/** 
 * After each file, report the details for the file.
 * @param numEntries the number of read entries processed.
 */
private void processingEnd(final int numEntries){
  System.out.printf("String_Node_Str",numEntries);
  final int avgQualScore=(int)(sumQualScores / numQualScoresSampled);
  final String likelyEncoding;
  if (avgQualScore <= 41) {
    likelyEncoding="String_Node_Str";
  }
 else   if (avgQualScore <= 83) {
    likelyEncoding="String_Node_Str";
  }
 else {
    likelyEncoding="String_Node_Str";
  }
  System.out.printf("String_Node_Str",minQualScore);
  System.out.printf("String_Node_Str",maxQualScore);
  System.out.printf("String_Node_Str",avgQualScore);
  System.out.printf("String_Node_Str",likelyEncoding);
  likelyEncodings.add(likelyEncoding);
  avgQualScores.add(avgQualScore);
}

Fixed version (ground truth):
/** 
 * After each file, report the details for the file.
 * @param numEntries the number of read entries processed.
 */
private void processingEnd(final int numEntries){
  System.out.printf("String_Node_Str",numEntries);
  final int avgQualScore=(int)(sumQualScores / numQualScoresSampled);
  final String likelyEncoding;
  if (!qualityScoresFound) {
    likelyEncoding="String_Node_Str";
  }
 else   if (avgQualScore <= 41) {
    likelyEncoding="String_Node_Str";
  }
 else   if (avgQualScore <= 83) {
    likelyEncoding="String_Node_Str";
  }
 else {
    likelyEncoding="String_Node_Str";
  }
  System.out.printf("String_Node_Str",minQualScore);
  System.out.printf("String_Node_Str",maxQualScore);
  System.out.printf("String_Node_Str",avgQualScore);
  System.out.printf("String_Node_Str",likelyEncoding);
  likelyEncodings.add(likelyEncoding);
  avgQualScores.add(avgQualScore);
}
Program: 50289
Project: 50289
Buggy source:
/** 
 * Support for splitting the entries on the file system. Seek the input to start and start looking for the beginning of a new collection. When found, return all entries in the collection through hasNext, next(). Will possibly return additional collection of entries, but will stop returning new entries if the position in the input stream is past end.
 * @param start The start index for the split
 * @param end   The end index for the split
 * @param input The input stream containing the data
 * @throws IOException if there is a problem reading from the stream
 */
public FastBufferedMessageChunksReader(final long start,long end,final FastBufferedInputStream input) throws IOException {
  super();
  this.startOffset=start;
  this.endOffset=end;
  if (start < 0L) {
    throw new IllegalArgumentException("String_Node_Str" + start + "String_Node_Str");
  }
  if (end != Long.MAX_VALUE && end < 0L) {
    throw new IllegalArgumentException("String_Node_Str" + end + "String_Node_Str");
  }
  if (start > end) {
    throw new IllegalArgumentException("String_Node_Str" + start + "String_Node_Str"+ end+ "String_Node_Str");
  }
  if (end != Long.MAX_VALUE && start != end) {
    end+=MessageChunksWriter.DELIMITER_LENGTH + 4;
  }
  this.end=end;
  this.input=input;
  reposition(start,end);
}

Fixed version (ground truth):
/** 
 * Support for splitting the entries on the file system. Seek the input to start and start looking for the beginning of a new collection. When found, return all entries in the collection through hasNext, next(). Will possibly return additional collection of entries, but will stop returning new entries if the position in the input stream is past end.
 * @param start The start index for the split
 * @param end   The end index for the split
 * @param input The input stream containing the data
 * @throws IOException if there is a problem reading from the stream
 */
public FastBufferedMessageChunksReader(final long start,long end,final FastBufferedInputStream input) throws IOException {
  super();
  this.startOffset=start;
  this.endOffset=end;
  if (start < 0L) {
    throw new IllegalArgumentException("String_Node_Str" + start + "String_Node_Str");
  }
  if (end != Long.MAX_VALUE && end < 0L) {
    throw new IllegalArgumentException("String_Node_Str" + end + "String_Node_Str");
  }
  if (start > end) {
    throw new IllegalArgumentException("String_Node_Str" + start + "String_Node_Str"+ end+ "String_Node_Str");
  }
  if (end != Long.MAX_VALUE && start != end) {
    end+=MessageChunksWriter.DELIMITER_LENGTH + 4;
  }
  this.end=end;
  this.input=input;
  supportedCodecRegistrationCodes=ChunkCodecHelper.registrationCodes();
  reposition(start,end);
}
Program: 50290
Project: 50290
Buggy source:
/** 
 * Record all intra-group sample pairs for latter use.
 * @param groupIndex
 */
public void recordPairForGroup(int groupIndex){
  samplePairsForGroup[groupIndex]=new ObjectArrayList<SamplePair>();
  IntSet sampleIndicesInGroup=new IntAVLTreeSet();
  for (int sampleIndex=0; sampleIndex < numSamples; sampleIndex++) {
    if (sampleIndexToGroupIndex[sampleIndex] == groupIndex) {
      sampleIndicesInGroup.add(sampleIndex);
    }
  }
  for (  int sampleIndexA : sampleIndicesInGroup) {
    for (    int sampleIndexB : sampleIndicesInGroup) {
      if (sampleIndexA < sampleIndexB) {
        samplePairsForGroup[groupIndex].add(new SamplePair(sampleIndexA,sampleIndexB));
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Record all intra-group sample pairs for latter use.
 * @param groupIndex
 */
public void recordPairForGroup(int groupIndex){
  samplePairsForGroup[groupIndex]=new ObjectArrayList<SamplePair>();
  IntSet sampleIndicesInGroup=new IntAVLTreeSet();
  for (int sampleIndex=0; sampleIndex < numSamples; sampleIndex++) {
    if (sampleIndexToGroupIndex[sampleIndex] == groupIndex) {
      sampleIndicesInGroup.add(sampleIndex);
    }
  }
  final ObjectArraySet<SamplePair> set=new ObjectArraySet<SamplePair>();
  for (  final int sampleIndexA : sampleIndicesInGroup) {
    for (    final int sampleIndexB : sampleIndicesInGroup) {
      if (sampleIndexA != sampleIndexB) {
        set.add(new SamplePair(sampleIndexA,sampleIndexB));
      }
    }
  }
  samplePairsForGroup[groupIndex].addAll(set);
}
Program: 50293
Project: 50293
Buggy source:
private void mergeReadOrigins(int readerIndex,List<Alignments.ReadOriginInfo> readOriginInfo){
  for (  Alignments.ReadOriginInfo roi : readOriginInfo) {
    final int[] permutation=new int[readOriginInfo.size()];
    readOriginPermutations[readerIndex]=permutation;
    for (int i=0; i < permutation.length; i++) {
      final int newReadOriginIndex=nextAvailableReadOriginIndex++;
      permutation[roi.getOriginIndex()]=newReadOriginIndex;
      Alignments.ReadOriginInfo.Builder newRoi=Alignments.ReadOriginInfo.newBuilder(roi);
      newRoi.setOriginIndex(newReadOriginIndex);
      mergedReadOriginInfoList.add(newRoi.build());
    }
  }
}

Fixed version (ground truth):
private void mergeReadOrigins(int readerIndex,List<Alignments.ReadOriginInfo> readOriginInfo,int numberOfReaders){
  for (  Alignments.ReadOriginInfo roi : readOriginInfo) {
    final int[] permutation=new int[readOriginInfo.size()];
    readOriginPermutations[readerIndex]=permutation;
    for (int i=0; i < numberOfReaders; i++) {
      final int newReadOriginIndex=nextAvailableReadOriginIndex++;
      permutation[roi.getOriginIndex()]=newReadOriginIndex;
      Alignments.ReadOriginInfo.Builder newRoi=Alignments.ReadOriginInfo.newBuilder(roi);
      newRoi.setOriginIndex(newReadOriginIndex);
      mergedReadOriginInfoList.add(newRoi.build());
    }
  }
}