Repository: opencb/opencga
Issue: OpenCGA fails to parse NC_007605 contigs.

Our samples contain Human herpesvirus 4 complete wild type genome (NC_007605) [1] for QC purpose. OpenCGA fails to parse gVCF files with it. Exception [2] is below and pull request will follow.

[1] https://www.ncbi.nlm.nih.gov/nuccore/82503188

[2]

```
Caused by: org.opencb.opencga.storage.core.exceptions.StorageEngineException: Error while Transforming file /path/to/g.vcf.gz into /path/to/g.vcf.gz.variants.proto.gz
	at org.opencb.opencga.storage.hadoop.variant.AbstractHadoopVariantStoragePipeline.processProto(AbstractHadoopVariantStoragePipeline.java:267)
	at org.opencb.opencga.storage.core.variant.VariantStoragePipeline.transform(VariantStoragePipeline.java:422)
	at org.opencb.opencga.storage.core.StorageEngine.transformFile(StorageEngine.java:144)
	... 10 more
Caused by: java.lang.IllegalStateException: Block ID is not valid - exected 2 blocks separaed by `_`; value `NC_007605_000000000000`
	at org.opencb.opencga.storage.hadoop.variant.GenomeHelper.splitBlockId(GenomeHelper.java:231)
	at org.opencb.opencga.storage.hadoop.variant.archive.VariantHbaseTransformTask.lambda$orderKeys$2(VariantHbaseTransformTask.java:154)
	at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:174)
	at java.util.LinkedList$LLSpliterator.forEachRemaining(LinkedList.java:1235)
	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
	at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
	at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
	at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499)
	at org.opencb.opencga.storage.hadoop.variant.archive.VariantHbaseTransformTask.orderKeys(VariantHbaseTransformTask.java:155)
	at org.opencb.opencga.storage.hadoop.variant.archive.VariantHbaseTransformTask.checkSlices(VariantHbaseTransformTask.java:123)
	at org.opencb.opencga.storage.hadoop.variant.archive.VariantHbaseTransformTask.encodeVariants(VariantHbaseTransformTask.java:92)
	at org.opencb.opencga.storage.hadoop.variant.archive.VariantHbaseTransformTask.apply(VariantHbaseTransformTask.java:85)
	at org.opencb.opencga.storage.hadoop.variant.AbstractHadoopVariantStoragePipeline.processProto(AbstractHadoopVariantStoragePipeline.java:237)

```

Changed files:
opencga-storage/opencga-storage-hadoop/opencga-storage-hadoop-core/src/main/java/org/opencb/opencga/storage/hadoop/variant/GenomeHelper.java

diff --git a/opencga-storage/opencga-storage-hadoop/opencga-storage-hadoop-core/src/main/java/org/opencb/opencga/storage/hadoop/variant/GenomeHelper.java b/opencga-storage/opencga-storage-hadoop/opencga-storage-hadoop-core/src/main/java/org/opencb/opencga/storage/hadoop/variant/GenomeHelper.java
index 590d34469b..116c37cf97 100644
--- a/opencga-storage/opencga-storage-hadoop/opencga-storage-hadoop-core/src/main/java/org/opencb/opencga/storage/hadoop/variant/GenomeHelper.java
+++ b/opencga-storage/opencga-storage-hadoop/opencga-storage-hadoop-core/src/main/java/org/opencb/opencga/storage/hadoop/variant/GenomeHelper.java
@@ -227,11 +227,23 @@ public class GenomeHelper implements AutoCloseable {
     public String[] splitBlockId(String blockId) {
         char sep = getSeparator();
         String[] split = StringUtils.splitPreserveAllTokens(blockId, sep);
-        if (split.length != 2) {
-            throw new IllegalStateException(String.format("Block ID is not valid - exected 2 blocks separaed by `%s`; value `%s`", sep,
-                    blockId));
+
+        if (split.length < 2) {
+            throw new IllegalStateException(
+                    String.format("Block ID is not valid - expected 2 or more blocks separated by `%s`; value `%s`", sep, blockId));
         }
-        return split;
+
+        // Should parse contigs with separator in names, e.g. NC_007605
+        StringBuilder contig = new StringBuilder();
+        for (int i = 0; i < split.length - 1; i++) {
+            contig.append(split[i]);
+            if (i < split.length - 2) {
+                contig.append(String.valueOf(sep));
+            }
+        }
+
+        String[] res = {contig.toString(), split[split.length - 1]};
+        return res;
     }
 
     /* ***************