groovy scripting examples (JAL-???)
[jalview.git] / examples / groovy / iterateOverAlignments.groovy
diff --git a/examples/groovy/iterateOverAlignments.groovy b/examples/groovy/iterateOverAlignments.groovy
new file mode 100644 (file)
index 0000000..83c4169
--- /dev/null
@@ -0,0 +1,20 @@
+import jalview.analysis.*;
+import jalview.datamodel.*;
+import jalview.gui.AlignFrame;
+import jalview.gui.AlignViewport;
+
+def af = Jalview.getAlignframes();
+
+for (ala in af)
+{
+       def al = ala.viewport.alignment;
+       if (al!=null && al.getCodonFrames()!=null)
+       {
+               al.getCodonFrames().each { 
+                       it.getdnaToProt().each {
+                               it2 -> println it2.fromShifts+"\n"
+                       }
+               }
+       }
+}
+