From a536813c739993bcf230dd4e9e6f3ab6fb39ee4b Mon Sep 17 00:00:00 2001
From: tjc <tjc@ee4ac58c-ac51-4696-9907-e4b3aa274f04>
Date: Tue, 30 Nov 2010 11:07:42 +0000
Subject: [PATCH] test for BCF file format

git-svn-id: svn+ssh://svn.internal.sanger.ac.uk/repos/svn/pathsoft/artemis/trunk@15132 ee4ac58c-ac51-4696-9907-e4b3aa274f04
---
 .../artemis/components/variant/VCFview.java     | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/uk/ac/sanger/artemis/components/variant/VCFview.java b/uk/ac/sanger/artemis/components/variant/VCFview.java
index e27a8534f..7d679d162 100644
--- a/uk/ac/sanger/artemis/components/variant/VCFview.java
+++ b/uk/ac/sanger/artemis/components/variant/VCFview.java
@@ -604,11 +604,20 @@ public class VCFview extends JPanel
     buff.append(fileName+"\n");
     try
     {
-      FileInputStream fileStream = new FileInputStream(fileName);
-      BlockCompressedInputStream inputStrean = new BlockCompressedInputStream(fileStream);
+      if(IOUtils.isBCF(fileName))
+      {
+        JOptionPane.showMessageDialog(null, 
+            "Looks like a BCF formated file.\n"+
+            "Convert to VCF and use bgzip and tabix\n"+
+            "to compress and index respectively.", 
+            "Unsupported Format", 
+            JOptionPane.WARNING_MESSAGE);
+      }
       
+      BlockCompressedInputStream is = 
+        new BlockCompressedInputStream(new FileInputStream(fileName));
       String line;
-      while( (line = TabixReader.readLine(inputStrean) ) != null )
+      while( (line = TabixReader.readLine(is) ) != null )
       {
         if(!line.startsWith("##"))
           break;
@@ -1495,7 +1504,7 @@ public class VCFview extends JPanel
       System.setProperty("default_directory", System.getProperty("user.dir"));
       FileSelectionDialog fileSelection = new FileSelectionDialog(
           null, true, "VCFview", "VCF");
-      vcfFileList = fileSelection.getFiles(".vcf");
+      vcfFileList = fileSelection.getFiles(".*\\.[bv]{1}cf(\\.gz)*$");
       reference = fileSelection.getReferenceFile();
       if(reference.equals(""))
         reference = null;
-- 
GitLab