[med-svn] [artemis] 05/06: refresh patches

Sascha Steinbiss satta at debian.org
Wed Dec 7 23:46:19 UTC 2016


This is an automated email from the git hooks/post-receive script.

satta pushed a commit to branch 6_0_17_fix
in repository artemis.

commit a1a0b2c9537e9fa3d9fa9374cae364fe74a03de3
Author: Sascha Steinbiss <satta at debian.org>
Date:   Wed Dec 7 23:37:52 2016 +0000

    refresh patches
---
 debian/patches/class-path.patch        |   14 +-
 debian/patches/jar-rules.patch         |   20 +-
 debian/patches/picard-api-change.patch |   27 +-
 debian/patches/samreader.patch         | 3595 ++++++++++++++++++++++++++++++++
 debian/patches/series                  |    3 +-
 debian/patches/test-classpath.patch    |    4 +-
 6 files changed, 3623 insertions(+), 40 deletions(-)

diff --git a/debian/patches/class-path.patch b/debian/patches/class-path.patch
index cfcd25d..97c53d3 100644
--- a/debian/patches/class-path.patch
+++ b/debian/patches/class-path.patch
@@ -6,16 +6,16 @@ Description: Look for jars in /usr/share/java rather than ./lib
 Author: Afif Elghraoui <afif at ghraoui.name>
 Forwarded: not-needed
 Last-Update: 2015-09-23
---- artemis.orig/Makefile
-+++ artemis/Makefile
-@@ -8,7 +8,9 @@
+--- a/Makefile
++++ b/Makefile
+@@ -6,7 +6,9 @@
  
  JAVAC := javac -source 1.5 -target 1.5 $(OPT_FLAGS) $(EXTRA_FLAGS)
  
--REAL_CLASSPATH := CLASSPATH=lib/biojava.jar:lib/jemAlign.jar:lib/j2ssh/j2ssh-core.jar:lib/ibatis/ibatis-2.3.4.726.jar:lib/ibatis/log4j-1.2.14.jar:lib/postgresql-8.4-701.jdbc3.jar:lib/picard/picard.jar:lib/picard/sam.jar:lib/commons-net-2.2.jar:lib/batik/batik-awt-util.jar:lib/batik/batik-dom.jar:lib/batik/batik-ext.jar:lib/batik/batik-svggen.jar:lib/batik/batik-util.jar:lib/batik/batik-xml.jar:.
+-REAL_CLASSPATH := CLASSPATH=lib/commons-lang-2.6.jar:lib/biojava.jar:lib/jemAlign.jar:lib/j2ssh/j2ssh-core.jar:lib/ibatis/ibatis-2.3.4.726.jar:lib/ibatis/log4j-1.2.14.jar:lib/postgresql-8.4-701.jdbc3.jar:lib/picard/picard.jar:lib/picard/sam.jar:lib/commons-net-2.2.jar:lib/batik/batik-awt-util.jar:lib/batik/batik-dom.jar:lib/batik/batik-ext.jar:lib/batik/batik-svggen.jar:lib/batik/batik-util.jar:lib/batik/batik-xml.jar:.
++#REAL_CLASSPATH := CLASSPATH=lib/commons-lang-2.6.jar:lib/biojava.jar:lib/jemAlign.jar:lib/j2ssh/j2ssh-core.jar:lib/ibatis/ibatis-2.3.4.726.jar:lib/ibatis/log4j-1.2.14.jar:lib/postgresql-8.4-701.jdbc3.jar:lib/picard/picard.jar:lib/picard/sam.jar:lib/commons-net-2.2.jar:lib/batik/batik-awt-util.jar:lib/batik/batik-dom.jar:lib/batik/batik-ext.jar:lib/batik/batik-svggen.jar:lib/batik/batik-util.jar:lib/batik/batik-xml.jar:.
 +CLASSPATH ?= lib/biojava.jar:lib/jemAlign.jar:lib/j2ssh/j2ssh-core.jar:lib/ibatis/ibatis-2.3.4.726.jar:lib/ibatis/log4j-1.2.14.jar:lib/postgresql-8.4-701.jdbc3.jar:lib/picard/picard.jar:lib/picard/sam.jar:lib/commons-net-2.2.jar:lib/batik/batik-awt-util.jar:lib/batik/batik-dom.jar:lib/batik/batik-ext.jar:lib/batik/batik-svggen.jar:lib/batik/batik-util.jar:lib/batik/batik-xml.jar:.
-+
 +REAL_CLASSPATH := CLASSPATH=$(CLASSPATH)
  
- # NAMES:= \
- # 	uk/ac/sanger/artemis/OptionChangeListener \
+ ARTEMIS_DIRS = uk/ac/sanger/artemis \
+ uk/ac/sanger/artemis/chado \
diff --git a/debian/patches/jar-rules.patch b/debian/patches/jar-rules.patch
index 4750841..ce4a1ea 100644
--- a/debian/patches/jar-rules.patch
+++ b/debian/patches/jar-rules.patch
@@ -6,9 +6,9 @@ Description: Leave out removed files when building jar files
 Author: Afif Elghraoui <afif at ghraoui.name>
 Forwarded: not-needed
 Last-Update: 2015-10-22
---- artemis.orig/Makefile
-+++ artemis/Makefile
-@@ -290,29 +290,7 @@
+--- a/Makefile
++++ b/Makefile
+@@ -91,29 +91,7 @@
  	mkdir jar_build
  	rm -f artemis.jar
  	cd jar_build; \
@@ -35,28 +35,28 @@ Last-Update: 2015-10-22
 -          done; \
 -        fi; \
 -	cp -R ../lib/LICENSE.Apache ../uk ../org ../nsdb ../type ../seqdb ../etc ../images ../lib/j2ssh/j2ssh.properties \
-+	cp -R ../uk ../org ../nsdb ../type ../seqdb ../etc ../images \
- 	      ../images/PSUlogo.gif ../images/icon.gif ../README ../artemis_sqlmap .
++	cp -R ../uk ../org ../nsdb ../type ../seqdb ../etc ../images  \
+ 	      ../images/PSUlogo.gif ../images/icon.gif ../README.md ../artemis_sqlmap .
  	find jar_build -name '*.java' -print | xargs rm -f
  	find jar_build -name '.svn' -print | xargs rm -rf
-@@ -320,18 +298,18 @@
+@@ -121,18 +99,18 @@
  	rm -rf META-INF/MANIFEST.MF; \
  	echo "Main-Class: uk.ac.sanger.artemis.components.ArtemisMain\nPermissions: all-permissions" > manifest-art; \
- 	jar cmf manifest-art artemis.jar META-INF/services images/PSUlogo.gif images/icon.gif README etc \
+ 	jar cmf manifest-art artemis.jar META-INF/services images/PSUlogo.gif images/icon.gif README.md etc \
 -	                     artemis_sqlmap org uk com net nsdb type seqdb LICENSE.Apache j2ssh.properties; \
 +	                     artemis_sqlmap org uk com net nsdb type seqdb; \
          echo "Main-Class: uk.ac.sanger.artemis.circular.DNADraw\nPermissions: all-permissions" > manifest-circular; \
-         jar cmf manifest-circular DNAPlotter.jar images/PSUlogo.gif README etc \
+         jar cmf manifest-circular DNAPlotter.jar images/PSUlogo.gif README.md etc \
 -                             uk org/gmod org/w3c org/apache org/biojava/bio/ com/ibatis/common/jdbc/ net/sf/samtools/ LICENSE.Apache j2ssh.properties; \
 +                             uk org/gmod org/w3c org/apache org/biojava/bio/ com/ibatis/common/jdbc/ net/sf/samtools/; \
  	echo "Main-Class: uk.ac.sanger.artemis.components.alignment.BamView\nPermissions: all-permissions" > manifest-bamview; \
  	jar cmf manifest-bamview BamView.jar META-INF/services etc uk org/apache org/biojava org/biojavax org/gmod org/w3c net/sf com/ibatis; \
  	echo "Main-Class: uk.ac.sanger.artemis.components.ActMain\nPermissions: all-permissions" > manifest-act; \
- 	jar cmf manifest-act act.jar META-INF/services images/PSUlogo.gif images/icon.gif README etc \
+ 	jar cmf manifest-act act.jar META-INF/services images/PSUlogo.gif images/icon.gif README.md etc \
 -	                     artemis_sqlmap org uk com net nsdb type seqdb LICENSE.Apache j2ssh.properties; \
 +	                     artemis_sqlmap org uk com net nsdb type seqdb; \
  	rm -f etc/log4j.properties; \
- 	jar cmf manifest-art artemis_mac.jar images/PSUlogo.gif images/icon.gif README \
+ 	jar cmf manifest-art artemis_mac.jar images/PSUlogo.gif images/icon.gif README.md \
 -	        uk org/gmod nsdb type seqdb LICENSE.Apache artemis_sqlmap
 +	        uk org/gmod nsdb type seqdb artemis_sqlmap
  
diff --git a/debian/patches/picard-api-change.patch b/debian/patches/picard-api-change.patch
index 261033a..869b6bd 100644
--- a/debian/patches/picard-api-change.patch
+++ b/debian/patches/picard-api-change.patch
@@ -112,9 +112,9 @@ Last-Update: 2015-12-24
          }
 --- a/uk/ac/sanger/artemis/components/alignment/BamUtils.java
 +++ b/uk/ac/sanger/artemis/components/alignment/BamUtils.java
-@@ -28,10 +28,10 @@
- import java.util.List;
- import java.util.Vector;
+@@ -30,10 +30,10 @@
+ 
+ import javax.swing.JProgressBar;
  
 -import net.sf.samtools.AlignmentBlock;
 -import net.sf.samtools.SAMFileReader;
@@ -126,7 +126,7 @@ Last-Update: 2015-12-24
 +import htsjdk.samtools.util.CloseableIterator;
  import uk.ac.sanger.artemis.Feature;
  import uk.ac.sanger.artemis.FeatureSegmentVector;
- import uk.ac.sanger.artemis.io.Range;
+ import uk.ac.sanger.artemis.FeatureVector;
 --- a/uk/ac/sanger/artemis/components/alignment/BamViewRecord.java
 +++ b/uk/ac/sanger/artemis/components/alignment/BamViewRecord.java
 @@ -1,6 +1,6 @@
@@ -139,7 +139,7 @@ Last-Update: 2015-12-24
  class BamViewRecord
 --- a/uk/ac/sanger/artemis/components/alignment/CoveragePanel.java
 +++ b/uk/ac/sanger/artemis/components/alignment/CoveragePanel.java
-@@ -51,8 +51,8 @@
+@@ -52,8 +52,8 @@
  
  import uk.ac.sanger.artemis.components.Plot;
  
@@ -150,17 +150,6 @@ Last-Update: 2015-12-24
  
    public class CoveragePanel extends AbstractGraphPanel
    {
---- a/uk/ac/sanger/artemis/components/alignment/MappedReads.java
-+++ b/uk/ac/sanger/artemis/components/alignment/MappedReads.java
-@@ -37,7 +37,7 @@
- import uk.ac.sanger.artemis.util.OutOfRangeException;
- import uk.ac.sanger.artemis.util.ReadOnlyException;
- 
--import net.sf.samtools.SAMFileReader;
-+import htsjdk.samtools.SAMFileReader;
- 
- public class MappedReads
- {
 --- a/uk/ac/sanger/artemis/components/alignment/PairedReadComparator.java
 +++ b/uk/ac/sanger/artemis/components/alignment/PairedReadComparator.java
 @@ -26,7 +26,7 @@
@@ -321,7 +310,7 @@ Last-Update: 2015-12-24
  
 --- a/uk/ac/sanger/artemis/io/DocumentEntryFactory.java
 +++ b/uk/ac/sanger/artemis/io/DocumentEntryFactory.java
-@@ -76,7 +76,7 @@
+@@ -78,7 +78,7 @@
        throws IOException, EntryInformationException 
    {
      if(!System.getProperty("java.version").startsWith("1.5.") &&
@@ -329,7 +318,7 @@ Last-Update: 2015-12-24
 +        document.getInputStream() instanceof htsjdk.samtools.util.BlockCompressedInputStream)
      {
        if(IndexedGFFDocumentEntry.isIndexed( ((File)document.getLocation()) ))
-         return new IndexedGFFDocumentEntry(document);
+       {
 --- a/uk/ac/sanger/artemis/io/IndexedGFFDocumentEntry.java
 +++ b/uk/ac/sanger/artemis/io/IndexedGFFDocumentEntry.java
 @@ -38,7 +38,7 @@
@@ -343,7 +332,7 @@ Last-Update: 2015-12-24
  import uk.ac.sanger.artemis.components.FeatureDisplay;
 --- a/uk/ac/sanger/artemis/plot/UserDataAlgorithm.java
 +++ b/uk/ac/sanger/artemis/plot/UserDataAlgorithm.java
-@@ -45,7 +45,7 @@
+@@ -46,7 +46,7 @@
  import javax.swing.JOptionPane;
  import javax.swing.JPanel;
  
diff --git a/debian/patches/samreader.patch b/debian/patches/samreader.patch
new file mode 100644
index 0000000..d81535c
--- /dev/null
+++ b/debian/patches/samreader.patch
@@ -0,0 +1,3595 @@
+--- a/uk/ac/sanger/artemis/components/alignment/BamUtils.java
++++ b/uk/ac/sanger/artemis/components/alignment/BamUtils.java
+@@ -31,7 +31,7 @@
+ import javax.swing.JProgressBar;
+ 
+ import htsjdk.samtools.AlignmentBlock;
+-import htsjdk.samtools.SAMFileReader;
++import htsjdk.samtools.SamReader;
+ import htsjdk.samtools.SAMRecord;
+ import htsjdk.samtools.util.CloseableIterator;
+ import uk.ac.sanger.artemis.Feature;
+@@ -53,14 +53,14 @@
+     }
+     return (float)len;
+   }
+-  
++
+   /**
+    * Count the reads in a range.
+    * @param start
+    * @param end
+    * @param bam
+    * @param refName
+-   * @param samFileReaderHash
++   * @param samFReaderHash
+    * @param seqNames
+    * @param offsetLengths
+    * @param concatSequences
+@@ -100,7 +100,7 @@
+             (start >= lastLen && start < len) ||
+             (end > lastLen && end < len) )
+         {
+-          int offset = offsetLengths.get(name); 
++          int offset = offsetLengths.get(name);
+           int thisStart = start - offset;
+           if(thisStart < 1)
+             thisStart = 1;
+@@ -118,7 +118,7 @@
+     {
+       cnt = count(bamView, bam, start, end, contained, true, useStrandTag);
+     }
+-    
++
+     float cntf[] = new float[2];
+     cntf[0] = cnt[0];
+     cntf[1] = cnt[1];
+@@ -127,7 +127,7 @@
+ 
+   protected static int[] count(
+           final BamView bamView,
+-          final String bam, 
++          final String bam,
+           final int start,
+           final int end,
+           final boolean contained,
+@@ -135,15 +135,15 @@
+           final boolean useStrandTag)
+   {
+     final String refName = (String) bamView.getCombo().getSelectedItem();
+-    final Hashtable<String, SAMFileReader> samFileReaderHash = bamView.getSamFileReaderHash();
++    final Hashtable<String, SamReader> samReaderHash = bamView.getSamReaderHash();
+     final SAMRecordPredicate samRecordFlagPredicate = bamView.getSamRecordFlagPredicate();
+     final SAMRecordPredicate samRecordMapQPredicate = bamView.getSamRecordMapQPredicate();
+ 
+     int cnt[] = new int[2];
+     cnt[0] = 0;
+     cnt[1] = 0;
+-    
+-    SAMFileReader inputSam = samFileReaderHash.get(bam);
++
++    SamReader inputSam = samReaderHash.get(bam);
+     final CloseableIterator<SAMRecord> it = inputSam.query(refName, start, end, contained);
+ 
+     while ( it.hasNext() )
+@@ -165,10 +165,10 @@
+     it.close();
+     return cnt;
+   }
+-  
+-  protected static int[] calc(
+-      final BamView bamView, 
+-      final String refName, 
++
++   static int[] calc(
++      final BamView bamView,
++      final String refName,
+       final int sequenceLength,
+       final boolean useStrandTag,
+       final JProgressBar progressBar)
+@@ -208,7 +208,7 @@
+               if (thisEnd > thisLength)
+                 thisEnd = thisLength;
+ 
+-              mappedReads[j] += BamUtils.count(bamView, bam, thisStart, thisEnd, 
++              mappedReads[j] += BamUtils.count(bamView, bam, thisStart, thisEnd,
+                   contained, false, useStrandTag)[0];
+             }
+             lastLen = len;
+@@ -235,21 +235,21 @@
+    * @param cnt
+    * @return
+    */
+-  protected static int[][] countOverRange(
++   static int[][] countOverRange(
+       final BamView bamView,
+-      final String bamFile, 
+-      final int start, 
+-      final int end, 
+-      final int concatShift, 
++      final String bamFile,
++      final int start,
++      final int end,
++      final int concatShift,
+       final int cnt[][])
+   {
+     final String refName = (String) bamView.getCombo().getSelectedItem();
+-    final Hashtable<String, SAMFileReader> samFileReaderHash = bamView.getSamFileReaderHash();
++    final Hashtable<String, SamReader> samReaderHash = bamView.getSamReaderHash();
+     final SAMRecordPredicate samRecordFlagPredicate = bamView.getSamRecordFlagPredicate();
+     final SAMRecordPredicate samRecordMapQPredicate = bamView.getSamRecordMapQPredicate();
+ 
+-    SAMFileReader inputSam = samFileReaderHash.get(bamFile);
+-    final CloseableIterator<SAMRecord> it = 
++    SamReader inputSam = samReaderHash.get(bamFile);
++    final CloseableIterator<SAMRecord> it =
+         inputSam.query(refName, start, end, false);
+ 
+     while (it.hasNext())
+@@ -263,7 +263,7 @@
+         {
+           List<AlignmentBlock> blocks = samRecord.getAlignmentBlocks();
+           boolean isFwd = !samRecord.getReadNegativeStrandFlag();
+-          
++
+           for(int j=0; j<blocks.size(); j++)
+           {
+             AlignmentBlock block = blocks.get(j);
+@@ -274,12 +274,12 @@
+               int bin = pos - start;
+               if(bin < 0 || bin > cnt.length-1)
+                 continue;
+-              
++
+               if(isFwd)
+                 cnt[bin][0]++;
+               else
+                 cnt[bin][1]++;
+-            } 
++            }
+           }
+         }
+       }
+@@ -302,13 +302,13 @@
+   protected static Hashtable<String, List<ReadCount>> calculateMappedReads(
+       final BamView bamView,
+       final FeatureVector features,
+-      final boolean contained, 
++      final boolean contained,
+       final boolean useIntrons,
+       final boolean useStrandTag,
+       final int mappedReads[],
+       final JProgressBar progressBar)
+   {
+-    final Hashtable<String, List<ReadCount>> featureReadCount = 
++    final Hashtable<String, List<ReadCount>> featureReadCount =
+         new Hashtable<String, List<ReadCount>>();
+     for (int i = 0; i < features.size(); i++)
+     {
+@@ -349,7 +349,7 @@
+             cnt[1] -= tmpcnt[1];
+           }
+         }
+-        
++
+         if (mappedReads != null)
+         {
+           cnt[0] = (cnt[0] / (((float) mappedReads[j] / 1000000.f) * (fLen / 1000.f)));
+--- a/uk/ac/sanger/artemis/components/alignment/BamView.java
++++ b/uk/ac/sanger/artemis/components/alignment/BamView.java
+@@ -112,11 +112,15 @@
+ import htsjdk.samtools.AlignmentBlock;
+ import htsjdk.samtools.SAMException;
+ import htsjdk.samtools.SAMFileHeader;
+-import htsjdk.samtools.SAMFileReader;
++import htsjdk.samtools.SamReader;
++import htsjdk.samtools.SamReaderFactory;
++import htsjdk.samtools.SamInputResource;
+ import htsjdk.samtools.SAMReadGroupRecord;
+ import htsjdk.samtools.SAMRecord;
+ import htsjdk.samtools.SAMSequenceRecord;
+ import htsjdk.samtools.ValidationStringency;
++import htsjdk.samtools.seekablestream.SeekableStream;
++import htsjdk.samtools.seekablestream.SeekableFTPStream;
+ import htsjdk.samtools.util.CloseableIterator;
+ 
+ import uk.ac.sanger.artemis.Entry;
+@@ -147,7 +151,6 @@
+ import uk.ac.sanger.artemis.sequence.NoSequenceException;
+ import uk.ac.sanger.artemis.util.Document;
+ import uk.ac.sanger.artemis.util.DocumentFactory;
+-import uk.ac.sanger.artemis.util.FTPSeekableStream;
+ import uk.ac.sanger.artemis.util.OutOfRangeException;
+ 
+ public class BamView extends JPanel
+@@ -156,7 +159,7 @@
+   private static final long serialVersionUID = 1L;
+ 
+   private List<BamViewRecord> readsInView;
+-  private Hashtable<String, SAMFileReader> samFileReaderHash = new Hashtable<String, SAMFileReader>();
++  private Hashtable<String, SamReader> samReaderHash = new Hashtable<String, SamReader>();
+   private List<SAMReadGroupRecord> readGroups = new Vector<SAMReadGroupRecord>();
+ 
+   private HashMap<String, Integer> seqLengths = new HashMap<String, Integer>();
+@@ -173,15 +176,15 @@
+   private Bases bases;
+   private JScrollPane jspView;
+   private JScrollBar scrollBar;
+-  
++
+   private SequenceComboBox combo;
+   private boolean isOrientation = false;
+   private boolean isSingle = false;
+   private boolean isSNPs = false;
+-  
++
+   private boolean isCoverage = false;
+   private boolean isSNPplot = false;
+-  
++
+   private EntryEdit entry_edit;
+   private FeatureDisplay feature_display;
+   private Selection selection;
+@@ -192,7 +195,7 @@
+   private boolean logScale = false;
+   private Ruler ruler;
+   private int nbasesInView;
+-  
++
+   private int startBase = -1;
+   private int endBase   = -1;
+   private int laststart;
+@@ -200,10 +203,10 @@
+ 
+   private boolean asynchronous = true;
+   private boolean showBaseAlignment = false;
+-  
++
+   private JMenu bamFilesMenu = new JMenu("BAM files");
+   private JCheckBoxMenuItem logMenuItem = new JCheckBoxMenuItem("Use Log Scale", logScale);
+-  
++
+   private JCheckBoxMenuItem cbStackView = new JCheckBoxMenuItem("Stack", true);
+   private JCheckBoxMenuItem cbPairedStackView = new JCheckBoxMenuItem("Paired Stack");
+   private JCheckBoxMenuItem cbStrandStackView = new JCheckBoxMenuItem("Strand Stack");
+@@ -212,38 +215,38 @@
+   private JCheckBoxMenuItem cbCoverageStrandView = new JCheckBoxMenuItem("Coverage by Strand", false);
+   private JCheckBoxMenuItem cbCoverageHeatMap = new JCheckBoxMenuItem("Coverage Heat Map", false);
+   private JCheckBoxMenuItem cbLastSelected;
+-  
++
+   private ButtonGroup buttonGroup = new ButtonGroup();
+-  
++
+   private JCheckBoxMenuItem colourByReadGrp = new JCheckBoxMenuItem("Read Group");
+   private JCheckBoxMenuItem colourByStrandTag = new JCheckBoxMenuItem("RNASeq Strand Specific Tag (XS)");
+   private JCheckBoxMenuItem colourByCoverageColour = new JCheckBoxMenuItem("Coverage Plot Colours");
+   private JCheckBoxMenuItem baseQualityColour = new JCheckBoxMenuItem("Base Quality");
+   private JCheckBoxMenuItem markInsertions = new JCheckBoxMenuItem("Mark Insertions", true);
+-  private AlphaComposite translucent = 
++  private AlphaComposite translucent =
+     AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.6f);
+-  
++
+   private ReadGroupsFrame readGrpFrame;
+   private GroupBamFrame groupsFrame = new GroupBamFrame(this, bamFilesMenu);
+   private CoveragePanel coverageView = new CoveragePanel();
+-  
++
+   protected static String BAM_SUFFIX = ".*\\.(bam|cram)$";
+   /** Used to colour the frames. */
+   private static Color LIGHT_GREY = new Color(200, 200, 200);
+   private static Color DARK_GREEN = new Color(0, 150, 0);
+   private static Color DARK_ORANGE = new Color(255,140,0);
+   private static Color DEEP_PINK   = new Color(139,10,80);
+-  
++
+   private Point lastMousePoint = null;
+   private BamViewRecord mouseOverSAMRecord = null;
+   private BamViewRecord highlightSAMRecord = null;
+   private String mouseOverInsertion;
+   // record of where a mouse drag starts
+   protected int dragStart = -1;
+-  
++
+   private static int MAX_BASES = 26000;
+   private int maxHeight = 800;
+-  
++
+   private boolean concatSequences = false;
+   private int ALIGNMENT_PIX_PER_BASE;
+   private int BASE_HEIGHT;
+@@ -253,13 +256,13 @@
+   private PopupMessageFrame waitingFrame = new PopupMessageFrame("waiting...");
+   private ExecutorService bamReadTaskExecutor;
+   private int MAX_COVERAGE = Integer.MAX_VALUE;
+-  
++
+   private float readLnHgt = 2.0f;
+-  
+-  public static org.apache.log4j.Logger logger4j = 
++
++  public static org.apache.log4j.Logger logger4j =
+     org.apache.log4j.Logger.getLogger(BamView.class);
+-  
+-  public BamView(List<String> bamList, 
++
++  public BamView(List<String> bamList,
+                 String reference,
+                 int nbasesInView,
+                 final EntryEdit entry_edit,
+@@ -271,8 +274,8 @@
+     this(bamList, reference, nbasesInView, feature_display, bases, containerPanel, frame);
+     this.entry_edit = entry_edit;
+   }
+-  
+-  public BamView(List<String> bamList, 
++
++  public BamView(List<String> bamList,
+                  String reference,
+                  int nbasesInView,
+                  final FeatureDisplay feature_display,
+@@ -293,7 +296,7 @@
+     // filter out unmapped reads by default
+     setSamRecordFlagPredicate(
+         new SAMRecordFlagPredicate(SAMRecordFlagPredicate.READ_UNMAPPED_FLAG));
+-    
++
+     if(reference != null)
+     {
+       System.setProperty("reference", reference); // for CRAM
+@@ -307,22 +310,22 @@
+         e.printStackTrace();
+       }
+     }
+-    
++
+     if(Options.getOptions().getIntegerProperty("bam_read_thread") != null)
+-    { 
++    {
+       logger4j.debug("BAM READ THREADS="+Options.getOptions().getIntegerProperty("bam_read_thread"));
+       bamReadTaskExecutor = Executors.newFixedThreadPool(
+           Options.getOptions().getIntegerProperty("bam_read_thread"));
+     }
+     else
+       bamReadTaskExecutor = Executors.newFixedThreadPool(1);
+-    
+-    
++
++
+     if(Options.getOptions().getIntegerProperty("bam_max_coverage") != null)
+-    { 
++    {
+       logger4j.debug("BAM MAX COVERAGE="+Options.getOptions().getIntegerProperty("bam_max_coverage"));
+       MAX_COVERAGE = Options.getOptions().getIntegerProperty("bam_max_coverage");
+-    }  
++    }
+ 
+     try
+     {
+@@ -330,8 +333,8 @@
+     }
+     catch(java.lang.UnsupportedClassVersionError err)
+     {
+-      JOptionPane.showMessageDialog(null, 
+-          "This requires Java 1.6 or higher.", 
++      JOptionPane.showMessageDialog(null,
++          "This requires Java 1.6 or higher.",
+           "Check Java Version", JOptionPane.WARNING_MESSAGE);
+     }
+     catch (IOException e)
+@@ -341,13 +344,13 @@
+ 
+     final javax.swing.plaf.FontUIResource font_ui_resource =
+       Options.getOptions().getFontUIResource();
+-    
++
+     Enumeration<Object> keys = UIManager.getDefaults().keys();
+-    while(keys.hasMoreElements()) 
++    while(keys.hasMoreElements())
+     {
+       Object key = keys.nextElement();
+       Object value = UIManager.get(key);
+-      if(value instanceof javax.swing.plaf.FontUIResource) 
++      if(value instanceof javax.swing.plaf.FontUIResource)
+         UIManager.put(key, font_ui_resource);
+     }
+ 
+@@ -356,10 +359,10 @@
+     ALIGNMENT_PIX_PER_BASE = fm.charWidth('M');
+     BASE_HEIGHT = fm.getMaxAscent();
+     selection = new Selection(null);
+-    
++
+     MultiLineToolTipUI.initialize();
+     setToolTipText("");
+-    
++
+     buttonGroup.add(cbStackView);
+     buttonGroup.add(cbPairedStackView);
+     buttonGroup.add(cbStrandStackView);
+@@ -369,10 +372,10 @@
+     buttonGroup.add(cbCoverageHeatMap);
+     addMouseListener(new PopupListener());
+ 
+-    jspView = new JScrollPane(this, 
++    jspView = new JScrollPane(this,
+         JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
+         JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
+-    
++
+     jspView.setViewportBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, Color.DARK_GRAY));
+     Border empty = new EmptyBorder(0,0,0,0);
+     jspView.setBorder(empty);
+@@ -394,27 +397,27 @@
+       coveragePanel.setVisible(isCoverage);
+     }
+   }
+-  
++
+   public String getToolTipText()
+   {
+     if(isCoverageView(getPixPerBaseByWidth()) && lastMousePoint != null)
+       return coverageView.getToolTipText(
+           lastMousePoint.y-getJspView().getViewport().getViewPosition().y);
+-    
++
+     if(mouseOverSAMRecord == null)
+       return null;
+-    
+-    String msg = 
+-        mouseOverSAMRecord.sam.getReadName() + "\n" + 
++
++    String msg =
++        mouseOverSAMRecord.sam.getReadName() + "\n" +
+         mouseOverSAMRecord.sam.getAlignmentStart() + ".." +
+-        mouseOverSAMRecord.sam.getAlignmentEnd() + 
++        mouseOverSAMRecord.sam.getAlignmentEnd() +
+        (mouseOverSAMRecord.sam.getReadGroup() != null ? "\nRG="+mouseOverSAMRecord.sam.getReadGroup().getId() : "") +
+-        "\nisize=" + mouseOverSAMRecord.sam.getInferredInsertSize() + 
++        "\nisize=" + mouseOverSAMRecord.sam.getInferredInsertSize() +
+         "\nmapq=" + mouseOverSAMRecord.sam.getMappingQuality()+
+         "\nrname="+ mouseOverSAMRecord.sam.getReferenceName();
+ 
+-    if( mouseOverSAMRecord.sam.getReadPairedFlag() && 
+-        mouseOverSAMRecord.sam.getProperPairFlag() && 
++    if( mouseOverSAMRecord.sam.getReadPairedFlag() &&
++        mouseOverSAMRecord.sam.getProperPairFlag() &&
+        !mouseOverSAMRecord.sam.getMateUnmappedFlag())
+     {
+       msg = msg +
+@@ -426,13 +429,13 @@
+       msg = msg +
+         "\nstrand (read/mate): "+
+        (mouseOverSAMRecord.sam.getReadNegativeStrandFlag() ? "-" : "+");
+-    
++
+     if(msg != null && mouseOverInsertion != null)
+       msg = msg + "\nInsertion at:" +mouseOverInsertion;
+-    
++
+     return msg;
+   }
+-  
++
+   /**
+    * Get the BAM index file from the list
+    * @param bam
+@@ -471,7 +474,7 @@
+         if(cramIndexFile.exists())
+         {
+           logger4j.debug(
+-                 "ERROR: CRAM INDEX FILE ("+cramIndexFile.getName()+ 
++                 "ERROR: CRAM INDEX FILE ("+cramIndexFile.getName()+
+                  ") EXPECTING A BAM INDEX FILE (USE THIS OPTION --bam-style-index) ");
+           return cramIndexFile;
+         }
+@@ -480,21 +483,23 @@
+ 
+     return bamIndexFile;
+   }
+-    
++
+   /**
+    * Get the SAM file reader.
+    * @param bam
+    * @return
+    * @throws IOException
+    */
+-  private SAMFileReader getSAMFileReader(final String bam) throws IOException
++  private SamReader getSamReader(final String bam) throws IOException
+   {
+-    // parsing of the header happens during SAMFileReader construction, 
++    // parsing of the header happens during SamReader construction,
+     // so need to set the default stringency
+-    SAMFileReader.setDefaultValidationStringency(ValidationStringency.LENIENT);
+-    
+-    if(samFileReaderHash.containsKey(bam))
+-      return samFileReaderHash.get(bam);
++    final SamReaderFactory factory =
++          SamReaderFactory.makeDefault()
++              .validationStringency(ValidationStringency.LENIENT);
++
++    if(samReaderHash.containsKey(bam))
++      return samReaderHash.get(bam);
+ 
+     File bamIndexFile = getBamIndexFile(bam);
+     if(!bamIndexFile.exists())
+@@ -510,18 +515,18 @@
+       catch(SAMException e)
+       {
+         String ls = System.getProperty("line.separator");
+-        String msg = 
++        String msg =
+             "BAM index file is missing. The BAM file needs to be sorted and indexed"+ls+
+             "This can be done using samtools (http://samtools.sf.net/):"+ls+ls+
+             "samtools sort <in.bam> <out.prefix>"+ls+
+             "samtools index <sorted.bam>";
+-        
++
+         throw new SAMException(msg);
+       }
+     }
+-    
+-    final SAMFileReader samFileReader;
+-    
++
++    final SamReader samReader;
++
+     if(feature_display != null && bam.endsWith("cram"))
+     {
+       // set log level
+@@ -529,8 +534,8 @@
+          htsjdk.samtools.util.Log.LogLevel.ERROR);
+       final CRAMReferenceSequenceFile ref = new CRAMReferenceSequenceFile(
+         feature_display.getEntryGroup().getSequenceEntry(), this);
+-      
+-      final Map<Object, ReferenceSequenceFile> referenceFactory = 
++
++      final Map<Object, ReferenceSequenceFile> referenceFactory =
+           new HashMap<Object, ReferenceSequenceFile>();
+       referenceFactory.put(bamIndexFile, ref);
+ 
+@@ -560,36 +565,34 @@
+       {
+         e.printStackTrace();
+       }
+-
+-      
+-      //htsjdk.samtools.ReferenceDiscovery.referenceFactory.put(bamIndexFile, ref);
+     }
+-    
++
+     if(bam.startsWith("ftp"))
+     {
+-      FTPSeekableStream fss = new FTPSeekableStream(new URL(bam));
+-      samFileReader = new SAMFileReader(fss, bamIndexFile, false);
++      SeekableStream fss = new SeekableFTPStream(new URL(bam));
++      final SamInputResource resource = SamInputResource.of(fss);
++      samReader = factory.open(resource);
+     }
+     else if(!bam.startsWith("http"))
+     {
+       File bamFile = new File(bam);
+-      samFileReader = new SAMFileReader(bamFile, bamIndexFile);
++      final SamInputResource resource = SamInputResource.of(bamFile).index(bamIndexFile);
++      samReader = factory.open(resource);
+     }
+     else
+     {
+-      final URL urlBamFile = new URL(bam);
+-      samFileReader = new SAMFileReader(urlBamFile, bamIndexFile, false);
++      final SamInputResource resource = SamInputResource.of(new URL(bam));
++      samReader = factory.open(resource);
+     }
+-    samFileReader.setValidationStringency(ValidationStringency.SILENT);
+-    samFileReaderHash.put(bam, samFileReader);
++    samReaderHash.put(bam, samReader);
+ 
+-    readGroups.addAll(samFileReader.getFileHeader().getReadGroups());
+-    return samFileReader;
++    readGroups.addAll(samReader.getFileHeader().getReadGroups());
++    return samReader;
+   }
+ 
+   private void readHeaderPicard() throws IOException
+   {
+-    final SAMFileReader inputSam = getSAMFileReader(bamList.get(0));
++    final SamReader inputSam = getSamReader(bamList.get(0));
+     final SAMFileHeader header = inputSam.getFileHeader();
+ 
+     for(SAMSequenceRecord seq: header.getSequenceDictionary().getSequences())
+@@ -599,15 +602,15 @@
+       seqNames.add(seq.getSequenceName());
+     }
+   }
+-  
+-  class BamReadTask implements Runnable 
++
++  class BamReadTask implements Runnable
+   {
+-    private int start; 
+-    private int end; 
+-    private short bamIndex; 
++    private int start;
++    private int end;
++    private short bamIndex;
+     private float pixPerBase;
+     private CountDownLatch latch;
+-    BamReadTask(int start, int end, short bamIndex, float pixPerBase, CountDownLatch latch)  
++    BamReadTask(int start, int end, short bamIndex, float pixPerBase, CountDownLatch latch)
+     {
+       this.start = start;
+       this.end = end;
+@@ -616,7 +619,7 @@
+       this.latch = latch;
+     }
+ 
+-    public void run() 
++    public void run()
+     {
+       try
+       {
+@@ -639,23 +642,22 @@
+ 
+   /**
+    * Read a SAM or BAM file.
+-   * @throws IOException 
++   * @throws IOException
+    */
+-  private void readFromBamPicard(int start, int end, short bamIndex, float pixPerBase) 
++  private void readFromBamPicard(int start, int end, short bamIndex, float pixPerBase)
+           throws IOException
+   {
+     // Open the input file.  Automatically detects whether input is SAM or BAM
+     // and delegates to a reader implementation for the appropriate format.
+     final String bam = bamList.get(bamIndex);
+-    final SAMFileReader inputSam = getSAMFileReader(bam);
+-    
+-    //final SAMFileReader inputSam = new SAMFileReader(bamFile, indexFile);
++    final SamReader inputSam = getSamReader(bam);
++
+     if(isConcatSequences())
+     {
+       for(String seq: seqNames)
+       {
+         int sLen = seqLengths.get(seq);
+-        int offset = getSequenceOffset(seq); 
++        int offset = getSequenceOffset(seq);
+         int sBeg = offset+1;
+         int sEnd = sBeg+sLen-1;
+ 
+@@ -681,7 +683,7 @@
+     }
+     //inputSam.close();
+   }
+-  
++
+   /**
+    * Iterate over BAM file and load into the <code>List</code> of
+    * <code>SAMRecord</code>.
+@@ -690,7 +692,7 @@
+    * @param start
+    * @param end
+    */
+-  private void iterateOverBam(final SAMFileReader inputSam, 
++  private void iterateOverBam(final SamReader inputSam,
+                              final String refName, final int start, final int end,
+                              final short bamIndex, final float pixPerBase,
+                              final String bam)
+@@ -729,7 +731,7 @@
+ 
+           if(readGrpFrame != null && !readGrpFrame.isReadGroupVisible(samRecord.getReadGroup()))
+             continue;
+-          
++
+           if( samRecordFlagPredicate == null ||
+              !samRecordFlagPredicate.testPredicate(samRecord))
+           {
+@@ -739,7 +741,7 @@
+               int abeg = samRecord.getAlignmentStart();
+               int aend = samRecord.getAlignmentEnd();
+               boolean over = false;
+-              
++
+               for(int i=abeg; i<aend; i++)
+               {
+                 int bin = ((i-start)/binSize)-1;
+@@ -754,7 +756,7 @@
+                   break;
+                 }
+               }
+-             
++
+               if(over)
+                 continue;
+ 
+@@ -768,7 +770,7 @@
+                 readsInView.add(new BamViewRecord(samRecord, bamIndex));
+             }
+           }
+-        
++
+           if(cnt > checkMemAfter)
+           {
+             cnt = 0;
+@@ -776,11 +778,11 @@
+               (float)((float)memory.getHeapMemoryUsage().getUsed()/
+                       (float)memory.getHeapMemoryUsage().getMax());
+             logger4j.debug("Heap memory usage (used/max): "+heapFraction);
+-          
++
+             if(readsInView.size() > checkMemAfter*2 && !waitingFrame.isVisible())
+               waitingFrame.showWaiting("loading...", mainPanel);
+ 
+-            if(heapFraction > 0.90) 
++            if(heapFraction > 0.90)
+             {
+               popFrame.show(
+                 "Using > 90 % of the maximum memory limit:"+
+@@ -817,10 +819,10 @@
+     else
+       return seqLengths.get((String) combo.getSelectedItem());
+   }
+-  
++
+   /**
+    * For BAM files with multiple references sequences, calculate
+-   * the offset from the start of the concatenated sequence for 
++   * the offset from the start of the concatenated sequence for
+    * a given reference.
+    * @param refName
+    * @return
+@@ -829,7 +831,7 @@
+   {
+     if(!isConcatSequences())
+       return 0;
+-    
++
+     if(offsetLengths == null)
+     {
+       if(feature_display == null)
+@@ -849,7 +851,7 @@
+       final HashMap<String, Integer> lookup = new HashMap<String, Integer>();
+       for(int i=0; i<features.size(); i++)
+         lookup.put(features.elementAt(i).getIDString(), features.elementAt(i).getFirstBase());
+-        
++
+       offsetLengths = new HashMap<String, Integer>(seqNames.size());
+       for(int i=0; i<seqNames.size(); i++)
+       {
+@@ -866,23 +868,23 @@
+           }
+         }*/
+       }
+-      
++
+       if(offsetLengths.size() != seqNames.size())
+       {
+         System.err.println("Found: "+offsetLengths.size() +" of "+ seqNames.size());
+-        SwingUtilities.invokeLater(new Runnable() 
++        SwingUtilities.invokeLater(new Runnable()
+         {
+-          public void run() 
++          public void run()
+           {
+-            JOptionPane.showMessageDialog(BamView.this, 
++            JOptionPane.showMessageDialog(BamView.this,
+                 "There is a problem matching the reference sequences\n"+
+                 "to the names in the BAM file. This may mean the labels\n"+
+                 "on the reference features do not match those in the in\n"+
+-                "the BAM file.", 
++                "the BAM file.",
+                 "Problem Found", JOptionPane.WARNING_MESSAGE);
+           }
+         });
+-        
++
+         //concatSequences = false;
+         int offset = 0;
+         for(int i=0; i<combo.getItemCount(); i++)
+@@ -909,12 +911,12 @@
+     final int seqLength = getSequenceLength();
+     int start;
+     int end;
+-    
++
+     if(startBase > 0)
+       start = startBase;
+     else
+       start = getBaseAtStartOfView();
+-    
++
+     if(endBase > 0)
+       end = endBase;
+     else
+@@ -922,7 +924,7 @@
+       end   = start + nbasesInView - 1;
+       if(end > seqLength)
+         end = seqLength;
+-      
++
+       if(feature_display != null && nbasesInView < feature_display.getMaxVisibleBases())
+         nbasesInView = feature_display.getMaxVisibleBases();
+     }
+@@ -945,7 +947,7 @@
+       {
+         try
+         {
+-          float heapFractionUsedBefore = (float) ((float) memory.getHeapMemoryUsage().getUsed() / 
++          float heapFractionUsedBefore = (float) ((float) memory.getHeapMemoryUsage().getUsed() /
+                                                   (float) memory.getHeapMemoryUsage().getMax());
+           if(readsInView == null)
+             readsInView = new Vector<BamViewRecord>();
+@@ -961,16 +963,16 @@
+                   new BamReadTask(start, end, i, pixPerBase, latch));
+           }
+ 
+-          try 
++          try
+           {
+             latch.await();
+           }
+-          catch (InterruptedException e) {} // TODO 
++          catch (InterruptedException e) {} // TODO
+ 
+           //System.out.println("===== NO. THREADS="+
+           //     ((java.util.concurrent.ThreadPoolExecutor)bamReadTaskExecutor).getPoolSize()+" TIME="+(System.currentTimeMillis()-ms));
+ 
+-          float heapFractionUsedAfter = (float) ((float) memory.getHeapMemoryUsage().getUsed() / 
++          float heapFractionUsedAfter = (float) ((float) memory.getHeapMemoryUsage().getUsed() /
+                                                  (float) memory.getHeapMemoryUsage().getMax());
+ 
+           // System.out.println("Heap Max  : "+memory.getHeapMemoryUsage().getMax());
+@@ -1010,7 +1012,7 @@
+ 
+     laststart = start;
+     lastend   = end;
+-    
++
+     // this needs to be synchronized when cloning BAM window
+     synchronized(this)
+     {
+@@ -1020,7 +1022,7 @@
+ 	  {
+ 	    if(isCoverageView(pixPerBase))
+ 	      drawCoverage(g2,start, end, pixPerBase);
+-  	    else if(isStackView())  
++  	    else if(isStackView())
+ 	      drawStackView(g2, seqLength, pixPerBase, start, end);
+ 	    else if(isPairedStackView())
+ 	      drawPairedStackView(g2, seqLength, pixPerBase, start, end);
+@@ -1030,7 +1032,7 @@
+ 	      drawLineView(g2, seqLength, pixPerBase, start, end);
+ 	  }
+     }
+-    
++
+     if(isCoverage)
+       coveragePanel.repaint();
+     if(isSNPplot)
+@@ -1042,7 +1044,7 @@
+ 	{
+ 	  popFrame.show(
+           "Note :: Changed to the stack view to save memory.\n"+
+-          "Currently this is using "+ 
++          "Currently this is using "+
+           (memory.getHeapMemoryUsage().getUsed()/1000000.f)+" Mb "+
+           "and the maximum\nmemory limit is "+
+           (memory.getHeapMemoryUsage().getMax()/1000000.f)+" Mb.",
+@@ -1050,19 +1052,19 @@
+           15000);
+ 	}
+   }
+-  
++
+   protected void repaintBamView()
+   {
+     laststart = -1;
+     repaint();
+   }
+-  
++
+   private float getPixPerBaseByWidth()
+   {
+     return (float)mainPanel.getWidth() / (float)nbasesInView;
+   }
+-  
+-  
++
++
+   private int getMaxBasesInPanel(int seqLength)
+   {
+     if(feature_display == null)
+@@ -1070,7 +1072,7 @@
+     else
+       return seqLength+nbasesInView;
+   }
+-  
++
+   /**
+    * Draw the zoomed-in base view.
+    * @param g2
+@@ -1079,10 +1081,10 @@
+    * @param start
+    * @param end
+    */
+-  private void drawBaseAlignment(Graphics2D g2, 
+-                                 int seqLength, 
+-                                 float pixPerBase, 
+-                                 final int start, 
++  private void drawBaseAlignment(Graphics2D g2,
++                                 int seqLength,
++                                 float pixPerBase,
++                                 final int start,
+                                  int end)
+   {
+     ruler.start = start;
+@@ -1091,7 +1093,7 @@
+     int ypos = 0;
+     String refSeq = null;
+     int refSeqStart = start;
+-    
++
+     end = start + ( mainPanel.getWidth() * ALIGNMENT_PIX_PER_BASE );
+     if(bases != null)
+     {
+@@ -1103,9 +1105,9 @@
+ 
+         if(refSeqStart < 1)
+           refSeqStart = 1;
+-        refSeq = 
++        refSeq =
+           bases.getSubSequence(new Range(refSeqStart, seqEnd), Bases.FORWARD).toUpperCase();
+-        
++
+         ruler.refSeq = refSeq;
+       }
+       catch (OutOfRangeException e)
+@@ -1117,14 +1119,14 @@
+     drawSelectionRange(g2, ALIGNMENT_PIX_PER_BASE, start, end, Color.PINK);
+ 
+     g2.setStroke(new BasicStroke (2.f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND));
+-    
++
+     boolean drawn[] = new boolean[readsInView.size()];
+     for(int i=0; i<readsInView.size(); i++)
+       drawn[i] = false;
+-    
++
+     Rectangle r = jspView.getViewport().getViewRect();
+     int nreads = readsInView.size();
+-    
++
+     for (int i = 0; i < nreads; i++)
+     {
+       try
+@@ -1170,7 +1172,7 @@
+         ae.printStackTrace();
+       }
+     }
+-    
++
+     if(ypos > getHeight())
+     {
+       Dimension d = getPreferredSize();
+@@ -1180,7 +1182,7 @@
+     }
+   }
+ 
+-  
++
+   /**
+    * Draw the query sequence
+    * @param g2
+@@ -1188,16 +1190,16 @@
+    * @param pixPerBase
+    * @param ypos
+    */
+-  private void drawSequence(final Graphics2D g2, final BamViewRecord bamViewRecord, 
++  private void drawSequence(final Graphics2D g2, final BamViewRecord bamViewRecord,
+                             int ypos, String refSeq, int refSeqStart)
+   {
+     SAMRecord samRecord = bamViewRecord.sam;
+     if (!samRecord.getReadPairedFlag() ||  // read is not paired in sequencing
+-        samRecord.getMateUnmappedFlag() )  // mate is unmapped )  // mate is unmapped 
++        samRecord.getMateUnmappedFlag() )  // mate is unmapped )  // mate is unmapped
+       g2.setColor(Color.black);
+     else
+       g2.setColor(Color.blue);
+-    
++
+     final Color col = g2.getColor();
+     int xpos;
+     int len    = 0;
+@@ -1226,20 +1228,20 @@
+           setColourByBaseQuality(g2, phredQuality[readPos]);
+ 
+         if(isSNPs && refSeq != null && refPos > 0 && refPos < refSeq.length())
+-        { 
++        {
+           if(Character.toUpperCase(readSeq.charAt(readPos)) != refSeq.charAt(refPos))
+             g2.setColor(Color.red);
+           else
+             g2.setColor(col);
+         }
+ 
+-        g2.drawString(readSeq.substring(readPos, readPos+1), 
++        g2.drawString(readSeq.substring(readPos, readPos+1),
+                       refPos*ALIGNMENT_PIX_PER_BASE, ypos);
+-        
++
+         if(isSNPs)
+           g2.setColor(col);
+       }
+-          
++
+       // look for insertions
+       if(markInsertions.isSelected() && i < blocks.size()-1)
+       {
+@@ -1254,18 +1256,18 @@
+           g2.setColor(DEEP_PINK);
+ 
+           int xscreen = (refPos+1)*ALIGNMENT_PIX_PER_BASE;
+-          insertions.put(xscreen, 
++          insertions.put(xscreen,
+               (refPos+refSeqStart+1)+" "+
+               readSeq.substring(blockEnd-1, nextBlockStart-1));
+           g2.drawLine(xscreen, ypos, xscreen, ypos-BASE_HEIGHT);
+-          
++
+           // mark on reference sequence as well
+           if(bases != null)
+             g2.drawLine(xscreen, 11, xscreen, 11-BASE_HEIGHT);
+           g2.setColor(col);
+         }
+       }
+-      
++
+       // highlight
+       if(highlightSAMRecord != null &&
+          highlightSAMRecord.sam.getReadName().equals(samRecord.getReadName()))
+@@ -1275,14 +1277,14 @@
+         int width  = block.getLength()*ALIGNMENT_PIX_PER_BASE;
+         Color col1 = g2.getColor();
+         g2.setColor(Color.red);
+-        g2.drawRect(xstart, ypos-BASE_HEIGHT, width, BASE_HEIGHT);        
++        g2.drawRect(xstart, ypos-BASE_HEIGHT, width, BASE_HEIGHT);
+         if(i < blocks.size()-1)
+         {
+-          int nextStart = 
++          int nextStart =
+             (blocks.get(i+1).getReferenceStart() + offset - refSeqStart)*ALIGNMENT_PIX_PER_BASE;
+           g2.drawLine(xstart+width, ypos-(BASE_HEIGHT/2), nextStart, ypos-(BASE_HEIGHT/2));
+         }
+-        
++
+         g2.setColor(col1);
+       }
+       else if(i < blocks.size()-1)
+@@ -1290,7 +1292,7 @@
+         refPos =  block.getReferenceStart() + offset - refSeqStart;
+         int xstart = refPos*ALIGNMENT_PIX_PER_BASE;
+         int width  = block.getLength()*ALIGNMENT_PIX_PER_BASE;
+-        int nextStart = 
++        int nextStart =
+           (blocks.get(i+1).getReferenceStart() + offset - refSeqStart)*ALIGNMENT_PIX_PER_BASE;
+         g2.drawLine(xstart+width, ypos-(BASE_HEIGHT/2), nextStart, ypos-(BASE_HEIGHT/2));
+       }
+@@ -1300,7 +1302,7 @@
+     {
+       refPos = blocks.get(0).getReferenceStart()+offset-refSeqStart;
+       int xstart = refPos*ALIGNMENT_PIX_PER_BASE;
+-      
++
+       refPos = blocks.get(blocks.size()-1).getReferenceStart()+
+                blocks.get(blocks.size()-1).getLength()+offset-refSeqStart;
+       int xend   = (refPos+len)*ALIGNMENT_PIX_PER_BASE;
+@@ -1316,7 +1318,7 @@
+       }
+     }
+   }
+-  
++
+   /**
+    * Colour bases on their mapping quality.
+    * @param g2
+@@ -1333,7 +1335,7 @@
+     else
+       g2.setColor(Color.black);
+   }
+-  
++
+   /**
+    * Draw inferred size view.
+    * @param g2
+@@ -1347,30 +1349,30 @@
+     drawSelectionRange(g2, pixPerBase,start, end, Color.PINK);
+     if(isShowScale())
+       drawScale(g2, start, end, pixPerBase, getHeight());
+-    
++
+     final Stroke stroke =
+       new BasicStroke (readLnHgt, BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND);
+     g2.setStroke(stroke);
+     int ydiff = (int) Math.round(1.5*readLnHgt);
+-    
++
+     final int scaleHeight;
+     if(isShowScale())
+       scaleHeight = 15;
+     else
+       scaleHeight = 0;
+-    
++
+     int baseAtStartOfView = getBaseAtStartOfView();
+     Rectangle r = jspView.getViewport().getViewRect();
+-    
++
+     for(int i=0; i<readsInView.size(); i++)
+     {
+       BamViewRecord bamViewRecord = readsInView.get(i);
+       SAMRecord samRecord = bamViewRecord.sam;
+       BamViewRecord bamViewNextRecord = null;
+-      SAMRecord samNextRecord = null;      
++      SAMRecord samNextRecord = null;
+ 
+       List<Integer> snps = getSNPs(samRecord);
+-      
++
+       if( !samRecord.getReadPairedFlag() ||  // read is not paired in sequencing
+           samRecord.getMateUnmappedFlag() )  // mate is unmapped
+       {
+@@ -1379,7 +1381,7 @@
+           int ypos = getYPos(scaleHeight, samRecord.getReadString().length()); // (getHeight() - scaleHeight) - samRecord.getReadString().length();
+           if(ypos > r.getMaxY() || ypos < r.getMinY())
+             continue;
+-          
++
+           g2.setColor(Color.black);
+           drawRead(g2, bamViewRecord, pixPerBase, ypos, baseAtStartOfView, snps, ydiff);
+         }
+@@ -1389,35 +1391,35 @@
+       int ypos = getYPos(scaleHeight, Math.abs(samRecord.getInferredInsertSize()));
+       if( (ypos > r.getMaxY() || ypos < r.getMinY()) && ypos > 0 )
+         continue;
+-      
++
+       if(i < readsInView.size()-1)
+       {
+         bamViewNextRecord = readsInView.get(++i);
+         samNextRecord = bamViewNextRecord.sam;
+ 
+         if(samRecord.getReadName().equals(samNextRecord.getReadName()))
+-        { 
++        {
+           // draw connection between paired reads
+-          if(samRecord.getAlignmentEnd() < samNextRecord.getAlignmentStart() && 
++          if(samRecord.getAlignmentEnd() < samNextRecord.getAlignmentStart() &&
+               (samNextRecord.getAlignmentStart()-samRecord.getAlignmentEnd())*pixPerBase > 2.f)
+           {
+         	g2.setColor(Color.LIGHT_GRAY);
+ 
+             int offset1 = getSequenceOffset(samRecord.getReferenceName());
+             int end1   = samRecord.getAlignmentEnd()+offset1-baseAtStartOfView;
+-            
++
+             int offset2 = getSequenceOffset(samNextRecord.getReferenceName());
+             int start2  = samNextRecord.getAlignmentStart()+offset2-baseAtStartOfView;
+-            
+-            drawTranslucentLine(g2, 
++
++            drawTranslucentLine(g2,
+                    (int)(end1*pixPerBase), (int)(start2*pixPerBase), ypos);
+           }
+-          
++
+           if(colourByCoverageColour.isSelected())
+             g2.setColor(getColourByCoverageColour(bamViewRecord));
+           else if( (samRecord.getReadNegativeStrandFlag() && // strand of the query (1 for reverse)
+                     samNextRecord.getReadNegativeStrandFlag()) ||
+-                   (!samRecord.getReadNegativeStrandFlag() && 
++                   (!samRecord.getReadNegativeStrandFlag() &&
+                     !samNextRecord.getReadNegativeStrandFlag()))
+             g2.setColor(Color.red);
+           else
+@@ -1437,10 +1439,10 @@
+         drawLoneRead(g2, bamViewRecord, ypos, pixPerBase, baseAtStartOfView, scaleHeight, snps, ydiff);
+       }
+     }
+-    
++
+     drawYScale(g2, scaleHeight);
+   }
+-  
++
+   private int getYPos(int scaleHeight, int size)
+   {
+     if(!logScale)
+@@ -1451,25 +1453,25 @@
+       return (getHeight() - scaleHeight) - logInfSize;
+     }
+   }
+- 
++
+   /**
+-   * Draw the reads as lines in vertical stacks. The reads are colour 
++   * Draw the reads as lines in vertical stacks. The reads are colour
+    * coded as follows:
+-   * 
++   *
+    * blue  - reads are unique and are paired with a mapped mate
+    * black - reads are unique and are not paired or have an unmapped mate
+    * green - reads are duplicates
+-   * 
++   *
+    * @param g2
+    * @param seqLength
+    * @param pixPerBase
+    * @param start
+    * @param end
+    */
+-  private void drawStackView(Graphics2D g2, 
+-                             final int seqLength, 
+-                             final float pixPerBase, 
+-                             final int start, 
++  private void drawStackView(Graphics2D g2,
++                             final int seqLength,
++                             final float pixPerBase,
++                             final int start,
+                              final int end)
+   {
+     drawSelectionRange(g2, pixPerBase,start, end, Color.PINK);
+@@ -1478,16 +1480,16 @@
+ 
+     final BasicStroke stroke = new BasicStroke(
+         readLnHgt,
+-        BasicStroke.CAP_BUTT, 
++        BasicStroke.CAP_BUTT,
+         BasicStroke.JOIN_MITER);
+     g2.setStroke(stroke);
+-    
++
+     final int scaleHeight;
+     if(isShowScale())
+       scaleHeight = 15;
+     else
+       scaleHeight = 0;
+-    
++
+     int ypos = (getHeight() - scaleHeight);
+     int ydiff = (int) Math.round(1.5*readLnHgt);
+ 
+@@ -1499,7 +1501,7 @@
+     final int baseAtStartOfView = getBaseAtStartOfView();
+     g2.setColor(Color.blue);
+     final Rectangle r = jspView.getViewport().getViewRect();
+-    
++
+     for(BamViewRecord bamViewRecord: readsInView)
+     {
+       SAMRecord samRecord = bamViewRecord.sam;
+@@ -1507,10 +1509,10 @@
+ 
+       int recordStart = samRecord.getAlignmentStart()+offset;
+       int recordEnd = samRecord.getAlignmentEnd()+offset;
+-      
++
+       List<Integer> snps = getSNPs(samRecord);
+-      
+-      if(colourByCoverageColour.isSelected() || 
++
++      if(colourByCoverageColour.isSelected() ||
+          colourByStrandTag.isSelected() ||
+          colourByReadGrp.isSelected() ||
+          lstStart != recordStart || lstEnd != recordEnd || snps != null)
+@@ -1518,24 +1520,24 @@
+         if(colourByStrandTag.isSelected())
+         {
+           if(samRecord.getAttribute("XS") == null)
+-            g2.setColor(Color.BLACK); 
++            g2.setColor(Color.BLACK);
+           else if( ((Character)samRecord.getAttribute("XS")).equals('+') )
+             g2.setColor(Color.BLUE);
+           else if( ((Character)samRecord.getAttribute("XS")).equals('-') )
+             g2.setColor(Color.RED);
+-          else 
+-            g2.setColor(Color.BLACK); 
++          else
++            g2.setColor(Color.BLACK);
+         }
+         else if(colourByCoverageColour.isSelected())
+           g2.setColor(getColourByCoverageColour(bamViewRecord));
+         else if(colourByReadGrp.isSelected())
+           g2.setColor(getReadGroupFrame().getReadGroupColour(readGroups, samRecord.getReadGroup()));
+         else if (!samRecord.getReadPairedFlag() ||   // read is not paired in sequencing
+-                  samRecord.getMateUnmappedFlag() )  // mate is unmapped )  // mate is unmapped 
++                  samRecord.getMateUnmappedFlag() )  // mate is unmapped )  // mate is unmapped
+           g2.setColor(Color.black);
+         else
+           g2.setColor(Color.blue);
+-        
++
+         if(maxEnd < recordStart || ypos < 0)
+         {
+           ypos = (getHeight() - scaleHeight)-ydiff;
+@@ -1546,7 +1548,7 @@
+       }
+       else
+         g2.setColor(DARK_GREEN);
+-      
++
+       if(snps != null)
+         lstStart = -1;
+       else
+@@ -1554,39 +1556,39 @@
+         lstStart = recordStart;
+         lstEnd   = recordEnd;
+       }
+-      
++
+       if(ypos > r.getMaxY() || ypos < r.getMinY())
+         continue;
+       drawRead(g2, bamViewRecord, pixPerBase, ypos, baseAtStartOfView, snps, ydiff);
+     }
+   }
+-  
++
+   /**
+-   * Draw the reads as lines in vertical stacks. The reads are colour 
++   * Draw the reads as lines in vertical stacks. The reads are colour
+    * coded as follows:
+-   * 
++   *
+    * blue  - reads are unique and are paired with a mapped mate
+    * black - reads are unique and are not paired or have an unmapped mate
+    * green - reads are duplicates
+-   * 
++   *
+    * @param g2
+    * @param seqLength
+    * @param pixPerBase
+    * @param start
+    * @param end
+    */
+-  private void drawStrandStackView(Graphics2D g2, 
+-                                   int seqLength, 
+-                                   float pixPerBase, 
+-                                   int start, 
++  private void drawStrandStackView(Graphics2D g2,
++                                   int seqLength,
++                                   float pixPerBase,
++                                   int start,
+                                    int end)
+   {
+-    drawSelectionRange(g2, pixPerBase,start, end, Color.PINK);   
++    drawSelectionRange(g2, pixPerBase,start, end, Color.PINK);
+     final BasicStroke stroke = new BasicStroke(
+         readLnHgt,
+-        BasicStroke.CAP_BUTT, 
++        BasicStroke.CAP_BUTT,
+         BasicStroke.JOIN_MITER);
+-    
++
+     final int scaleHeight = 15;
+     drawScale(g2, start, end, pixPerBase, ((getHeight()+scaleHeight)/2));
+ 
+@@ -1594,18 +1596,18 @@
+     int ydiff = (int) Math.round(1.5*readLnHgt);
+     if(isOrientation)
+       ydiff= 2*ydiff;
+-    
++
+     g2.setStroke(stroke);
+-    // positive strand    
++    // positive strand
+     drawStrand(g2, false, scaleHeight, ymid-(scaleHeight/2), -ydiff, pixPerBase);
+-    
++
+     // negative strand
+     drawStrand(g2, true, scaleHeight, ymid+(scaleHeight/2), ydiff, pixPerBase);
+   }
+-  
+- 
+-  private void drawStrand(Graphics2D g2, 
+-                          boolean isStrandNegative, 
++
++
++  private void drawStrand(Graphics2D g2,
++                          boolean isStrandNegative,
+                           int scaleHeight,
+                           int ymid,
+                           int ystep,
+@@ -1619,7 +1621,7 @@
+     int baseAtStartOfView = getBaseAtStartOfView();
+     g2.setColor(Color.blue);
+     Rectangle r = jspView.getViewport().getViewRect();
+-    
++
+     for(BamViewRecord bamViewRecord: readsInView)
+     {
+       SAMRecord samRecord = bamViewRecord.sam;
+@@ -1629,8 +1631,8 @@
+         final int recordStart = samRecord.getAlignmentStart()+offset;
+         final int recordEnd   = samRecord.getAlignmentEnd()+offset;
+         List<Integer> snps = getSNPs(samRecord);
+-        
+-        if(colourByCoverageColour.isSelected() || 
++
++        if(colourByCoverageColour.isSelected() ||
+            colourByStrandTag.isSelected() ||
+            colourByReadGrp.isSelected() ||
+            lstStart != recordStart || lstEnd != recordEnd || snps != null)
+@@ -1638,24 +1640,24 @@
+           if(colourByStrandTag.isSelected())
+           {
+             if(samRecord.getAttribute("XS") == null)
+-              g2.setColor(Color.BLACK); 
++              g2.setColor(Color.BLACK);
+             else if( ((Character)samRecord.getAttribute("XS")).equals('+') )
+               g2.setColor(Color.BLUE);
+             else if( ((Character)samRecord.getAttribute("XS")).equals('-') )
+               g2.setColor(Color.RED);
+-            else 
+-              g2.setColor(Color.BLACK); 
++            else
++              g2.setColor(Color.BLACK);
+           }
+           else if(colourByCoverageColour.isSelected())
+             g2.setColor(getColourByCoverageColour(bamViewRecord));
+           else if(colourByReadGrp.isSelected())
+             g2.setColor(getReadGroupFrame().getReadGroupColour(readGroups, samRecord.getReadGroup()));
+           else if (!samRecord.getReadPairedFlag() ||   // read is not paired in sequencing
+-                    samRecord.getMateUnmappedFlag() )  // mate is unmapped 
++                    samRecord.getMateUnmappedFlag() )  // mate is unmapped
+             g2.setColor(Color.black);
+           else
+             g2.setColor(Color.blue);
+-        
++
+           if(maxEnd < recordStart || ypos < 0 || ypos > hgt)
+           {
+             ypos = ymid + ystep;
+@@ -1674,7 +1676,7 @@
+           lstStart = recordStart;
+           lstEnd   = recordEnd;
+         }
+-        
++
+         if(ypos > r.getMaxY() || ypos < r.getMinY())
+           continue;
+ 
+@@ -1682,26 +1684,26 @@
+       }
+     }
+   }
+-  
++
+   /**
+-   * Draw paired reads as lines in a vertical stacks. 
++   * Draw paired reads as lines in a vertical stacks.
+    * @param g2
+    * @param seqLength
+    * @param pixPerBase
+    * @param start
+    * @param end
+    */
+-  private void drawPairedStackView(Graphics2D g2, 
+-                                   final int seqLength, 
+-                                   final float pixPerBase, 
+-                                   final int start, 
++  private void drawPairedStackView(Graphics2D g2,
++                                   final int seqLength,
++                                   final float pixPerBase,
++                                   final int start,
+                                    final int end)
+   {
+     drawSelectionRange(g2, pixPerBase,start, end, Color.PINK);
+     if(isShowScale())
+       drawScale(g2, start, end, pixPerBase, getHeight());
+ 
+-    final Vector<PairedRead> pairedReads = new Vector<PairedRead>();   
++    final Vector<PairedRead> pairedReads = new Vector<PairedRead>();
+     for(int i=0; i<readsInView.size(); i++)
+     {
+       BamViewRecord bamViewRecord = readsInView.get(i);
+@@ -1710,16 +1712,16 @@
+           samRecord.getMateUnmappedFlag() )  // mate is unmapped
+         continue;
+ 
+-      BamViewRecord bamViewNextRecord = null;      
++      BamViewRecord bamViewNextRecord = null;
+       if(i < readsInView.size()-1)
+       {
+         bamViewNextRecord = readsInView.get(++i);
+         SAMRecord samNextRecord = bamViewNextRecord.sam;
+-        
++
+         final PairedRead pr = new PairedRead();
+-        if(samRecord.getReadName().equals(samNextRecord.getReadName()) && 
++        if(samRecord.getReadName().equals(samNextRecord.getReadName()) &&
+            isFromSameBamFile(bamViewRecord, bamViewNextRecord, bamList))
+-        { 
++        {
+           if(samRecord.getAlignmentStart() < samNextRecord.getAlignmentStart())
+           {
+             pr.sam1 = bamViewRecord;
+@@ -1737,22 +1739,22 @@
+           pr.sam1 = bamViewRecord;
+           pr.sam2 = null;
+         }
+-        
++
+         pairedReads.add(pr);
+       }
+     }
+     Collections.sort(pairedReads, new PairedReadComparator());
+-    
+-    Stroke originalStroke = new BasicStroke (readLnHgt, BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND); 
++
++    Stroke originalStroke = new BasicStroke (readLnHgt, BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND);
+ 
+     g2.setStroke( new BasicStroke (1.3f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND));
+-    
++
+     final int scaleHeight;
+     if(isShowScale())
+       scaleHeight = 15;
+     else
+       scaleHeight = 0;
+-    
++
+     int ydiff = (int) Math.round(2.3*readLnHgt);
+     if(isOrientation)
+       ydiff= 2*ydiff;
+@@ -1773,25 +1775,25 @@
+       }
+       else
+         ypos = ypos - ydiff;
+-      
++
+       if(ypos > r.getMaxY() || ypos < r.getMinY())
+         continue;
+-      
++
+       g2.setStroke(originalStroke);
+-      
+-      if(highlightSAMRecord != null && 
++
++      if(highlightSAMRecord != null &&
+           highlightSAMRecord.sam.getReadName().equals(pr.sam1.sam.getReadName()))
+         g2.setColor(Color.black);
+       else
+         g2.setColor(Color.gray);
+-      
++
+       if(pr.sam2 != null)
+       {
+         if(!readsOverlap(pr.sam1.sam, pr.sam2.sam))
+         {
+           int offset1 = getSequenceOffset(pr.sam1.sam.getReferenceName());
+           int offset2 = getSequenceOffset(pr.sam2.sam.getReferenceName());
+-          drawTranslucentJointedLine(g2, 
++          drawTranslucentJointedLine(g2,
+               (int)((pr.sam1.sam.getAlignmentEnd()+offset1-getBaseAtStartOfView())*pixPerBase),
+               (int)((pr.sam2.sam.getAlignmentStart()+offset2-getBaseAtStartOfView())*pixPerBase), ypos);
+         }
+@@ -1813,11 +1815,11 @@
+         }
+ 
+         int offset = getSequenceOffset(pr.sam1.sam.getReferenceName());
+-        drawTranslucentJointedLine(g2, 
++        drawTranslucentJointedLine(g2,
+               (int)( (prStart+offset-getBaseAtStartOfView())*pixPerBase),
+               (int)( (prEnd  +offset-getBaseAtStartOfView())*pixPerBase), ypos);
+       }
+-      
++
+       if(colourByCoverageColour.isSelected())
+         g2.setColor(getColourByCoverageColour(pr.sam1));
+       else if(colourByStrandTag.isSelected())
+@@ -1826,12 +1828,12 @@
+           g2.setColor(Color.BLUE);
+         else if( ((Character)pr.sam1.sam.getAttribute("XS")).equals('-') )
+           g2.setColor(Color.RED);
+-        else 
+-          g2.setColor(Color.BLACK); 
++        else
++          g2.setColor(Color.BLACK);
+       }
+       else if(colourByReadGrp.isSelected())
+         g2.setColor(getReadGroupFrame().getReadGroupColour(readGroups, pr.sam1.sam.getReadGroup()));
+-      else if(   pr.sam2 != null && 
++      else if(   pr.sam2 != null &&
+               !( pr.sam1.sam.getReadNegativeStrandFlag() ^ pr.sam2.sam.getReadNegativeStrandFlag() ) )
+         g2.setColor(Color.red);
+       else
+@@ -1846,7 +1848,7 @@
+       }
+     }
+   }
+-  
++
+   /**
+    * Check if a record is on the negative strand. If the RNA strand specific
+    * checkbox is set then use the RNA strand.
+@@ -1854,8 +1856,8 @@
+    * @param useStrandTag - strand specific tag
+    * @return
+    */
+-  protected static boolean isNegativeStrand(final SAMRecord samRecord, 
+-                                            final boolean useStrandTag) 
++  protected static boolean isNegativeStrand(final SAMRecord samRecord,
++                                            final boolean useStrandTag)
+   {
+     if(useStrandTag)
+     {
+@@ -1868,7 +1870,7 @@
+     }
+     return samRecord.getReadNegativeStrandFlag();
+   }
+-  
++
+   /**
+    * Check if two records are from the same BAM file
+    * @param sam1
+@@ -1876,8 +1878,8 @@
+    * @param bamList
+    * @return
+    */
+-  private boolean isFromSameBamFile(final BamViewRecord sam1, 
+-                                    final BamViewRecord sam2, 
++  private boolean isFromSameBamFile(final BamViewRecord sam1,
++                                    final BamViewRecord sam2,
+                                     final List<String> bamList)
+   {
+     if(bamList == null || bamList.size()<2)
+@@ -1888,18 +1890,18 @@
+     if(o1 != -1 && o2 != -1)
+       if( o1 != o2 )
+         return false;
+-    
++
+     return true;
+   }
+-  
+-  
++
++
+   /**
+    * Check if two records overlap
+    * @param s1
+    * @param s2
+    * @return true id the two reads overlap
+    */
+-  private boolean readsOverlap(final SAMRecord s1, 
++  private boolean readsOverlap(final SAMRecord s1,
+                                final SAMRecord s2)
+   {
+     if( (s2.getAlignmentStart() >= s1.getAlignmentStart() &&
+@@ -1907,7 +1909,7 @@
+         (s2.getAlignmentEnd()   >= s1.getAlignmentStart() &&
+          s2.getAlignmentEnd()   <= s1.getAlignmentEnd()) )
+       return true;
+-    
++
+     if( (s1.getAlignmentStart() >= s2.getAlignmentStart() &&
+          s1.getAlignmentStart() <= s2.getAlignmentEnd()) ||
+         (s1.getAlignmentEnd()   >= s2.getAlignmentStart() &&
+@@ -1915,7 +1917,7 @@
+      return true;
+     return false;
+   }
+-  
++
+   /**
+    * Draw the read coverage.
+    * @param g2
+@@ -1950,9 +1952,9 @@
+     coverageView.drawSelectionRange(g2, pixPerBase, start, end, getHeight(), Color.PINK);
+     coverageView.draw(g2, getWidth(), hgt, hideBamList);
+     if(!coverageView.isPlotHeatMap())
+-      coverageView.drawMax(g2, coverageView.getMaxCoverage());  
++      coverageView.drawMax(g2, coverageView.getMaxCoverage());
+   }
+-  
++
+   /**
+    * Draw a read that apparently has a read mate that is not in view.
+    * @param g2
+@@ -1962,7 +1964,7 @@
+    * @param originalStroke
+    * @param stroke
+    */
+-  private void drawLoneRead(Graphics2D g2, BamViewRecord bamViewRecord, int ypos, 
++  private void drawLoneRead(Graphics2D g2, BamViewRecord bamViewRecord, int ypos,
+       float pixPerBase, int baseAtStartOfView, int scaleHeight, List<Integer> snps, int ydiff)
+   {
+     SAMRecord samRecord = bamViewRecord.sam;
+@@ -1970,64 +1972,64 @@
+     int offset = getSequenceOffset(samRecord.getReferenceName());
+     int thisStart = samRecord.getAlignmentStart()+offset;
+     int thisEnd   = thisStart + samRecord.getReadString().length() -1;
+-    
++
+     if(ypos <= 0)
+     {
+       offTheTop = true;
+       ypos = samRecord.getReadString().length();
+     }
+-    
++
+     if(samRecord.getInferredInsertSize() == 0)
+     {
+       offTheTop = true;
+       ypos = getHeight() - scaleHeight - 5;
+     }
+-      
++
+     if(samRecord.getInferredInsertSize() != 0 &&
+       Math.abs(samRecord.getMateAlignmentStart()-samRecord.getAlignmentEnd())*pixPerBase > 2.f)
+     {
+       g2.setColor(Color.LIGHT_GRAY);
+-      
++
+       if(samRecord.getAlignmentEnd() < samRecord.getMateAlignmentStart())
+       {
+-        int nextStart = 
++        int nextStart =
+           (int)((samRecord.getMateAlignmentStart()-getBaseAtStartOfView()+offset)*pixPerBase);
+-        drawTranslucentLine(g2, 
++        drawTranslucentLine(g2,
+           (int)((thisEnd-getBaseAtStartOfView())*pixPerBase), nextStart, ypos);
+       }
+       else
+       {
+-        int nextStart = 
++        int nextStart =
+             (int)((samRecord.getMateAlignmentStart()-getBaseAtStartOfView()+offset)*pixPerBase);
+-        drawTranslucentLine(g2, 
++        drawTranslucentLine(g2,
+             (int)((thisStart-getBaseAtStartOfView())*pixPerBase), nextStart, ypos);
+       }
+     }
+-    
++
+     if(colourByCoverageColour.isSelected())
+       g2.setColor(getColourByCoverageColour(bamViewRecord));
+     else if(offTheTop)
+-      g2.setColor(DARK_ORANGE); 
++      g2.setColor(DARK_ORANGE);
+     else if(samRecord.getReadNegativeStrandFlag() &&
+             samRecord.getMateNegativeStrandFlag()) // strand of the query (1 for reverse)
+       g2.setColor(Color.red);
+     else
+       g2.setColor(Color.blue);
+- 
++
+     drawRead(g2, bamViewRecord, pixPerBase, ypos, baseAtStartOfView, snps, ydiff);
+-    
++
+     /*if (isSNPs)
+       showSNPsOnReads(g2, samRecord, pixPerBase, ypos, offset);*/
+   }
+ 
+-  
++
+   private void drawScale(Graphics2D g2, int start, int end, float pixPerBase, int ypos)
+   {
+     g2.setColor(Color.black);
+     g2.drawLine( 0, ypos-14,
+                  (int)((end - getBaseAtStartOfView())*pixPerBase),   ypos-14);
+     int interval = end-start;
+-    
++
+     if(interval > 256000)
+       drawTicks(g2, start, end, pixPerBase, 512000, ypos);
+     else if(interval > 64000)
+@@ -2041,14 +2043,14 @@
+     else
+       drawTicks(g2, start, end, pixPerBase, 100, ypos);
+   }
+-  
++
+   private void drawTicks(Graphics2D g2, int start, int end, float pixPerBase, int division, int ypos)
+   {
+     int markStart = (Math.round(start/division)*division);
+-    
++
+     if(markStart < 1)
+       markStart = 1;
+-    
++
+     int sm = markStart-(division/2);
+     float x;
+     if(sm > start)
+@@ -2056,26 +2058,26 @@
+       x = (sm-getBaseAtStartOfView())*pixPerBase;
+       g2.drawLine((int)x, ypos-14,(int)x, ypos-12);
+     }
+-    
++
+     for(int m=markStart; m<end; m+=division)
+     {
+       x = (m-getBaseAtStartOfView())*pixPerBase;
+       g2.drawString(Integer.toString(m), x, ypos-1);
+       g2.drawLine((int)x, ypos-14,(int)x, ypos-11);
+-      
++
+       sm = m+(division/2);
+-      
++
+       if(sm < end)
+       {
+         x = (sm-getBaseAtStartOfView())*pixPerBase;
+         g2.drawLine((int)x, ypos-14,(int)x, ypos-12);
+       }
+-      
++
+       if(m == 1)
+         m = 0;
+     }
+   }
+-  
++
+   /**
+    * Draw a y-scale for inferred size (isize) of reads.
+    * @param g2
+@@ -2085,13 +2087,13 @@
+   {
+     g2.setColor(Color.black);
+     int maxY = getPreferredSize().height-xScaleHeight;
+-    
++
+     if(logScale)
+     {
+       int start = 10;
+       int count = 0;
+       int ypos = getYPos(xScaleHeight, start);
+-      
++
+       while(ypos > 0 && count < 15 && start > 1)
+       {
+         g2.drawLine(0, ypos, 2, ypos);
+@@ -2102,7 +2104,7 @@
+       }
+       return;
+     }
+-    
++
+     for(int i=100; i<maxY; i+=100)
+     {
+       int ypos = getHeight()-i-xScaleHeight;
+@@ -2110,7 +2112,7 @@
+       g2.drawString(Integer.toString(i), 3, ypos);
+     }
+   }
+-  
++
+   /**
+    * Draw a given read.
+    * @param g2
+@@ -2120,7 +2122,7 @@
+    * @param baseAtStartOfView
+    * @param snps
+    */
+-  private void drawRead(Graphics2D g2, 
++  private void drawRead(Graphics2D g2,
+       final BamViewRecord bamViewRecord,
+       final float pixPerBase,
+       final int ypos,
+@@ -2133,8 +2135,8 @@
+ 
+     int thisStart = thisRead.getAlignmentStart()+offset-baseAtStartOfView;
+     int thisEnd   = thisRead.getAlignmentEnd()+offset-baseAtStartOfView;
+-    
+-    if(highlightSAMRecord != null && 
++
++    if(highlightSAMRecord != null &&
+        highlightSAMRecord.sam.getReadName().equals(thisRead.getReadName()))
+     {
+        Stroke originalStroke = g2.getStroke();
+@@ -2175,7 +2177,7 @@
+         lastEnd = blockEnd;
+       }
+     }
+-    
++
+     if(isOrientation)
+       drawArrow(g2, thisRead, thisStart, thisEnd, pixPerBase, ypos, ydiff);
+ 
+@@ -2189,11 +2191,11 @@
+         mouseOverSAMRecord = bamViewRecord;
+       }
+     }
+-    
++
+     if (isSNPs && snps != null)
+       showSNPsOnReads(snps, g2, pixPerBase, ypos);
+   }
+-  
++
+   /**
+    * Draw arrow on the read to indicate orientation.
+    * @param g2
+@@ -2204,16 +2206,16 @@
+    * @param ypos
+    */
+   private void drawArrow(final Graphics2D g2,
+-      final SAMRecord thisRead, 
+-      final int thisStart, 
+-      final int thisEnd, 
+-      final float pixPerBase, 
++      final SAMRecord thisRead,
++      final int thisStart,
++      final int thisEnd,
++      final float pixPerBase,
+       int ypos,
+       int ydiff)
+   {
+     if(ydiff < 0)
+       ydiff = -ydiff;
+-    
++
+     if(thisRead.getReadNegativeStrandFlag())
+     {
+       ypos-=readLnHgt/2;
+@@ -2227,9 +2229,9 @@
+       int apos = ypos - ydiff + 1;
+       g2.drawLine((int)( (thisEnd-5) * pixPerBase), apos,
+                   (int)( thisEnd * pixPerBase), ypos);
+-    }  
++    }
+   }
+-  
++
+   /**
+    * Highlight a selected range
+    * @param g2
+@@ -2247,19 +2249,19 @@
+       {
+         int rangeStart = selectedRange.getStart();
+         int rangeEnd   = selectedRange.getEnd();
+-        
++
+         if(end < rangeStart || start > rangeEnd)
+           return;
+-        
++
+         int x = (int) (pixPerBase*(rangeStart-getBaseAtStartOfView()));
+         int width = (int) (pixPerBase*(rangeEnd-rangeStart+1));
+-        
++
+         g2.setColor(c);
+         g2.fillRect(x, 0, width, getHeight());
+       }
+     }
+   }
+-  
++
+   /**
+    * Draw a translucent line
+    * @param g2
+@@ -2274,7 +2276,7 @@
+     g2.drawLine(start, ypos, end, ypos);
+     g2.setComposite(origComposite);
+   }
+-  
++
+   /**
+    * Draw a translucent line
+    * @param g2
+@@ -2286,14 +2288,14 @@
+   {
+     Composite origComposite = g2.getComposite();
+     g2.setComposite(translucent);
+-    
++
+     int mid = (int) ((end-start)/2.f)+start;
+     //g2.drawLine(start, ypos, end, ypos);
+     g2.drawLine(start, ypos, mid, ypos-5);
+     g2.drawLine(mid, ypos-5, end, ypos);
+     g2.setComposite(origComposite);
+   }
+-  
++
+   /**
+    * Display the SNPs for the given read.
+    * @param snps
+@@ -2308,18 +2310,18 @@
+     final Stroke originalStroke = g2.getStroke();
+     final BasicStroke stroke = new BasicStroke(
+         1.3f,
+-        BasicStroke.CAP_BUTT, 
++        BasicStroke.CAP_BUTT,
+         BasicStroke.JOIN_MITER);
+     g2.setStroke(stroke);
+-    
++
+     g2.setColor(Color.red);
+     for(int pos: snps)
+       g2.drawLine((int) (pos * pixPerBase), ypos + 2,
+                   (int) (pos * pixPerBase), ypos - 2);
+     g2.setStroke(originalStroke);
+   }
+-  
+-  
++
++
+   /**
+    * Get the SNP positions
+    * @param samRecord
+@@ -2332,7 +2334,7 @@
+     int rend = samRecord.getAlignmentEnd();
+     int offset = getSequenceOffset(samRecord.getReferenceName());
+     ArrayList<Integer> snps = null;
+-    
++
+     // use alignment blocks of the contiguous alignment of
+     // subsets of read bases to a reference sequence
+     try
+@@ -2367,8 +2369,8 @@
+     }
+     return snps;
+   }
+-  
+-  
++
++
+   /**
+    * Add the alignment view to the supplied <code>JPanel</code> in
+    * a <code>JScrollPane</code>.
+@@ -2381,7 +2383,7 @@
+   {
+     final JComponent topPanel = bamTopPanel(frame);
+     mainPanel.setPreferredSize(new Dimension(900, 400));
+-    
++
+     setDisplay(1, nbasesInView, null);
+     mainPanel.setLayout(new BorderLayout());
+ 
+@@ -2396,7 +2398,7 @@
+     //
+     snpPanel = new SnpPanel(this, bases);
+     bottomPanel.add(snpPanel, BorderLayout.NORTH);
+-    
++
+     if(feature_display == null)
+     {
+       scrollBar = new JScrollBar(JScrollBar.HORIZONTAL, 1, nbasesInView, 1,
+@@ -2441,7 +2443,7 @@
+                 "The length of the sequence loaded does not match the length of",
+                 "the default reference sequence in the BAM ("+seqNames.get(0)+").",
+                 (newIndex == -1 ? "" : "The length does match the reference "+
+-                    seqNames.get(newIndex)+" so this has been set as the default.") 
++                    seqNames.get(newIndex)+" so this has been set as the default.")
+             };
+             new NonModalDialog(frame, label);
+           }
+@@ -2459,13 +2461,13 @@
+     jspView.getVerticalScrollBar().setValue(
+         jspView.getVerticalScrollBar().getMaximum());
+   }
+-  
++
+   private void addToViewMenu(final short thisBamIndex)
+   {
+     final File f = new File(bamList.get(thisBamIndex));
+     final JCheckBoxMenuItem cbBam = new JCheckBoxMenuItem(
+-                                     f.getName(), 
+-                                     getImageIcon(getColourByCoverageColour(thisBamIndex)), 
++                                     f.getName(),
++                                     getImageIcon(getColourByCoverageColour(thisBamIndex)),
+                                      true);
+     bamFilesMenu.add(cbBam);
+     cbBam.addItemListener(new ItemListener() {
+@@ -2476,10 +2478,10 @@
+           hideBamList.add(new Short(thisBamIndex));
+         laststart = -1;
+         repaint();
+-      } 
++      }
+     });
+   }
+-  
++
+   /**
+    * Refresh the colour of the icons used to identify the
+    * BAM files.
+@@ -2498,7 +2500,7 @@
+       }
+     }
+   }
+-  
++
+   protected Color getColorByJCheckBoxMenuItem(JCheckBoxMenuItem cbBam)
+   {
+     final String bam = cbBam.getText();
+@@ -2510,7 +2512,7 @@
+     }
+     return null;
+   }
+-  
++
+   /**
+    * Create an icon of a box using the given colour.
+    * @param c
+@@ -2537,16 +2539,16 @@
+             null, false, "BamView", "BAM");
+         List<String> bamFiles = bamFileSelection.getFiles(BAM_SUFFIX);
+         short count = (short) bamList.size();
+-       
++
+         bamList.addAll(bamFileSelection.getFiles(BAM_SUFFIX));
+-        
++
+         for(short i=0; i<bamFiles.size(); i++)
+           addToViewMenu((short) (i+count));
+-        laststart = -1; 
++        laststart = -1;
+         repaint();
+-      } 
++      }
+     });
+-    
++
+     bamFilesMenu.setFont(addBam.getFont());
+ 
+     final JMenuItem groupBams = new JMenuItem("Group BAMs ...");
+@@ -2560,7 +2562,7 @@
+     bamFilesMenu.addSeparator();
+     menu.add(bamFilesMenu);
+ 
+-  
++
+     final JMenu analyse = new JMenu("Analyse");
+     menu.add(analyse);
+     final JMenuItem readCount = new JMenuItem("Read count of selected features ...");
+@@ -2579,18 +2581,18 @@
+         Box yBox = Box.createVerticalBox();
+         yBox.add(overlap);
+         yBox.add(spliced);
+-        
++
+         final ReadCountDialog opts = new ReadCountDialog(new JFrame(),
+             "Read Count Options", feature_display, yBox);
+         if(opts.getStatus() == -1)
+           return;
+         //JOptionPane.showMessageDialog(null, yBox, "Read Count Option", JOptionPane.INFORMATION_MESSAGE);
+-        
++
+         new MappedReads(BamView.this, features,
+             !overlap.isSelected(), spliced.isSelected(), colourByStrandTag.isSelected());
+-      } 
++      }
+     });
+-    
++
+     final JMenuItem rpkm = new JMenuItem("RPKM value of selected features ...");
+     analyse.add(rpkm);
+     if(feature_display == null)
+@@ -2605,14 +2607,14 @@
+         overlap.setToolTipText("Include reads that partially overlap the feature");
+         JCheckBox spliced = new JCheckBox("Introns included", true);
+         JCheckBox allRefSeqs = new JCheckBox("Use reads mapped to all reference sequences", false);
+-        
++
+         Box yBox = Box.createVerticalBox();
+         yBox.add(overlap);
+         yBox.add(spliced);
+-        
++
+         if(seqLengths.size() > 1)
+           yBox.add(allRefSeqs);
+-     
++
+         final ReadCountDialog opts = new ReadCountDialog(new JFrame(),
+             "RPKM Options", feature_display, yBox);
+         if(opts.getStatus() == -1)
+@@ -2623,7 +2625,7 @@
+           seqlen = feature_display.getSequenceLength();
+         else if(bases != null)
+           seqlen = bases.getLength();
+-        
++
+         new MappedReads(BamView.this, features, seqlen,
+             !overlap.isSelected(), spliced.isSelected(), allRefSeqs.isSelected(),
+             colourByStrandTag.isSelected());
+@@ -2641,14 +2643,14 @@
+         if(feature_display == null)
+           return;
+         new CreateFeatures(groupsFrame);
+-      } 
++      }
+     });
+ 
+     for(short i=0; i<bamList.size(); i++)
+       addToViewMenu(i);
+-    
++
+     menu.add(new JSeparator());
+-    
++
+     JMenu viewMenu = new JMenu("Views");
+     cbStackView.setFont(viewMenu.getFont());
+     cbIsizeStackView.setFont(viewMenu.getFont());
+@@ -2657,13 +2659,13 @@
+     cbCoverageView.setFont(viewMenu.getFont());
+     cbCoverageStrandView.setFont(viewMenu.getFont());
+     cbCoverageHeatMap.setFont(viewMenu.getFont());
+-    
++
+     baseQualityColour.setFont(viewMenu.getFont());
+     colourByReadGrp.setFont(viewMenu.getFont());
+     colourByCoverageColour.setFont(viewMenu.getFont());
+     colourByStrandTag.setFont(viewMenu.getFont());
+     markInsertions.setFont(viewMenu.getFont());
+-    
++
+     cbIsizeStackView.addActionListener(new ActionListener()
+     {
+       public void actionPerformed(ActionEvent e)
+@@ -2675,8 +2677,8 @@
+       }
+     });
+     viewMenu.add(cbIsizeStackView);
+-    
+-    
++
++
+     cbStackView.addActionListener(new ActionListener()
+     {
+       public void actionPerformed(ActionEvent e)
+@@ -2690,7 +2692,7 @@
+       }
+     });
+     viewMenu.add(cbStackView);
+-    
++
+ 
+     cbPairedStackView.addActionListener(new ActionListener()
+     {
+@@ -2704,7 +2706,7 @@
+       }
+     });
+     viewMenu.add(cbPairedStackView);
+-    
++
+     cbStrandStackView.addActionListener(new ActionListener()
+     {
+       public void actionPerformed(ActionEvent e)
+@@ -2720,7 +2722,7 @@
+       }
+     });
+     viewMenu.add(cbStrandStackView);
+-    
++
+     cbCoverageView.addActionListener(new ActionListener()
+     {
+       public void actionPerformed(ActionEvent e)
+@@ -2738,7 +2740,7 @@
+       }
+     });
+     viewMenu.add(cbCoverageView);
+-    
++
+     cbCoverageStrandView.addActionListener(new ActionListener()
+     {
+       public void actionPerformed(ActionEvent e)
+@@ -2757,8 +2759,8 @@
+       }
+     });
+     viewMenu.add(cbCoverageStrandView);
+-    
+-    
++
++
+     cbCoverageHeatMap.addActionListener(new ActionListener()
+     {
+       public void actionPerformed(ActionEvent e)
+@@ -2776,20 +2778,20 @@
+       }
+     });
+     viewMenu.add(cbCoverageHeatMap);
+-    
++
+     menu.add(viewMenu);
+- 
++
+     final JCheckBoxMenuItem checkBoxSNPs = new JCheckBoxMenuItem("SNP marks", isSNPs);
+-    // 
++    //
+     final JMenu colourMenu = new JMenu("Colour By");
+-    
++
+     final JCheckBoxMenuItem colourDefault = new JCheckBoxMenuItem ("Default", true);
+     final ButtonGroup grp = new ButtonGroup();
+     grp.add(colourByReadGrp);
+     grp.add(colourByCoverageColour);
+     grp.add(colourByStrandTag);
+     grp.add(colourDefault);
+-    
++
+     colourMenu.add(colourDefault);
+     colourDefault.addActionListener(new ActionListener()
+     {
+@@ -2798,7 +2800,7 @@
+         repaintBamView();
+       }
+     });
+-    
++
+     colourMenu.add(colourByReadGrp);
+     colourByReadGrp.addActionListener(new ActionListener()
+     {
+@@ -2807,7 +2809,7 @@
+         repaintBamView();
+       }
+     });
+-    
++
+     colourMenu.add(colourByCoverageColour);
+     colourByCoverageColour.addActionListener(new ActionListener()
+     {
+@@ -2816,7 +2818,7 @@
+         repaintBamView();
+       }
+     });
+-    
++
+     colourMenu.add(colourByStrandTag);
+     colourByStrandTag.addActionListener(new ActionListener()
+     {
+@@ -2842,7 +2844,7 @@
+     colourMenu.addSeparator();
+     colourMenu.add(baseQualityColour);
+     menu.add(colourMenu);
+-    
++
+     //
+     JMenu showMenu = new JMenu("Show");
+     JCheckBoxMenuItem checkBoxOrientation = new JCheckBoxMenuItem("Orientation");
+@@ -2855,7 +2857,7 @@
+       }
+     });
+     showMenu.add(checkBoxOrientation);
+-    
++
+     JCheckBoxMenuItem checkBoxSingle = new JCheckBoxMenuItem("Single Reads");
+     checkBoxSingle.addActionListener(new ActionListener()
+     {
+@@ -2866,7 +2868,7 @@
+       }
+     });
+     showMenu.add(checkBoxSingle);
+-    
++
+     checkBoxSNPs.addActionListener(new ActionListener()
+     {
+       public void actionPerformed(ActionEvent e)
+@@ -2878,14 +2880,14 @@
+               JOptionPane.INFORMATION_MESSAGE);
+         }
+         isSNPs = !isSNPs;
+-        
++
+         if(isSNPs)
+           baseQualityColour.setSelected(false);
+         repaint();
+       }
+     });
+     showMenu.add(checkBoxSNPs);
+-    
++
+     markInsertions.addActionListener(new ActionListener()
+     {
+       public void actionPerformed(ActionEvent e)
+@@ -2895,7 +2897,7 @@
+     });
+     showMenu.add(markInsertions);
+     menu.add(showMenu);
+-    
++
+     //
+     JMenu graphMenu = new JMenu("Graph");
+     JCheckBoxMenuItem checkBoxCoverage = new JCheckBoxMenuItem("Coverage", isCoverage);
+@@ -2905,9 +2907,9 @@
+       {
+         isCoverage = !isCoverage;
+         coveragePanel.setVisible(isCoverage);
+-        
+-        if( isCoverage && 
+-            !cbCoverageView.isSelected() && 
++
++        if( isCoverage &&
++            !cbCoverageView.isSelected() &&
+             !cbCoverageStrandView.isSelected() &&
+             !cbCoverageHeatMap.isSelected())
+           laststart = -1;
+@@ -2915,7 +2917,7 @@
+       }
+     });
+     graphMenu.add(checkBoxCoverage);
+-    
++
+     JCheckBoxMenuItem checkBoxSNP = new JCheckBoxMenuItem("SNP", isSNPplot);
+     checkBoxSNP.addActionListener(new ActionListener()
+     {
+@@ -2929,8 +2931,8 @@
+     });
+     graphMenu.add(checkBoxSNP);
+     menu.add(graphMenu);
+-    
+-    
++
++
+     if(feature_display != null)
+     {
+       final JCheckBoxMenuItem checkBoxSync =
+@@ -2944,15 +2946,15 @@
+       });
+       menu.add(checkBoxSync);
+     }
+-    
++
+     menu.add(new JSeparator());
+ 
+     JMenu maxHeightMenu = new JMenu("BamView Height");
+     menu.add(maxHeightMenu);
+-    
++
+     final String hgts[] =
+        {"500", "800", "1000", "1500", "2500", "5000", "50000"};
+-    
++
+     ButtonGroup bgroup = new ButtonGroup();
+     for(int i=0; i<hgts.length; i++)
+     {
+@@ -2972,12 +2974,12 @@
+         }
+       });
+     }
+-    
++
+     menu.add(new JSeparator());
+     logMenuItem.setFont(menu.getFont());
+     menu.add(logMenuItem);
+     logMenuItem.setEnabled(isIsizeStackView());
+-    
++
+     logMenuItem.addActionListener(new ActionListener()
+     {
+       public void actionPerformed(ActionEvent e)
+@@ -2986,7 +2988,7 @@
+         repaint();
+       }
+     });
+-    
++
+     final JMenuItem readGroupsMenu = new JMenuItem("Read Groups ...");
+     readGroupsMenu.addActionListener(new ActionListener(){
+       public void actionPerformed(ActionEvent arg0)
+@@ -2996,7 +2998,7 @@
+       }
+     });
+     menu.add(readGroupsMenu);
+-    
++
+     JMenuItem filter = new JMenuItem("Filter Reads ...");
+     menu.add(filter);
+     filter.addActionListener(new ActionListener()
+@@ -3007,9 +3009,9 @@
+           filterFrame = new SAMRecordFilter(BamView.this);
+         else
+           filterFrame.setVisible(true);
+-      } 
++      }
+     });
+-      
++
+     JMenuItem maxReadCoverage = new JMenuItem("Read Coverage Threshold ...");
+     menu.add(maxReadCoverage);
+     maxReadCoverage.addActionListener(new ActionListener()
+@@ -3018,7 +3020,7 @@
+       {
+         final TextFieldInt maxRead = new TextFieldInt();
+         maxRead.setValue(MAX_COVERAGE);
+-        int status = JOptionPane.showConfirmDialog(null, maxRead, 
++        int status = JOptionPane.showConfirmDialog(null, maxRead,
+             "Read Coverage Threshold", JOptionPane.OK_CANCEL_OPTION);
+         if(status == JOptionPane.OK_OPTION &&
+            maxRead.getValue() != MAX_COVERAGE)
+@@ -3029,9 +3031,9 @@
+           laststart = -1;
+           repaint();
+         }
+-      } 
++      }
+     });
+-    
++
+     JMenuItem readList = new JMenuItem("List Reads ...");
+     menu.add(readList);
+     readList.addActionListener(new ActionListener()
+@@ -3048,7 +3050,7 @@
+       public void actionPerformed(ActionEvent e)
+       {
+         openBamView(new Vector<String>(bamList));
+-      } 
++      }
+     });
+     menu.add(new JSeparator());
+     menu.add(bamSplitter);
+@@ -3060,14 +3062,14 @@
+     viewMenu.add(new JSeparator());
+     viewMenu.add(coverageMenu);
+   }
+-  
++
+   private ReadGroupsFrame getReadGroupFrame()
+   {
+     if(readGrpFrame == null)
+       readGrpFrame = new ReadGroupsFrame(readGroups, BamView.this);
+     return readGrpFrame;
+   }
+-  
++
+   private JComponent bamTopPanel(final JFrame frame)
+   {
+     final JComponent topPanel;
+@@ -3075,13 +3077,13 @@
+     {
+       topPanel = new JPanel(new FlowLayout(FlowLayout.LEADING, 0, 0));
+       if(feature_display != null)
+-        this.selection = feature_display.getSelection(); 
++        this.selection = feature_display.getSelection();
+     }
+     else
+-    { 
++    {
+       topPanel = new JMenuBar();
+       frame.setJMenuBar((JMenuBar)topPanel);
+-      
++
+       JMenu fileMenu = new JMenu("File");
+       topPanel.add(fileMenu);
+ 
+@@ -3093,21 +3095,21 @@
+         {
+           String[] s = { "NEW-BAMVIEW" };
+           BamView.main(s);
+-        } 
++        }
+       });
+-      
+-      
++
++
+       JMenuItem saveAs = new JMenuItem("Save As Image File (png/jpeg/svg) ...");
+       fileMenu.add(saveAs);
+       saveAs.addActionListener(new ActionListener()
+       {
+         public void actionPerformed(ActionEvent e)
+         {
+-          PrintBamView.print((JPanel)mainPanel.getParent()); 
++          PrintBamView.print((JPanel)mainPanel.getParent());
+         }
+       });
+ 
+-      
++
+       JMenuItem close = new JMenuItem("Close");
+       fileMenu.add(close);
+       close.addActionListener(new ActionListener()
+@@ -3116,13 +3118,13 @@
+         {
+           BamView.this.setVisible(false);
+           Component comp = BamView.this;
+-          
++
+           while( !(comp instanceof JFrame) )
+             comp = comp.getParent();
+           ((JFrame)comp).dispose();
+-        } 
++        }
+       });
+-      
++
+       JMenuItem exit = new JMenuItem("Exit");
+       fileMenu.add(new JSeparator());
+       fileMenu.add(exit);
+@@ -3130,15 +3132,15 @@
+       {
+         public void actionPerformed(ActionEvent e)
+         {
+-          int status = JOptionPane.showConfirmDialog(BamView.this, 
+-              "Exit BamView?", "Exit", 
++          int status = JOptionPane.showConfirmDialog(BamView.this,
++              "Exit BamView?", "Exit",
+               JOptionPane.OK_CANCEL_OPTION);
+           if(status != JOptionPane.OK_OPTION)
+             return;
+           System.exit(0);
+-        } 
++        }
+       });
+-      
++
+       addKeyListener(new KeyAdapter()
+       {
+         public void keyPressed(final KeyEvent event)
+@@ -3159,13 +3161,13 @@
+         }
+       });
+     }
+-    
++
+     if(seqNames.size() > 1)
+     {
+       int len = 0;
+       for(int i=0; i<seqNames.size(); i++)
+         len += seqLengths.get(seqNames.get(i));
+-      
++
+       if(feature_display != null &&
+          len == feature_display.getSequenceLength())
+         concatSequences = true;
+@@ -3183,7 +3185,7 @@
+       {
+         handleCanvasMouseDrag(event);
+       }
+-      
++
+       public void mouseMoved(MouseEvent e)
+       {
+         lastMousePoint = e.getPoint();
+@@ -3197,13 +3199,13 @@
+         else
+         {
+           if (buttonAutoHide.isSelected() && topPanel.isVisible())
+-            topPanel.setVisible(false); 
++            topPanel.setVisible(false);
+         }
+       }
+     };
+     addMouseMotionListener(mouseMotionListener);
+ 
+-    
++
+     combo = new SequenceComboBox(seqNames){
+       private static final long serialVersionUID = 1L;
+       public void update(IndexReferenceEvent event)
+@@ -3269,10 +3271,10 @@
+       });
+       topPanel.add(zoomOut);
+     }
+-    
++
+     topPanel.add(buttonAutoHide);
+-    
+-    
++
++
+     final JSlider slider = new JSlider(13, 52, (int) (readLnHgt*10));
+     slider.addChangeListener(new ChangeListener(){
+       public void stateChanged(ChangeEvent arg0)
+@@ -3283,7 +3285,7 @@
+     });
+     topPanel.add(new JLabel(" Read Height:"));
+     topPanel.add(slider);
+-    
++
+     if(feature_display != null)
+     {
+       JButton close = new JButton("Close");
+@@ -3292,17 +3294,17 @@
+       {
+         public void actionPerformed(ActionEvent e)
+         {
+-          int status = JOptionPane.showConfirmDialog(frame, 
+-              "Close the BAM panel?", "Close", 
++          int status = JOptionPane.showConfirmDialog(frame,
++              "Close the BAM panel?", "Close",
+               JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE);
+           if(status == JOptionPane.CANCEL_OPTION)
+             return;
+-          
++
+           final JPanel containerPanel = (JPanel) mainPanel.getParent();
+           feature_display.removeDisplayAdjustmentListener(BamView.this);
+           feature_display.getSelection().removeSelectionChangeListener(BamView.this);
+           containerPanel.remove(mainPanel);
+-          
++
+           if(containerPanel.getComponentCount() > 0)
+             containerPanel.revalidate();
+           else
+@@ -3317,26 +3319,26 @@
+     }
+     return topPanel;
+   }
+-  
++
+   public void setVisible(boolean visible)
+   {
+     super.setVisible(visible);
+     mainPanel.setVisible(visible);
+   }
+-  
++
+   private void setViewportMidPoint()
+   {
+     Point p = jspView.getViewport().getLocation();
+     p.y = (getHeight() - jspView.getViewport().getViewRect().height)/2;
+     jspView.getViewport().setViewPosition(p);
+   }
+-  
++
+   private void setViewportBtm()
+   {
+     jspView.getVerticalScrollBar().setValue(
+         jspView.getVerticalScrollBar().getMaximum());
+   }
+-  
++
+   protected int getBaseAtStartOfView()
+   {
+     if(feature_display != null)
+@@ -3344,7 +3346,7 @@
+     else
+       return scrollBar.getValue();
+   }
+-  
++
+   /**
+    * Set the panel size based on the number of bases visible
+    * and repaint.
+@@ -3354,14 +3356,14 @@
+   {
+     int startValue = getBaseAtStartOfView();
+     this.nbasesInView = nbasesInView;
+-    float pixPerBase = getPixPerBaseByWidth(); 
++    float pixPerBase = getPixPerBaseByWidth();
+ 
+     if(isBaseAlignmentView(pixPerBase))
+     {
+       pixPerBase = ALIGNMENT_PIX_PER_BASE;
+       this.nbasesInView = (int)(mainPanel.getWidth()/pixPerBase);
+       jspView.getVerticalScrollBar().setValue(0);
+-      
++
+       if(ruler == null)
+         ruler = new Ruler();
+       jspView.setColumnHeaderView(ruler);
+@@ -3395,14 +3397,14 @@
+ 
+     if(scrollBar != null)
+     {
+-      scrollBar.setValues(startValue, nbasesInView, 1, 
++      scrollBar.setValues(startValue, nbasesInView, 1,
+              getMaxBasesInPanel(getSequenceLength()));
+       scrollBar.setUnitIncrement(nbasesInView/20);
+       scrollBar.setBlockIncrement(nbasesInView);
+     }
+   }
+ 
+-  
++
+   /**
+    * Set the start and end base positions to display.
+    * @param start
+@@ -3428,32 +3430,32 @@
+       else
+         pixPerBase = feature_display.getWidth()/(float)(end-start+1);
+     }
+-    
++
+     Dimension d = new Dimension();
+     d.setSize(nbasesInView*pixPerBase, maxHeight);
+     setPreferredSize(d);
+-    
++
+     if(event == null)
+     {
+       this.startBase = -1;
+       this.endBase   = -1;
+     }
+   }
+-  
++
+   /**
+-   * Return an Artemis entry from a file 
++   * Return an Artemis entry from a file
+    * @param entryFileName
+    * @param entryGroup
+    * @return
+    * @throws NoSequenceException
+    */
+-  private Entry getEntry(final String entryFileName, final EntryGroup entryGroup) 
++  private Entry getEntry(final String entryFileName, final EntryGroup entryGroup)
+                    throws NoSequenceException
+   {
+     final Document entry_document = DocumentFactory.makeDocument(entryFileName);
+     final EntryInformation artemis_entry_information =
+       Options.getArtemisEntryInformation();
+-    
++
+     //System.out.println(entryFileName);
+     final uk.ac.sanger.artemis.io.Entry new_embl_entry =
+       EntryFileDialog.getEntryFromFile(null, entry_document,
+@@ -3468,7 +3470,7 @@
+     {
+       if(entryGroup.getSequenceEntry() != null)
+         bases = entryGroup.getSequenceEntry().getBases();
+-      
++
+       if(bases == null)
+       {
+         entry = new Entry(new_embl_entry);
+@@ -3476,10 +3478,10 @@
+       }
+       else
+         entry = new Entry(bases,new_embl_entry);
+-      
++
+       entryGroup.add(entry);
+-    } 
+-    catch(OutOfRangeException e) 
++    }
++    catch(OutOfRangeException e)
+     {
+       new MessageDialog(null, "read failed: one of the features in " +
+           entryFileName + " has an out of range " +
+@@ -3487,7 +3489,7 @@
+     }
+     return entry;
+   }
+-  
++
+   private boolean isShowScale()
+   {
+     return (feature_display == null ? true : false);
+@@ -3497,29 +3499,29 @@
+   {
+     return jspView;
+   }
+-  
++
+   /**
+    *  Handle a mouse drag event on the drawing canvas.
+    **/
+   private void handleCanvasMouseDrag(final MouseEvent event)
+   {
+-    if(event.getButton() == MouseEvent.BUTTON3 || bases == null) 
++    if(event.getButton() == MouseEvent.BUTTON3 || bases == null)
+       return;
+-    
++
+     highlightSAMRecord = null;
+     if(event.getClickCount() > 1)
+     {
+       getSelection().clear();
+       repaint();
+-      return;  
++      return;
+     }
+-    
+-    highlightRange(event, 
++
++    highlightRange(event,
+         MouseEvent.BUTTON1_DOWN_MASK & MouseEvent.BUTTON2_DOWN_MASK);
+   }
+-  
++
+   /**
+-   * 
++   *
+    * @param event
+    * @param onmask
+    */
+@@ -3528,17 +3530,17 @@
+     int seqLength = getSequenceLength();
+     float pixPerBase = getPixPerBaseByWidth();
+     int start = (int) ( ( (event.getPoint().getX())/pixPerBase) + getBaseAtStartOfView() );
+-    
++
+     if(start < 1)
+       start = 1;
+     if(start > seqLength)
+       start = seqLength;
+-    
++
+     if (dragStart < 0 && (event.getModifiersEx() & onmask) == onmask)
+       dragStart = start;
+     else if((event.getModifiersEx() & onmask) != onmask)
+       dragStart = -1;
+-    
++
+     MarkerRange drag_range;
+     try
+     {
+@@ -3554,7 +3556,7 @@
+       e.printStackTrace();
+     }
+   }
+-  
++
+   /**
+    * Get the colour for the given read given to it by the coverage plot.
+    * @param samRecord
+@@ -3565,60 +3567,60 @@
+     short fileIndex = 0;
+     if(bamList.size()>1)
+       fileIndex = samRecord.bamIndex;
+-    return getColourByCoverageColour(fileIndex); 
++    return getColourByCoverageColour(fileIndex);
+   }
+-  
++
+   private Color getColourByCoverageColour(final short fileIndex)
+   {
+     LineAttributes lines[] = CoveragePanel.getLineAttributes(bamList.size());
+-    return lines[fileIndex].getLineColour(); 
++    return lines[fileIndex].getLineColour();
+   }
+-  
++
+ 
+   protected int getMaxBases()
+   {
+     return MAX_BASES;
+   }
+-  
++
+   protected void setMaxBases(int max)
+   {
+     MAX_BASES = max;
+   }
+-  
++
+   private boolean isStackView()
+   {
+-    return cbStackView.isSelected();  
++    return cbStackView.isSelected();
+   }
+-  
++
+   private boolean isPairedStackView()
+   {
+     return cbPairedStackView.isSelected();
+   }
+-  
++
+   private boolean isStrandStackView()
+   {
+     return cbStrandStackView.isSelected();
+   }
+-  
++
+   private boolean isCoverageView(float pixPerBase)
+   {
+     if(isBaseAlignmentView(pixPerBase))
+       return false;
+     return cbCoverageView.isSelected() || cbCoverageStrandView.isSelected() || cbCoverageHeatMap.isSelected();
+   }
+-  
++
+   private boolean isIsizeStackView()
+   {
+     return cbIsizeStackView.isSelected();
+   }
+-  
++
+   private boolean isBaseAlignmentView(float pixPerBase)
+   {
+     if(pixPerBase*1.08f >= ALIGNMENT_PIX_PER_BASE)
+       return true;
+     return false;
+   }
+-  
++
+   private JCheckBoxMenuItem getSelectedCheckBoxMenuItem()
+   {
+     if(isStackView())
+@@ -3635,37 +3637,37 @@
+       return cbCoverageHeatMap;
+     return cbCoverageStrandView;
+   }
+-  
++
+   protected Selection getSelection()
+   {
+     return selection;
+   }
+-  
++
+   protected List<BamViewRecord> getReadsInView()
+   {
+     return readsInView;
+   }
+-  
++
+   protected int getBasesInView()
+   {
+     return nbasesInView;
+   }
+-  
++
+   protected void setHighlightSAMRecord(BamViewRecord highlightSAMRecord)
+   {
+     this.highlightSAMRecord = highlightSAMRecord;
+   }
+-  
++
+   protected BamViewRecord getHighlightSAMRecord()
+   {
+     return highlightSAMRecord;
+   }
+-  
++
+   protected FeatureDisplay getFeatureDisplay()
+   {
+     return feature_display;
+   }
+-  
++
+   /**
+    * @return the combo
+    */
+@@ -3673,27 +3675,27 @@
+   {
+     return combo;
+   }
+-  
+-  protected Hashtable<String, SAMFileReader>  getSamFileReaderHash()
++
++  protected Hashtable<String, SamReader>  getSamReaderHash()
+   {
+-    return samFileReaderHash;
++    return samReaderHash;
+   }
+-  
++
+   protected Vector<String> getSeqNames()
+   {
+     return seqNames;
+   }
+-  
++
+   protected HashMap<String, Integer> getSeqLengths()
+   {
+     return seqLengths;
+   }
+-  
++
+   protected HashMap<String, Integer> getOffsetLengths()
+   {
+     return offsetLengths;
+   }
+-  
++
+   private String getVersion()
+   {
+     final ClassLoader cl = this.getClass().getClassLoader();
+@@ -3715,13 +3717,13 @@
+     }
+     return null;
+   }
+-  
++
+   /**
+    * Open another BamView window
+    */
+   public void openBamView(final List<String> bamsList)
+   {
+-    BamView bamView = new BamView(bamsList, 
++    BamView bamView = new BamView(bamsList,
+         null, nbasesInView, entry_edit,
+         feature_display, bases, (JPanel) mainPanel.getParent(), null);
+     bamView.getJspView().getVerticalScrollBar().setValue(
+@@ -3735,10 +3737,10 @@
+     {
+       feature_display.addDisplayAdjustmentListener(bamView);
+       feature_display.getSelection().addSelectionChangeListener(bamView);
+-      
++
+       if(entry_edit != null)
+         entry_edit.getOneLinePerEntryDisplay().addDisplayAdjustmentListener(bamView);
+-      if(feature_display.getEntryGroup().getSequenceEntry().getEMBLEntry().getSequence() 
++      if(feature_display.getEntryGroup().getSequenceEntry().getEMBLEntry().getSequence()
+           instanceof uk.ac.sanger.artemis.io.IndexFastaStream)
+       {
+         if(entry_edit != null)
+@@ -3750,7 +3752,7 @@
+       }
+     }
+   }
+-  
++
+   /**
+    * Artemis event notification
+    */
+@@ -3758,8 +3760,8 @@
+   {
+     if(event.getType() == DisplayAdjustmentEvent.REV_COMP_EVENT &&
+        event.isRevCompDisplay())
+-      JOptionPane.showMessageDialog(this, 
+-          "Flipping the display is not supported by BamView.", "Warning", 
++      JOptionPane.showMessageDialog(this,
++          "Flipping the display is not supported by BamView.", "Warning",
+           JOptionPane.WARNING_MESSAGE);
+ 
+     if(!asynchronous)
+@@ -3768,7 +3770,7 @@
+       displayAdjustmentWork(event);
+       return;
+     }
+-    
++
+     SwingWorker worker = new SwingWorker()
+     {
+       public Object construct()
+@@ -3781,13 +3783,13 @@
+         {
+           e.printStackTrace();
+         }
+-        
++
+         if(event.getStart() != ((FeatureDisplay)event.getSource()).getForwardBaseAtLeftEdge())
+         {
+           waitingFrame.showWaiting("waiting...", mainPanel);
+           return null;
+         }
+-      
++
+         displayAdjustmentWork(event);
+         waitingFrame.setVisible(false);
+         return null;
+@@ -3795,7 +3797,7 @@
+     };
+     worker.start();
+   }
+-  
++
+   /**
+    * Carry out the display agjustment event action.
+    * @param event
+@@ -3815,17 +3817,17 @@
+     }
+     else
+     {
+-      setDisplay(event.getStart(), 
++      setDisplay(event.getStart(),
+         event.getStart()+feature_display.getMaxVisibleBases(), event);
+       repaint();
+     }
+   }
+-  
++
+   public void selectionChanged(SelectionChangeEvent event)
+   {
+     repaint();
+   }
+-  
++
+   private class Ruler extends JPanel
+   {
+     private static final long serialVersionUID = 1L;
+@@ -3858,14 +3860,14 @@
+         int xpos = (i-start)*ALIGNMENT_PIX_PER_BASE;
+         g2.drawString(Integer.toString(i), xpos, ypos);
+       }
+-        
++
+       for(int i=startMark; i<end; i+=10)
+       {
+         int xpos = (i-start)*ALIGNMENT_PIX_PER_BASE;
+         xpos+=(ALIGNMENT_PIX_PER_BASE/2);
+         g2.drawLine(xpos, ypos+1, xpos, ypos+5);
+       }
+-      
++
+       if(refSeq != null)
+       {
+         ypos+=15;
+@@ -3880,7 +3882,7 @@
+       }
+     }
+   }
+-  
++
+   /**
+   * Popup menu listener
+   */
+@@ -3890,17 +3892,17 @@
+ 	private JMenuItem showDetails;
+ 	private JMenu coverageMenu;
+ 	private JMenuItem createGroup;
+-	
++
+     public void mouseClicked(MouseEvent e)
+     {
+       if(e.isPopupTrigger() ||
+          e.getButton() == MouseEvent.BUTTON3)
+         return;
+-      
++
+       BamView.this.requestFocus();
+-      
++
+       if(e.getClickCount() > 1)
+-        getSelection().clear(); 
++        getSelection().clear();
+       else if(e.getButton() == MouseEvent.BUTTON1)
+       {
+         if(isCoverageView(getPixPerBaseByWidth()))
+@@ -3913,7 +3915,7 @@
+         highlightRange(e, MouseEvent.BUTTON2_DOWN_MASK);
+       repaint();
+     }
+-    
++
+     public void mousePressed(MouseEvent e)
+     {
+       maybeShowPopup(e);
+@@ -3928,7 +3930,7 @@
+     private void maybeShowPopup(MouseEvent e)
+     {
+       if(e.isPopupTrigger())
+-      {       
++      {
+         //
+         // main menu options
+         if(popup == null)
+@@ -3947,11 +3949,11 @@
+           {
+             coverageMenu = new JMenu("Coverage HeatMap");
+             coverageView.createMenus(coverageMenu);
+-            
++
+             final JCheckBoxMenuItem coverageGrid = new JCheckBoxMenuItem("Show heatmap grid", false);
+             coverageGrid.addActionListener(new ActionListener()
+             {
+-              public void actionPerformed(ActionEvent e) 
++              public void actionPerformed(ActionEvent e)
+               {
+                 coverageView.showLabels(coverageGrid.isSelected());
+               }
+@@ -3962,7 +3964,7 @@
+             createGroup.addActionListener(new ActionListener()
+             {
+               private int n = 1;
+-              public void actionPerformed(ActionEvent e) 
++              public void actionPerformed(ActionEvent e)
+               {
+                 String groupName = "group_"+n;
+                 groupsFrame.addGroup(groupName);
+@@ -3984,7 +3986,7 @@
+         if(showDetails != null)
+           popup.remove(showDetails);
+ 
+-        if( mouseOverSAMRecord != null && 
++        if( mouseOverSAMRecord != null &&
+             mouseOverSAMRecord.sam.getReadPairedFlag() &&
+            !mouseOverSAMRecord.sam.getMateUnmappedFlag() )
+         {
+@@ -3993,7 +3995,7 @@
+               thisSAMRecord.sam.getReadName());
+           gotoMateMenuItem.addActionListener(new ActionListener()
+           {
+-			public void actionPerformed(ActionEvent e) 
++			public void actionPerformed(ActionEvent e)
+ 			{
+ 			  String name = thisSAMRecord.sam.getMateReferenceName();
+ 			  if(name.equals("="))
+@@ -4006,13 +4008,13 @@
+ 			    scrollBar.setValue(
+ 			        thisSAMRecord.sam.getMateAlignmentStart()+offset-
+ 			        (nbasesInView/2));
+-			  
+-			  highlightSAMRecord = thisSAMRecord; 
+-			}  
++
++			  highlightSAMRecord = thisSAMRecord;
++			}
+           });
+           popup.add(gotoMateMenuItem);
+-        }  
+-          
++        }
++
+         if( mouseOverSAMRecord != null)
+         {
+           final BamViewRecord thisSAMRecord = mouseOverSAMRecord;
+@@ -4020,7 +4022,7 @@
+               thisSAMRecord.sam.getReadName());
+           showDetails.addActionListener(new ActionListener()
+           {
+-            public void actionPerformed(ActionEvent e) 
++            public void actionPerformed(ActionEvent e)
+             {
+               openFileViewer(thisSAMRecord.sam, getMate(thisSAMRecord), bamList);
+             }
+@@ -4032,16 +4034,16 @@
+       }
+     }
+   }
+-  
++
+   protected static void openFileViewer(SAMRecord readRecord, SAMRecord mateRecord, List<String> bamList)
+   {
+     FileViewer viewDetail = new FileViewer(readRecord.getReadName(), true, false, false);
+     appendToDetailView(readRecord, mateRecord, viewDetail, bamList);
+   }
+-  
+-  private static void appendToDetailView(final SAMRecord sam, 
+-                                         final SAMRecord mate, 
+-                                         final FileViewer viewer, 
++
++  private static void appendToDetailView(final SAMRecord sam,
++                                         final SAMRecord mate,
++                                         final FileViewer viewer,
+                                          final List<String> bamList)
+   {
+     if(bamList.size() > 1 && sam.getAttribute("FL") != null)
+@@ -4050,7 +4052,7 @@
+       if(bamIdx < bamList.size())
+         viewer.appendString("File                  "+bamList.get(bamIdx)+"\n\n", Level.INFO);
+     }
+-    
++
+     viewer.appendString("Read Name             "+sam.getReadName()+"\n", Level.INFO);
+     viewer.appendString("Coordinates           "+sam.getAlignmentStart()+".."+
+                                                  sam.getAlignmentEnd()+"\n", Level.DEBUG);
+@@ -4063,9 +4065,9 @@
+     viewer.appendString("Cigar String          "+sam.getCigarString()+"\n", Level.DEBUG);
+     viewer.appendString("Strand                "+
+         (sam.getReadNegativeStrandFlag() ? "-\n\n" : "+\n\n"), Level.DEBUG);
+-    
++
+     if(sam.getReadPairedFlag())
+-    {     
++    {
+       if(mate != null)
+       {
+         viewer.appendString("Mate Coordinates      "+mate.getAlignmentStart()+".."+
+@@ -4088,7 +4090,7 @@
+     viewer.appendString("\n\nFlags:", Level.INFO);
+     viewer.appendString("\nDuplicate Read    "+
+         (sam.getDuplicateReadFlag() ? "yes" : "no"), Level.DEBUG);
+-    
++
+     viewer.appendString("\nRead Paired       "+
+         (sam.getReadPairedFlag() ? "yes" : "no"), Level.DEBUG);
+     if(sam.getReadPairedFlag())
+@@ -4096,7 +4098,7 @@
+       viewer.appendString("\nFirst of Pair     "+
+         (sam.getFirstOfPairFlag() ? "yes" : "no"), Level.DEBUG);
+       viewer.appendString("\nMate Unmapped     "+
+-        (sam.getMateUnmappedFlag() ? "yes" : "no"), Level.DEBUG);  
++        (sam.getMateUnmappedFlag() ? "yes" : "no"), Level.DEBUG);
+       viewer.appendString("\nProper Pair       "+
+         (sam.getProperPairFlag() ? "yes" : "no"), Level.DEBUG);
+     }
+@@ -4104,22 +4106,22 @@
+         (sam.getReadFailsVendorQualityCheckFlag() ? "yes" : "no"), Level.DEBUG);
+     viewer.appendString("\nRead Unmapped     "+
+         (sam.getReadUnmappedFlag() ? "yes" : "no"), Level.DEBUG);
+-    
++
+     if(sam.getReadPairedFlag())
+       viewer.appendString("\nSecond Of Pair    "+
+         (sam.getSecondOfPairFlag() ? "yes" : "no"), Level.DEBUG);
+-    
++
+     viewer.appendString("\n\nRead Bases:\n", Level.INFO);
+     wrapReadBases(sam, viewer);
+-    
++
+     if(sam.getReadPairedFlag() && mate != null)
+     {
+       viewer.appendString("\nMate Read Bases:\n", Level.INFO);
+       wrapReadBases(mate, viewer);
+     }
+   }
+-  
+-  private static void wrapReadBases(final SAMRecord sam, 
++
++  private static void wrapReadBases(final SAMRecord sam,
+                              final FileViewer viewer)
+   {
+     final String seq = new String(sam.getReadBases());
+@@ -4142,15 +4144,15 @@
+   {
+     if(!thisSAMRecord.sam.getReadPairedFlag())  // read is not paired in sequencing
+       return null;
+-    
++
+     SAMRecord mate = null;
+     try
+     {
+       short fileIndex = 0;
+       if(bamList.size()>1 && thisSAMRecord.bamIndex > 0)
+         fileIndex = thisSAMRecord.bamIndex;
+-      String bam = bamList.get(fileIndex);  
+-      final SAMFileReader inputSam = getSAMFileReader(bam);
++      String bam = bamList.get(fileIndex);
++      final SamReader inputSam = getSamReader(bam);
+       mate = inputSam.queryMate(thisSAMRecord.sam);
+     }
+     catch (Exception e)
+@@ -4160,7 +4162,7 @@
+     }
+     return mate;
+   }
+-  
++
+   protected SAMRecordPredicate getSamRecordFlagPredicate()
+   {
+     return samRecordFlagPredicate;
+@@ -4173,7 +4175,7 @@
+     lastend = -1;
+     this.samRecordFlagPredicate = samRecordFlagPredicate;
+   }
+-  
++
+   protected SAMRecordMapQPredicate getSamRecordMapQPredicate()
+   {
+     return samRecordMapQPredicate;
+@@ -4186,7 +4188,7 @@
+     lastend = -1;
+     this.samRecordMapQPredicate = samRecordMapQPredicate;
+   }
+-  
++
+   /**
+    * @return the concatSequences
+    */
+@@ -4200,7 +4202,7 @@
+     BamViewRecord sam1;
+     BamViewRecord sam2;
+   }
+-  
++
+   class CreateFeatures
+   {
+     CreateFeatures(final GroupBamFrame groupsFrame)
+@@ -4208,36 +4210,36 @@
+       final TextFieldInt threshold = new TextFieldInt();
+       final TextFieldInt minSize = new TextFieldInt();
+       final TextFieldInt minBams = new TextFieldInt();
+-      
++
+       threshold.setValue(6);
+       minSize.setValue(6);
+       minBams.setValue( (groupsFrame.getNumberOfGroups() == 1 ?
+           bamList.size() : groupsFrame.getMaximumBamsInGroup()) );
+-      
++
+       final JPanel gridPanel = new JPanel(new GridBagLayout());
+       GridBagConstraints c = new GridBagConstraints();
+       c.anchor = GridBagConstraints.WEST;
+       c.fill = GridBagConstraints.HORIZONTAL;
+       c.gridx = 0;
+       c.gridy = 0;
+-      
++
+       gridPanel.add(new JLabel("Minimum number of reads:"), c);
+       c.gridy++;
+       gridPanel.add(threshold, c);
+-      
++
+       c.gridy++;
+       gridPanel.add(new JSeparator(), c);
+       c.gridy++;
+       gridPanel.add(new JLabel("Minimum number of BAMs for reads to be present in:"), c);
+       c.gridy++;
+       gridPanel.add(minBams, c);
+-      
++
+       JRadioButton useAllBams = new JRadioButton("out of all BAMs", (groupsFrame.getNumberOfGroups() == 1));
+       JRadioButton useGroup = new JRadioButton("within a group", (groupsFrame.getNumberOfGroups() != 1));
+-      
++
+       if(groupsFrame.getNumberOfGroups() == 1)
+         useGroup.setEnabled(false);
+-      
++
+       final ButtonGroup group = new ButtonGroup();
+       group.add(useAllBams);
+       group.add(useGroup);
+@@ -4262,15 +4264,15 @@
+       gridPanel.add(cbOpposite, c);
+ 
+       int status =
+-          JOptionPane.showConfirmDialog(feature_display, gridPanel, 
++          JOptionPane.showConfirmDialog(feature_display, gridPanel,
+               "Options", JOptionPane.OK_CANCEL_OPTION);
+       if(status == JOptionPane.CANCEL_OPTION)
+         return;
+-      
++
+       if(!useGroup.isSelected() && minBams.getValue() > bamList.size())
+       {
+         status =
+-            JOptionPane.showConfirmDialog(feature_display, 
++            JOptionPane.showConfirmDialog(feature_display,
+                 "The minimum number of BAMs setting can not be\n"+
+                 "greater than the total number of BAM files.\n"+
+                 "Set this to the number of BAMs (i.e. "+bamList.size()+").",
+@@ -4282,7 +4284,7 @@
+       else if(useGroup.isSelected() && minBams.getValue() > groupsFrame.getMaximumBamsInGroup())
+       {
+         status =
+-            JOptionPane.showConfirmDialog(feature_display, 
++            JOptionPane.showConfirmDialog(feature_display,
+                 "Minimum number of BAMs setting can not be greater than\n"+
+                 "the total number of BAM files found in any of the groups.\n"+
+                 "Set this to the greatest number of BAM files in any\n"+
+@@ -4294,11 +4296,11 @@
+       }
+ 
+       new MappedReads(BamView.this,
+-          (useGroup.isSelected() ? groupsFrame : null), threshold.getValue(), 
++          (useGroup.isSelected() ? groupsFrame : null), threshold.getValue(),
+           minSize.getValue(), minBams.getValue(), cbOpposite.isSelected(), true);
+     }
+   }
+- 
++
+   public static void main(String[] args)
+   {
+     BamFrame frame = new BamFrame();
+@@ -4312,7 +4314,7 @@
+       if(frame.getBamFile() != null)
+         args = new String[]{ frame.getBamFile() };
+     }
+-      
++
+     List<String> bam = new Vector<String>();
+     String reference = null;
+     if(args.length == 0 || args[0].equals("NEW-BAMVIEW"))
+@@ -4320,11 +4322,11 @@
+       System.setProperty("default_directory", System.getProperty("user.dir"));
+       FileSelectionDialog fileSelection = new FileSelectionDialog(
+           null, true, "BamView", "BAM");
+-      bam = fileSelection.getFiles(BAM_SUFFIX); 
++      bam = fileSelection.getFiles(BAM_SUFFIX);
+       reference = fileSelection.getReferenceFile();
+       if(reference == null || reference.equals(""))
+         reference = null;
+-      
++
+       if(bam == null || bam.size() < 1)
+       {
+         if(args.length > 0 && args[0].equals("NEW-BAMVIEW"))
+@@ -4345,7 +4347,7 @@
+     boolean covPlot     = false;
+     boolean snpPlot     = false;
+     int base = 0;
+-    
++
+     for(int i=0;i<args.length; i++)
+     {
+       if(args[i].equals("-a"))
+@@ -4379,9 +4381,9 @@
+       else if(args[i].equals("-ps"))
+         snpPlot = true;
+       else if(args[i].startsWith("-h"))
+-      { 
++      {
+         System.out.println("-h\t show help");
+-        
++
+         System.out.println("-a\t BAM/SAM file to display");
+         System.out.println("-r\t reference file (optional)");
+         System.out.println("-n\t number of bases to display in the view (optional)");
+@@ -4398,7 +4400,7 @@
+     final BamView view = new BamView(bam, reference, nbasesInView, null, null,
+         (JPanel)frame.getContentPane(), frame);
+     frame.setTitle("BamView v"+view.getVersion());
+-    
++
+     if(chr != null)
+       view.combo.setSelectedItem(chr);
+     if(vw != null)
diff --git a/debian/patches/series b/debian/patches/series
index 237ba3a..6b92b38 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,8 +1,7 @@
 class-path.patch
 jar-rules.patch
 test-classpath.patch
-CRAMReferenceSequenceFile.patch
-java-8-sort.patch
 picard-api-change.patch
 htsjdk-api-change.patch
+samreader.patch
 use-lang3.patch
diff --git a/debian/patches/test-classpath.patch b/debian/patches/test-classpath.patch
index 1d871ce..ef370f0 100644
--- a/debian/patches/test-classpath.patch
+++ b/debian/patches/test-classpath.patch
@@ -2,8 +2,8 @@ Description: Change CLASSPATH to use external jars in build-test.xml
 Author: Afif Elghraoui <afif at ghraoui.name>
 Forwarded: not-needed
 Last-Update: 2015-10-22
---- artemis.orig/test/build-test.xml
-+++ artemis/test/build-test.xml
+--- a/test/build-test.xml
++++ b/test/build-test.xml
 @@ -11,8 +11,6 @@
      <property name="build.compiler" value="modern" />
      <property name="classpath" value="." />

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/artemis.git



More information about the debian-med-commit mailing list