JAL-3949 - refactor logging from jalview.bin.Cache to jalview.bin.Console
[jalview.git] / src / jalview / io / vcf / VCFLoader.java
index b96de68..29b3004 100644 (file)
@@ -51,6 +51,7 @@ import htsjdk.variant.vcf.VCFInfoHeaderLine;
 import jalview.analysis.Dna;
 import jalview.api.AlignViewControllerGuiI;
 import jalview.bin.Cache;
+import jalview.bin.Console;
 import jalview.datamodel.DBRefEntry;
 import jalview.datamodel.GeneLociI;
 import jalview.datamodel.Mapping;
@@ -314,7 +315,7 @@ public class VCFLoader
     VCFHeaderLine headerLine = header.getOtherHeaderLine(VCFHeader.REFERENCE_KEY);
     if (headerLine == null)
     {
-      Cache.error("VCF reference header not found");
+      Console.error("VCF reference header not found");
       return null;
     }
     String ref = headerLine.getValue();
@@ -336,7 +337,7 @@ public class VCFLoader
     }
     else
     {
-      Cache.error("VCF reference not found: " + ref);
+      Console.error("VCF reference not found: " + ref);
     }
 
     return seq;
@@ -429,7 +430,7 @@ public class VCFLoader
   {
     if (reference == null)
     {
-      Cache.error("No VCF ##reference found, defaulting to "
+      Console.error("No VCF ##reference found, defaulting to "
               + DEFAULT_REFERENCE + ":" + DEFAULT_SPECIES);
       reference = DEFAULT_REFERENCE; // default to GRCh37 if not specified
     }
@@ -775,7 +776,7 @@ public class VCFLoader
     GeneLociI seqCoords = seq.getGeneLoci();
     if (seqCoords == null)
     {
-      Cache.warn(String.format(
+      Console.warn(String.format(
               "Can't query VCF for %s as chromosome coordinates not known",
               seq.getName()));
       return null;
@@ -790,7 +791,7 @@ public class VCFLoader
     // returned with the Ensembl sequence; todo: support aliases?
     if (!vcfSpecies.equalsIgnoreCase(species))
     {
-      Cache.warn("No VCF loaded to " + seq.getName()
+      Console.warn("No VCF loaded to " + seq.getName()
               + " as species not matched");
       return null;
     }
@@ -820,7 +821,7 @@ public class VCFLoader
               vcfAssembly);
       if (newRange == null)
       {
-        Cache.error(
+        Console.error(
                 String.format("Failed to map %s:%s:%s:%d:%d to %s", species,
                         chromosome, seqRef, range[0], range[1],
                         vcfAssembly));
@@ -920,7 +921,7 @@ public class VCFLoader
          */
         String msg = String.format("Error reading VCF for %s:%d-%d: %s ",
                 map.chromosome, vcfStart, vcfEnd,e.getLocalizedMessage());
-        Cache.error(msg);
+        Console.error(msg);
       }
     }
 
@@ -1382,7 +1383,7 @@ public class VCFLoader
     VCFInfoHeaderLine infoHeader = header.getInfoHeaderLine(infoId);
     if (infoHeader == null)
     {
-      Cache.error("Field " + infoId + " has no INFO header");
+      Console.error("Field " + infoId + " has no INFO header");
       return false;
     }
     VCFHeaderLineType infoType = infoHeader.getType();
@@ -1423,7 +1424,7 @@ public class VCFLoader
     if (!badData.contains(token))
     {
       badData.add(token);
-      Cache.error(String.format("Invalid VCF data at %s:%d %s=%s",
+      Console.error(String.format("Invalid VCF data at %s:%d %s=%s",
               variant.getContig(), variant.getStart(), infoId, value));
     }
   }