X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=forester%2Fjava%2Fsrc%2Forg%2Fforester%2Fprotein%2FBasicDomain.java;h=b7ab1d8cc26dfce4b7f66205037f329b803660d4;hb=d605114bdf420c6cb680b02bb10ea25f09db769c;hp=b1328987768593d50f4bffb584ec4b288ea29a32;hpb=10297bd8b8a4b4ab198a17a42fc6ff24ae2ed49b;p=jalview.git diff --git a/forester/java/src/org/forester/protein/BasicDomain.java b/forester/java/src/org/forester/protein/BasicDomain.java index b132898..b7ab1d8 100644 --- a/forester/java/src/org/forester/protein/BasicDomain.java +++ b/forester/java/src/org/forester/protein/BasicDomain.java @@ -43,6 +43,9 @@ public class BasicDomain implements Domain { final private double _per_domain_score; final private int _to; final private short _total_count; + final private short _hmm_len; + final private short _hmm_from; + final private short _hmm_to; public BasicDomain( final String id ) { if ( ForesterUtil.isEmpty( id ) ) { @@ -55,6 +58,10 @@ public class BasicDomain implements Domain { _total_count = -1; _per_domain_evalue = -1; _per_domain_score = -1; + _hmm_len = -1; + _hmm_from= -1; + _hmm_to= -1; + } public BasicDomain( final String id, @@ -84,6 +91,50 @@ public class BasicDomain implements Domain { _total_count = total_count; _per_domain_evalue = per_domain_evalue; _per_domain_score = per_domain_score; + _hmm_len = -1; + _hmm_from= -1; + _hmm_to= -1; + } + + public BasicDomain( final String id, + final int from, + final int to, + final short number, + final short total_count, + final double per_domain_evalue, + final double per_domain_score, + final short hmm_len, + final short hmm_from, + final short hmm_to) { + if ( ( from >= to ) || ( from < 0 ) ) { + throw new IllegalArgumentException( "attempt to create protein domain from " + from + " to " + to ); + } + if ( ForesterUtil.isEmpty( id ) ) { + throw new IllegalArgumentException( "attempt to create protein domain with null or empty id" ); + } + if ( ( number > total_count ) || ( number < 0 ) ) { + throw new IllegalArgumentException( "attempt to create protein domain number " + number + " out of " + + total_count ); + } + if ( per_domain_evalue < 0.0 ) { + throw new IllegalArgumentException( "attempt to create protein domain with negative E-value" ); + } + if ( ( hmm_from >= hmm_to ) || ( hmm_from < 0 ) ) { + throw new IllegalArgumentException( "attempt to create protein domain matching hmm from " + from + " to " + to ); + } + if ( hmm_len <= 0 ) { + throw new IllegalArgumentException( "attempt to create protein domain with zero or negative hmm length" ); + } + _id = obtainIdAsShort( id ); + _from = from; + _to = to; + _number = number; + _total_count = total_count; + _per_domain_evalue = per_domain_evalue; + _per_domain_score = per_domain_score; + _hmm_len = hmm_len; + _hmm_from= hmm_from; + _hmm_to= hmm_to; } /** @@ -166,6 +217,21 @@ public class BasicDomain implements Domain { } @Override + public final short getHmmLen() { + return _hmm_len; + } + + @Override + public final short getHmmFrom() { + return _hmm_from; + } + + @Override + public final short getHmmTo() { + return _hmm_to; + } + + @Override public int hashCode() { return getDomainId().hashCode(); } @@ -194,4 +260,6 @@ public class BasicDomain implements Domain { public final static String obtainIdFromShort( final short id ) { return ID_TO_STRING.get( id ); } + + }