package for testing the core objects and their helper classes
authorjprocter <jprocter@compbio.dundee.ac.uk>
Fri, 13 Jan 2006 15:26:52 +0000 (15:26 +0000)
committerjprocter <jprocter@compbio.dundee.ac.uk>
Fri, 13 Jan 2006 15:26:52 +0000 (15:26 +0000)
git-svn-id: https://svn.lifesci.dundee.ac.uk/svn/repository/trunk@116 be28352e-c001-0410-b1a7-c7978e42abec

src/org/vamsas/test/objects/Core.java [new file with mode: 0644]

diff --git a/src/org/vamsas/test/objects/Core.java b/src/org/vamsas/test/objects/Core.java
new file mode 100644 (file)
index 0000000..de3bd0a
--- /dev/null
@@ -0,0 +1,71 @@
+/**
+ * 
+ */
+package org.vamsas.test.objects;
+
+import org.vamsas.objects.core.Alignment;
+import org.vamsas.objects.core.AlignmentSequence;
+import org.vamsas.objects.core.DataSet;
+import org.vamsas.objects.core.Sequence;
+import org.vamsas.objects.core.VAMSAS;
+
+/**
+ * @author jim
+ * test XSD-Java binding classes in org.vamsas.objects.core
+ */
+public class Core {
+  /**
+   * 
+   * complete any automatically completable entries in the dataset
+   * @param ds
+   */
+  public static void complete(DataSet ds) {
+    Sequence[] q = ds.getSequence();
+    for (int i=0,j=q.length; i<j; i++) {
+      q[i].setStart(i+1);
+      q[i].setEnd(q[i].getSequence().length()+i+1);
+    }
+  }  
+  public static Sequence Sequence(String Name, String Sequence, String Dictionary, int start, int end) {
+    Sequence seq= new Sequence();
+     seq.setDictionary(Dictionary);
+     seq.setName(Name);
+     seq.setSequence(Sequence);
+     seq.setStart(start);
+     if (start<=end) {
+       if ((end-start)!=Sequence.length())
+         seq.setEnd(start+Sequence.length());
+     } else {
+       // reverse topology mapping. TODO: decide if allowed to do start>end on Sequence object
+       if ((start-end)!=Sequence.length())
+         seq.setEnd(end+Sequence.length());
+     }
+     return seq;
+  }
+  public static VAMSAS getDemoVamsas() {
+     VAMSAS v=new VAMSAS();
+     DataSet ds = new DataSet();
+     ds.addSequence(Sequence("Dummy1","ASDFLEQ",
+     seq.setDictionary("info:iubmb.org/aminoacids");
+     seq.setName(
+     ds.addSequence(seq);
+    seq = new Sequence();
+     seq.setDictionary("info:iubmb.org/aminoacids");
+     seq.setName("Dummy1");
+     seq.setSequence("ASDFLEQ");
+     complete(ds);
+     v.addDataSet(ds);
+     Alignment al = new Alignment();
+     
+     al.addAlignmentSequence(new AlignmentSequence());
+     return v;
+   }
+  /**
+   * @param args
+   */
+  public static void main(String[] args) {
+    // TODO Auto-generated method stub
+
+  }
+
+}