Skip to content
Snippets Groups Projects
Commit 047030f6 authored by tjc's avatar tjc
Browse files

add FeatureLoc comparator

git-svn-id: svn+ssh://svn.internal.sanger.ac.uk/repos/svn/pathsoft/artemis/trunk@6341 ee4ac58c-ac51-4696-9907-e4b3aa274f04
parent 63f3d077
No related branches found
No related tags found
No related merge requests found
......@@ -61,6 +61,8 @@ import java.sql.*;
import java.text.SimpleDateFormat;
import java.io.*;
import java.net.ConnectException;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashSet;
import java.util.Hashtable;
import java.util.HashMap;
......@@ -1854,6 +1856,7 @@ public class DatabaseDocument extends Document
}
}
Collections.sort(cdsFeatureLocs, new LocationComarator());
return cdsFeatureLocs;
}
......@@ -2641,4 +2644,37 @@ public class DatabaseDocument extends Document
{
return singleSchema;
}
/**
* Ensure exon featurelocs are in the correct order
*/
class LocationComarator implements Comparator
{
public int compare(Object o1, Object o2)
{
int loc1 = ((FeatureLoc)o1).getFmin().intValue();
int loc2 = ((FeatureLoc)o2).getFmin().intValue();
if(loc2 == loc1)
return 0;
int strand = ((FeatureLoc)o1).getStrand().intValue();
if(strand < 0)
{
if(loc2 > loc1)
return 1;
else
return -1;
}
else
{
if(loc2 > loc1)
return -1;
else
return 1;
}
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment