[Biojava-l] Order MSF alignment
Fox, Richard
Richard.Fox@maxygen.com
Wed, 23 Jan 2002 11:53:49 -0800
In order to keep the order of the sequence parsed by the MSFAlignmentFormat we're proposing the following change:
old code:
//now parse through them and create gapped symbol lists
HashMap sequenceDataMap = new HashMap();
new code:
//now parse through them and create gapped symbol lists
final ArrayList comparatorNames = new ArrayList(sequenceNames);
Comparator sequenceComparator = new Comparator () {
public int compare(Object o1, Object o2) {
int index1 = comparatorNames.indexOf(o1);
int index2 = comparatorNames.indexOf(o2);
if (index1 > index2) return 1;
else if (index1 < index2) return -1;
else return 0;
}
};
Map sequenceDataMap = new TreeMap(sequenceComparator);
Richard J. Fox, Ph.D.
Software Engineer - Bioinformatics
MAXYGEN
515 Galveston Drive
Redwood City, CA 94063
Tel. 650.980.5616
http://www.maxygen.com