From 77bc9c944802bfb834fe7661879100b56f9bdd55 Mon Sep 17 00:00:00 2001
From: tcarver <tjc>
Date: Thu, 10 Jan 2013 12:33:21 +0000
Subject: [PATCH] implement -DbamX option

---
 .../sanger/artemis/components/EntryEdit.java  | 32 ++++++++++++++++---
 1 file changed, 27 insertions(+), 5 deletions(-)

diff --git a/uk/ac/sanger/artemis/components/EntryEdit.java b/uk/ac/sanger/artemis/components/EntryEdit.java
index 8e75559fd..4a5751a31 100644
--- a/uk/ac/sanger/artemis/components/EntryEdit.java
+++ b/uk/ac/sanger/artemis/components/EntryEdit.java
@@ -491,18 +491,40 @@ public class EntryEdit extends JFrame
 
     Utilities.centreFrame(this);
     
-    if(System.getProperty("bam") != null)
+    if(System.getProperty("bam") != null || System.getProperty("bam1") != null)
     {
       SwingWorker worker = new SwingWorker()
       {
         public Object construct()
         {
           EntryEdit.this.setCursor(new Cursor(Cursor.WAIT_CURSOR));
-          final String ngs[] = System.getProperty("bam").split("[\\s,]");
-          final FileSelectionDialog fileChooser = new FileSelectionDialog(ngs);
-          final List<String> listBams = fileChooser.getFiles(".*\\.(bam|cram)$");
+          final String ngs[];
+          final int idx;
+          
+          if(System.getProperty("bam") != null)
+          {
+            idx = 1;
+            ngs = System.getProperty("bam").split("[\\s,]");
+          }
+          else
+          {
+            idx = 2;
+            ngs = System.getProperty("bam1").split("[\\s,]");
+          }
+          FileSelectionDialog fileChooser = new FileSelectionDialog(ngs);
+          List<String> listBams = fileChooser.getFiles(".*\\.(bam|cram)$");
           final List<String> vcfFiles = fileChooser.getFiles(VCFview.VCFFILE_SUFFIX);
           loadBamAndVcf(listBams, vcfFiles);
+          
+          for(int i=idx; i<20; i++)
+          {
+            if(System.getProperty("bam"+i) != null)
+            {
+              fileChooser = new FileSelectionDialog(
+                  System.getProperty("bam"+i).split("[\\s,]"));
+              bamView.openBamView(fileChooser.getFiles(".*\\.(bam|cram)$"));
+            }
+          }
 
           if(System.getProperty("bamClone") != null)
           {
@@ -518,7 +540,7 @@ public class EntryEdit extends JFrame
                            System.getProperty("bamClone"));
             
             for(int i=1;i<nclone;i++)
-              bamView.cloneBamView();
+              bamView.openBamView(listBams);
           }
           
           EntryEdit.this.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
-- 
GitLab