package com.graph.db.file.transcript.subscriber;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;

import com.graph.db.file.GenericMapSubscriber;
import com.graph.db.output.OutputFileType;

public class GeneSubscriber extends GenericMapSubscriber<Map<String, String>> {
	
	private static final OutputFileType GENE = OutputFileType.GENE;
	
	private final Set<Map<String, String>> set = ConcurrentHashMap.newKeySet();

	public GeneSubscriber(String outputFolder, Class<?> parserClass) {
		super(outputFolder, parserClass, GENE);
	}
	
	@Override
	public void processAnnotation(Map<String, String> object) {
		Map<String, String> map = new HashMap<>();
		for (String key : GENE.getHeader()) {
			map.put(key, object.get(key));
		}
		
		set.add(map);
	}
	
	@Override
	public void close() {
		try {
			for (Map<String, String> s : set) {
				beanWriter.write(s, GENE.getHeader());
			}
		} catch (IOException e) {
			throw new RuntimeException(e);
		} finally {
			super.close();
		}
	}

}

@@ -189,16 +189,62 @@
 shMap;%0A%0A
+import org.apache.commons.lang3.StringUtils;%0A%0A
 import c
@@ -825,16 +825,127 @@
 er()) %7B%0A
+%09%09%09switch (key) %7B%0A%09%09%09case %22gene_id%22:%0A%09%09%09%09map.put(key, extractGeneId(object.get(key)));%0A%09%09%09%09break;%0A%09%09%09default:%0A%09
 %09%09%09map.p
@@ -970,16 +970,32 @@
 (key));%0A
+%09%09%09%09break;%0A%09%09%09%7D%0A
 %09%09%7D%0A%09%09%0A%09
@@ -1006,32 +1006,134 @@
 .add(map);%0A%09%7D%0A%09%0A
+%09private String extractGeneId(String string) %7B%0A%09%09return StringUtils.substringBefore(string, %22.%22);%0A%09%7D%0A%0A
 %09@Override%0A%09publ

the gene_id needs to be extracted out by parsing the string