From 3d014d08ad92de78864fad1c44e37bc9677547f0 Mon Sep 17 00:00:00 2001
From: tcarver <tjc>
Date: Thu, 18 Apr 2013 10:49:38 +0100
Subject: [PATCH] fix for colour by strand option when XS tag is missing

---
 uk/ac/sanger/artemis/components/alignment/BamView.java | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/uk/ac/sanger/artemis/components/alignment/BamView.java b/uk/ac/sanger/artemis/components/alignment/BamView.java
index e49f1af9e..7c04ed884 100644
--- a/uk/ac/sanger/artemis/components/alignment/BamView.java
+++ b/uk/ac/sanger/artemis/components/alignment/BamView.java
@@ -1490,7 +1490,9 @@ public class BamView extends JPanel
       {
         if(colourByStrandTag.isSelected())
         {
-          if( ((Character)samRecord.getAttribute("XS")).equals('+') )
+          if(samRecord.getAttribute("XS") == null)
+            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);
@@ -1602,7 +1604,9 @@ public class BamView extends JPanel
         {
           if(colourByStrandTag.isSelected())
           {
-            if( ((Character)samRecord.getAttribute("XS")).equals('+') )
+            if(samRecord.getAttribute("XS") == null)
+              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);
-- 
GitLab