X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fschemes%2FResidueProperties.java;h=98868d23a38fdd13c4a82c407ed5efeff4345414;hb=cd5b2de469fb4c09242955cb4b74279e2da348d6;hp=e55ce18b3bbd6a14dcdcd364fb27251e2c820470;hpb=95ab75b20edeba686d7ec4aefedd8b9cd93186ad;p=jalview.git diff --git a/src/jalview/schemes/ResidueProperties.java b/src/jalview/schemes/ResidueProperties.java index e55ce18..98868d2 100755 --- a/src/jalview/schemes/ResidueProperties.java +++ b/src/jalview/schemes/ResidueProperties.java @@ -1290,4 +1290,53 @@ public class ResidueProperties } return ss.toString(); } + // main method generates perl representation of residue property hash + /// cut here + public static void main(String[] args) + { + Hashtable aa = new Hashtable(); + System.out.println("my %aa = {"); + // invert property hashes + Enumeration prop = propHash.keys(); + while (prop.hasMoreElements()) + { + String pname = (String) prop.nextElement(); + Hashtable phash = (Hashtable) propHash.get(pname); + Enumeration res = phash.keys(); + while (res.hasMoreElements()) + { + String rname = (String) res.nextElement(); + Vector aprops = (Vector) aa.get(rname); + if (aprops==null) + { + aprops = new Vector(); + aa.put(rname, aprops); + } + Integer hasprop = (Integer) phash.get(rname); + if (hasprop.intValue()==1) + { + aprops.addElement(pname); + } + } + } + Enumeration res = aa.keys(); + while (res.hasMoreElements()) + { + String rname = (String) res.nextElement(); + + System.out.print("'"+rname+"' => ["); + Enumeration props = ((Vector) aa.get(rname)).elements(); + while (props.hasMoreElements()) + { + System.out.print("'"+(String)props.nextElement()+"'"); + if (props.hasMoreElements()) + { + System.out.println(", "); + } + } + System.out.println("]"+(res.hasMoreElements() ? "," : "")); + } + System.out.println("};"); + } + // to here }