*/
private void testTiming_presorted(final int numSeqs, final int numAnns)
{
- al = buildAlignment(numSeqs);
- anns = buildAnnotations(numAnns);
+ Alignment alignment = buildAlignment(numSeqs);
+ AlignmentAnnotation[] annotations = buildAnnotations(numAnns);
/*
* Set the annotations presorted by label
*/
Random r = new Random();
- final SequenceI[] sequences = al.getSequencesArray();
- for (int i = 0; i < anns.length; i++)
+ final SequenceI[] sequences = alignment.getSequencesArray();
+ for (int i = 0; i < annotations.length; i++)
{
SequenceI randomSequenceRef = sequences[r.nextInt(sequences.length)];
- anns[i].sequenceRef = randomSequenceRef;
- anns[i].label = "label" + i;
+ annotations[i].sequenceRef = randomSequenceRef;
+ annotations[i].label = "label" + i;
}
long startTime = System.currentTimeMillis();
- AnnotationSorter testee = new AnnotationSorter(al, false);
- testee.sort(anns, SequenceAnnotationOrder.LABEL_AND_SEQUENCE);
+ AnnotationSorter testee = new AnnotationSorter(alignment, false);
+ testee.sort(annotations, SequenceAnnotationOrder.LABEL_AND_SEQUENCE);
long endTime = System.currentTimeMillis();
final long elapsed = endTime - startTime;
System.out.println("Timing test for presorted " + numSeqs
*/
private void testTiming_unsorted(final int numSeqs, final int numAnns)
{
- al = buildAlignment(numSeqs);
- anns = buildAnnotations(numAnns);
+ Alignment alignment = buildAlignment(numSeqs);
+ AlignmentAnnotation[] annotations = buildAnnotations(numAnns);
/*
* Set the annotations in random order with respect to the sequences
*/
Random r = new Random();
- final SequenceI[] sequences = al.getSequencesArray();
- for (int i = 0; i < anns.length; i++)
+ final SequenceI[] sequences = alignment.getSequencesArray();
+ for (int i = 0; i < annotations.length; i++)
{
SequenceI randomSequenceRef = sequences[r.nextInt(sequences.length)];
- anns[i].sequenceRef = randomSequenceRef;
- anns[i].label = "label" + i;
+ annotations[i].sequenceRef = randomSequenceRef;
+ annotations[i].label = "label" + i;
}
long startTime = System.currentTimeMillis();
- AnnotationSorter testee = new AnnotationSorter(al, false);
- testee.sort(anns, SequenceAnnotationOrder.SEQUENCE_AND_LABEL);
+ AnnotationSorter testee = new AnnotationSorter(alignment, false);
+ testee.sort(annotations, SequenceAnnotationOrder.SEQUENCE_AND_LABEL);
long endTime = System.currentTimeMillis();
final long elapsed = endTime - startTime;
System.out.println("Timing test for unsorted " + numSeqs
*/
private void testTiming_semiSorted(final int numSeqs, final int numAnns)
{
- al = buildAlignment(numSeqs);
- anns = buildAnnotations(numAnns);
+ Alignment alignment = buildAlignment(numSeqs);
+ AlignmentAnnotation[] annotations = buildAnnotations(numAnns);
String[] labels = new String[]
{ "label1", "label2", "label3", "label4", "label5", "label6" };
* Set the annotations in sequence order with randomly assigned labels.
*/
Random r = new Random();
- final SequenceI[] sequences = al.getSequencesArray();
- for (int i = 0; i < anns.length; i++)
+ final SequenceI[] sequences = alignment.getSequencesArray();
+ for (int i = 0; i < annotations.length; i++)
{
SequenceI sequenceRef = sequences[i % sequences.length];
- anns[i].sequenceRef = sequenceRef;
- anns[i].label = labels[r.nextInt(labels.length)];
+ annotations[i].sequenceRef = sequenceRef;
+ annotations[i].label = labels[r.nextInt(labels.length)];
}
long startTime = System.currentTimeMillis();
- AnnotationSorter testee = new AnnotationSorter(al, false);
- testee.sort(anns, SequenceAnnotationOrder.LABEL_AND_SEQUENCE);
+ AnnotationSorter testee = new AnnotationSorter(alignment, false);
+ testee.sort(annotations, SequenceAnnotationOrder.LABEL_AND_SEQUENCE);
long endTime = System.currentTimeMillis();
long elapsed = endTime - startTime;
System.out.println("Sort by label for semisorted " + numSeqs
// now resort by sequence
startTime = System.currentTimeMillis();
- testee.sort(anns, SequenceAnnotationOrder.SEQUENCE_AND_LABEL);
+ testee.sort(annotations, SequenceAnnotationOrder.SEQUENCE_AND_LABEL);
endTime = System.currentTimeMillis();
elapsed = endTime - startTime;
System.out.println("Resort by sequence for semisorted " + numSeqs
// now resort by label
startTime = System.currentTimeMillis();
- testee.sort(anns, SequenceAnnotationOrder.LABEL_AND_SEQUENCE);
+ testee.sort(annotations, SequenceAnnotationOrder.LABEL_AND_SEQUENCE);
endTime = System.currentTimeMillis();
elapsed = endTime - startTime;
System.out.println("Resort by label for semisorted " + numSeqs