import jalview.api.DBRefEntryI;
import java.util.Arrays;
+import java.util.List;
public class DBRefEntry implements DBRefEntryI
{
String source = "", version = "", accessionId = "";
+
/**
* maps from associated sequence to the database sequence's coordinate system
*/
}
-
public DBRefEntry(String source, String version, String accessionId)
{
this(source, version, accessionId, null);
String otherAccession = other.getAccessionId();
if ((accessionId == null && otherAccession != null)
|| (accessionId != null && otherAccession == null)
- || (accessionId != null && !accessionId.equalsIgnoreCase(otherAccession)))
+ || (accessionId != null && !accessionId
+ .equalsIgnoreCase(otherAccession)))
{
return false;
}
* otherwise the versions have to match
*/
String otherVersion = other.getVersion();
-
+
if ((version == null || version.equals("0") || version.endsWith(":0"))
&& otherVersion != null)
{
return accessionId;
}
-
@Override
public void setAccessionId(String accessionId)
{
this.accessionId = accessionId;
}
-
@Override
public void setSource(String source)
{
this.source = source;
}
-
@Override
public void setVersion(String version)
{
this.version = version;
}
-
@Override
public Mapping getMap()
{
public String toString()
{
return getSrcAccString();
+ }
@Override
- public boolean isPrimary()
+ public boolean isPrimaryCandidate()
{
/*
* if a map is present, unless it is 1:1 and has no SequenceI mate, it cannot be a primary reference.
{
return false;
}
+ // check map is between identical single contiguous ranges
+ List<int[]> fromRanges = map.getMap().getFromRanges();
+ List<int[]> toRanges = map.getMap().getToRanges();
+ if (fromRanges.size() != 1 || toRanges.size() != 1)
+ {
+ return false;
+ }
+ if (fromRanges.get(0)[0] != toRanges.get(0)[0]
+ || fromRanges.get(0)[1] != toRanges.get(0)[1])
+ {
+ return false;
+ }
}
if (version == null)
{
}
return true;
}
- }
}