int e2 = s2 + length;
String startStr = NumberFormat.getInstance().format(s2);
String endStr = NumberFormat.getInstance().format(e2);
String mateLocus = mateChr + ":" + startStr + "-" + endStr;
Session currentSession = IGV.getInstance().getSession();
List<String> loci = null;
if (FrameManager.isGeneListMode()) {
loci = new ArrayList<String>(FrameManager.getFrames().size());
for (ReferenceFrame ref : FrameManager.getFrames()) {
//If the frame-name is a locus, we use it unaltered
//Don't want to reprocess, easy to get off-by-one
String name = ref.getName();
if (Locus.fromString(name) != null) {
loci.add(name);
} else {
loci.add(ref.getFormattedLocusString());
}
}
loci.add(mateLocus);
} else {
loci = Arrays.asList(locus1, mateLocus);
}
StringBuffer listName = new StringBuffer();
for (String s : loci) {
listName.append(s + " ");
}
GeneList geneList = new GeneList(listName.toString(), loci, false);
currentSession.setCurrentGeneList(geneList);
Comparator<String> geneListComparator = new Comparator<String>() {
@Override
public int compare(String n0, String n1) {
ReferenceFrame f0 = FrameManager.getFrame(n0);
ReferenceFrame f1 = FrameManager.getFrame(n1);
int chrComp = ChromosomeNameComparator.get().compare(f0.getChrName(), f1.getChrName());
if (chrComp != 0) return chrComp;
return f0.getCurrentRange().getStart() - f1.getCurrentRange().getStart();
}
};
//Need to sort the frames by position
currentSession.sortGeneList(geneListComparator);
IGV.getInstance().resetFrames();
} else {
MessageUtils.showMessage("Alignment does not have mate, or it is not mapped.");
}
}