/*
//////////////////////////////////////
Internal methods, parsing
//////////////////////////////////////
350166
protected void verifyXmlEncoding(ReaderConfig cfg)
        throws XMLStreamException
    {
        String inputEnc = mInputEncoding;

        // Close enough?
        if (StringUtil.equalEncodings(inputEnc, mFoundEncoding)) {
            return;
        }

        /* Ok, maybe the difference is just with endianness indicator?
         * (UTF-16BE vs. UTF-16)?
         */
        // !!! TBI

        XMLReporter rep = cfg.getXMLReporter();
        if (rep != null) {
            Location loc = getLocation();
            String msg = MessageFormat.format(ErrorConsts.W_MIXED_ENCODINGS,
                                              new Object[] { mFoundEncoding,
                                                             inputEnc });
            String type = ErrorConsts.WT_XML_DECL;
            /* 30-May-2008, tatus: Should wrap all the info as XMValidationProblem
             *    since that's Woodstox' contract wrt. relatedInformation field.
             */
            XMLValidationProblem prob = new XMLValidationProblem(loc, msg, XMLValidationProblem.SEVERITY_WARNING, type);
            rep.report(msg, type, prob, loc);
        }
    }
1257014
public synchronized final void parseDetails() {
        LOG.debug("parsing details of {}", this.getType());
        if (content != null) {
            ByteBuffer content = this.content;
            isParsed = true;
            content.rewind();
            _parseDetails(content);
            if (content.remaining() > 0) {
                deadBytes = content.slice();
            }
            this.content = null;
            assert verify(content);
        }
    }
1117106
@SuppressWarnings({ "rawtypes", "unchecked" })
	@Override
	public Object parse(String source) throws Exception {

		// Parse source
		Tree node = new Tree();
		LinkedProperties properties = new LinkedProperties();
		properties.load(new StringReader(source));
		LinkedHashMap<Object, Object> map = properties.map;

		final HashMap<String, Boolean> zeroIndexes = new HashMap<>();
		final HashMap<String, Boolean> arrays = new HashMap<>();

		// Convert Map to Node
		final StringBuilder path = new StringBuilder();
		for (Map.Entry<Object, Object> entry : map.entrySet()) {
			String key = (String) entry.getKey();
			String value = (String) entry.getValue();

			final StringTokenizer st = new StringTokenizer(key, ". ");
			path.setLength(0);
			while (st.hasMoreTokens()) {
				String token = st.nextToken();

				String prefix = path.toString();
				Boolean array = arrays.get(prefix);

				boolean number;
				if (array != null && !array) {
					number = false;
				} else {
					number = isNumeric(token);
				}

				if (number && array == null) {

					// Analyze array
					array = true;
					final ArrayList<Integer> indexes = new ArrayList<>();
					for (Object o : map.keySet()) {
						String t = (String) o;
						if (t.startsWith(prefix)) {
							int l = prefix.length() + 1;
							int i = t.indexOf('.', l);
							if (i > -1) {
								t = t.substring(l, i);
							} else {
								t = t.substring(l);
							}
							if (isNumeric(t)) {
								int idx = Integer.parseInt(t);
								if (indexes.contains(idx) && i == -1) {

									// Double index!
									array = false;
									break;
								}
								indexes.add(idx);
							} else {

								// Not numeric!
								array = false;
								break;
							}
						}
					}

					// Check index sequence (1,2,3,etc.)
					Collections.sort(indexes);
					int prev = Integer.MIN_VALUE;
					for (int idx : indexes) {
						if (prev == Integer.MIN_VALUE) {

							// First element is not "0" or "1"
							if (idx != 0 && idx != 1) {
								array = false;
								break;
							}

						} else if (prev - idx > 1) {

							// Not sequential!
							array = false;
							break;
						}
						prev = idx;
					}

					arrays.put(prefix, array);
					if (array) {
						String test = prefix + ".0";
						boolean zeroIndex = false;
						for (Object o : map.keySet()) {
							if (((String) o).startsWith(test)) {
								zeroIndex = true;
								break;
							}
						}
						zeroIndexes.put(prefix, zeroIndex);
					} else {
						number = false;
					}
				}

				if (number) {
					path.append('[');
					int idx = Integer.parseInt(token);
					if (!zeroIndexes.get(prefix)) {
						idx--;
					}
					path.append(idx);
					path.append(']');
				} else {
					if (path.length() > 0) {
						path.append('.');
					}
					path.append(token);
				}

			}
			node.put(path.toString(), (String) value);
		}

		// Store first indexes in metadata block
		Object result = node.asObject();
		if (!zeroIndexes.isEmpty()) {
			Tree meta = node.getMeta();
			Tree indexMap = meta.putMap(FIRST_INDEX);
			for (Map.Entry<String, Boolean> entry : zeroIndexes.entrySet()) {
				indexMap.put(entry.getKey(), entry.getValue() ? 0 : 1);
			}

			// Pushback metadata into the value map
			if (result instanceof Map) {
				((Map) result).put(Config.META, meta.asObject());
			}
		}
		return result;
	}
462267
protected void parse(Node node) {
		parsed = true;
		NodeList childNodes = node.getChildNodes();
		for (int i = 0; i < childNodes.getLength(); i++) {
			Node child = childNodes.item(i);
			String nodeName = child.getNodeName();
			if ("Name".equalsIgnoreCase(nodeName)) {
				name = getValueRecursive(child);
			} else if ("Title".equalsIgnoreCase(nodeName)) {
				title = getValueRecursive(child);
			} else if ("Abstract".equalsIgnoreCase(nodeName)) {
				abstractt = getValueRecursive(child);
			} else if ("Keywords".equalsIgnoreCase(nodeName)) {
				addKeyWords(child);
			} else if ("SRS".equalsIgnoreCase(nodeName)) {
				defaultCrs = getValueRecursive(child);
			} else if ("LatLongBoundingBox".equalsIgnoreCase(nodeName)) {
				addLatLonBoundingBox(child);
			}
		}
	}
288586
public void parse() throws CompilationFailedException {
        if (this.phase > Phases.PARSING) {
            throw new GroovyBugError("parsing is already complete");
        }

        if (this.phase == Phases.INITIALIZATION) {
            nextPhase();
        }

        //
        // Create a reader on the source and run the parser.

        Reader reader = null;
        try {
            reader = source.getReader();

            // let's recreate the parser each time as it tends to keep around state
            parserPlugin = getConfiguration().getPluginFactory().createParserPlugin();

            cst = parserPlugin.parseCST(this, reader);

            reader.close();

        }
        catch (IOException e) {
            getErrorCollector().addFatalError(new SimpleMessage(e.getMessage(), this));
        }
        finally {
            if (reader != null) {
                try {
                    reader.close();
                }
                catch (IOException e) {
                    // Ignore
                }
            }
        }
    }
634918
public void parseString(String xml) throws ParserException {

        try {
            nanoElement.parseString(xml);
        } catch (XMLParseException e) {
            throw new ParserException(e.getMessage());
        }
    }
877577
private void initDocumentParser() throws ParserConfigurationException {

    DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();

    docBuilderFactory.setNamespaceAware(false);
    docBuilderFactory.setValidating(true);

    docBuilderFactory.setAttribute(
        "http://java.sun.com/xml/jaxp/properties/schemaLanguage",
        "http://www.w3.org/2001/XMLSchema");

    docBuilderFactory.setAttribute(
        "http://java.sun.com/xml/jaxp/properties/schemaSource", resolveSchemaSource());

    docBuilder = docBuilderFactory.newDocumentBuilder();

    docBuilder.setErrorHandler(this);

    xpath = XPathFactory.newInstance().newXPath();
  }
1201258
private void parse(String text, int start, int end)
   {
      int closing = getClosingParenthesisPosition(text, start);
      if (closing == -1 || closing > end)
      {
         throw new IllegalStateException("Error in parenthesis hierarchy");
      }
      if (!text.startsWith("(0||"))
      {
         throw new IllegalStateException("Not a valid record");
      }

      int valueStart = getNextOpeningParenthesisPosition(text, start);
      int valueStop = getClosingParenthesisPosition(text, valueStart);
      int dictStart = getNextOpeningParenthesisPosition(text, valueStop);
      int dictStop = getClosingParenthesisPosition(text, dictStart);
      parse(text, start + 4, valueStart, valueStop, dictStart, dictStop);
   }
1090856
private void parse(String input) {
        char[] data = input.toCharArray();
        int start = 0;
        int hard_stop = data.length - 1;
        while (start < data.length) {
            if (this.mySep == data[start]) {
                start++;
                continue;
            }
            // look for the '=', end of data, or the separator
            int end = start;
            String key = null;
            boolean insideQuotes = false;
            while (end < data.length) {
                boolean extract = false;
                if ('"' == data[end]) {
                    insideQuotes = !insideQuotes;
                } else if (this.mySep == data[end]) {
                    extract = true;
                    end--;
                } else if ('=' == data[end]) {
                    // found a key
                    key = extractString(data, start, end - 1);
                    end++; // past the '='
                    start = end;
                    continue;
                }
                // if we're on the last character then always extract and quit
                if (end == hard_stop) {
                    extract = true;
                }

                // if we need to, extract the value and continue
                if (extract) {
                    String value = extractString(data, start, end);
                    if (null == key) {
                        addElement(value);
                    } else {
                        addElement(key, value);
                    }
                    // at this point, end is pointing to the last char of the val
                    end = end + 2; // jump past delim
                    start = end;
                    if (!insideQuotes) {
                        break; // out of while
                    }
                    continue;
                }
                end++;
            }
        }
    }
1120282
private final ParseTreeNode parse() throws ParserException {
	try {
	    createActionStack();
	    return LRTokenStreamConverter.convert(getTokenStream(), getGrammar(), actionStack);
	} catch (GrammarException e) {
	    logger.error(e.getMessage(), e);
	    throw new ParserException(e.getMessage());
	}
    }
1147211
private void parse(String text, int start, int valueStart, int valueStop, int dictStart, int dictStop)
   {
      m_field = text.substring(start, valueStart);
      if (valueStop - valueStart <= 1)
      {
         m_value = null;
      }
      else
      {
         m_value = text.substring(valueStart + 1, valueStop);
      }
      if (dictStop - dictStart > 1)
      {
         for (int s = getNextOpeningParenthesisPosition(text, dictStart); s >= 0 && s < dictStop;)
         {
            int e = getClosingParenthesisPosition(text, s);
            m_records.add(new Record(text, s, e));
            s = getNextOpeningParenthesisPosition(text, e);
         }
      }
   }
793743
@SuppressWarnings("unchecked")
  @Override
  protected void initParser() throws MtasConfigException {
    super.initParser();
    if (config != null) {
      // always word, no mappings
      wordType = new MtasParserType<>(MAPPING_TYPE_WORD, null, false);
      for (int i = 0; i < config.children.size(); i++) {
        MtasConfiguration current = config.children.get(i);
        if (current.name.equals("filters")) {
          for (int j = 0; j < current.children.size(); j++) {
            if (current.children.get(j).name.equals("filter")) {
              MtasConfiguration filter = current.children.get(j);
              String typeFilter = filter.attributes.get("type");
              String nameFilter = filter.attributes.get("name");
              if(typeFilter!=null) {
                if(typeFilter.equals(FILTER_TYPE_REPLACE)) {
                  String value = filter.attributes.get("value");
                  String replace = filter.attributes.get("replace");
                  if(nameFilter!=null && value!=null && replace!=null) {
                    String[] names = nameFilter.split(Pattern.quote(","));
                    for(String name : names) {
                      try {
                        int nameInt = Integer.parseInt(name);
                        HashMap<String, String> nameMap;
                        if(!filterReplace.containsKey(nameInt)) {
                          nameMap = new HashMap<>();
                          filterReplace.put(nameInt, nameMap);
                        } else {
                          nameMap = filterReplace.get(nameInt);
                        }
                        nameMap.put(value, replace);
                      } catch (NumberFormatException e) {
                        log.info(e);                        
                      }                      
                    }                    
                  } else {
                    throw new MtasConfigException("no name, value or replace for filter "
                        + typeFilter );
                  }
                } else {
                  throw new MtasConfigException("unknown filter type "
                      + typeFilter );
                }
              } else {
                throw new MtasConfigException("no type provided for filter" );
              }
            }
          }  
        } else if (current.name.equals("mappings")) {
          for (int j = 0; j < current.children.size(); j++) {
            if (current.children.get(j).name.equals("mapping")) {
              MtasConfiguration mapping = current.children.get(j);
              String typeMapping = mapping.attributes.get("type");
              String nameMapping = mapping.attributes.get("name");
              if ((typeMapping != null)) {
                if (typeMapping.equals(MAPPING_TYPE_WORD)) {
                  MtasCRMParserMappingWordAnnotation m = new MtasCRMParserMappingWordAnnotation();
                  m.processConfig(mapping);
                  wordType.addItem(m);
                } else if (typeMapping.equals(MAPPING_TYPE_WORD_ANNOTATION)
                    && (nameMapping != null)) {
                  MtasCRMParserMappingWordAnnotation m = new MtasCRMParserMappingWordAnnotation();
                  m.processConfig(mapping);
                  if (wordAnnotationTypes.containsKey(nameMapping)) {
                    wordAnnotationTypes.get(nameMapping).addItem(m);
                  } else {
                    MtasParserType<MtasParserMapping<?>> t = new MtasParserType<>(
                        typeMapping, nameMapping, false);
                    t.addItem(m);
                    wordAnnotationTypes.put(nameMapping, t);
                  }
                } else if (typeMapping.equals(MAPPING_TYPE_CRM_SENTENCE)) {
                  MtasCRMParserMappingCRMSentence m = new MtasCRMParserMappingCRMSentence();
                  m.processConfig(mapping);
                  if (crmSentenceTypes.containsKey(nameMapping)) {
                    crmSentenceTypes.get(nameMapping).addItem(m);
                  } else {
                    MtasParserType<MtasParserMapping<?>> t = new MtasParserType<>(
                        MAPPING_TYPE_GROUP, nameMapping, true);
                    t.addItem(m);
                    crmSentenceTypes.put(nameMapping, t);
                  }
                } else if (typeMapping.equals(MAPPING_TYPE_CRM_CLAUSE)) {
                  MtasCRMParserMappingCRMSentence m = new MtasCRMParserMappingCRMSentence();
                  m.processConfig(mapping);
                  if (crmClauseTypes.containsKey(nameMapping)) {
                    crmClauseTypes.get(nameMapping).addItem(m);
                  } else {
                    MtasParserType<MtasParserMapping<?>> t = new MtasParserType<>(
                        MAPPING_TYPE_GROUP, nameMapping, true);
                    t.addItem(m);
                    crmClauseTypes.put(nameMapping, t);
                  }
                } else if (typeMapping.equals(MAPPING_TYPE_CRM_PAIR)) {
                  MtasCRMParserMappingCRMPair m = new MtasCRMParserMappingCRMPair();
                  m.processConfig(mapping);
                  if (crmPairTypes.containsKey(nameMapping)) {
                    crmPairTypes.get(nameMapping).addItem(m);
                  } else {
                    MtasParserType<MtasParserMapping<?>> t = new MtasParserType<>(
                        MAPPING_TYPE_RELATION, nameMapping, true);
                    t.addItem(m);
                    crmPairTypes.put(nameMapping, t);
                  }
                } else {
                  throw new MtasConfigException("unknown mapping type "
                      + typeMapping + " or missing name");
                }
              }
            }
          }
        } else if (current.name.equals("functions")) {
          for (int j = 0; j < current.children.size(); j++) {
            if (current.children.get(j).name.equals("function")) {
              MtasConfiguration function = current.children.get(j);
              String nameFunction = function.attributes.get("name");
              String typeFunction = function.attributes.get("type");
              String splitFunction = function.attributes.get("split");
              if (nameFunction != null && typeFunction != null) {
                MtasCRMParserFunction mtasCRMParserFunction = new MtasCRMParserFunction(
                    typeFunction, splitFunction);
                if (!functions.containsKey(typeFunction)) {
                  functions.put(typeFunction,
                      new HashMap<String, MtasCRMParserFunction>());
                }
                functions.get(typeFunction).put(nameFunction,
                    mtasCRMParserFunction);
                MtasConfiguration subCurrent = current.children.get(j);
                for (int k = 0; k < subCurrent.children.size(); k++) {
                  if (subCurrent.children.get(k).name.equals("condition")) {
                    MtasConfiguration subSubCurrent = subCurrent.children
                        .get(k);
                    if (subSubCurrent.attributes.containsKey("value")) {
                      String[] valuesCondition = subSubCurrent.attributes
                          .get("value").split(Pattern.quote(","));
                      ArrayList<MtasCRMParserFunctionOutput> valueOutputList = new ArrayList<>();
                      for (int l = 0; l < subSubCurrent.children.size(); l++) {
                        if (subSubCurrent.children.get(l).name
                            .equals("output")) {
                          String valueOutput = subSubCurrent.children
                              .get(l).attributes.get("value");
                          String nameOutput = subSubCurrent.children
                              .get(l).attributes.get("name");
                          if (nameOutput != null) {
                            MtasCRMParserFunctionOutput o = new MtasCRMParserFunctionOutput(
                                nameOutput, valueOutput);
                            valueOutputList.add(o);
                          }
                        }
                      }
                      if (!valueOutputList.isEmpty()) {
                        for (String valueCondition : valuesCondition) {
                          if (mtasCRMParserFunction.output
                              .containsKey(valueCondition)) {
                            mtasCRMParserFunction.output.get(valueCondition)
                                .addAll(
                                    (Collection<? extends MtasCRMParserFunctionOutput>) valueOutputList
                                        .clone());
                          } else {
                            mtasCRMParserFunction.output.put(valueCondition,
                                (ArrayList<MtasCRMParserFunctionOutput>) valueOutputList
                                    .clone());
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
240464
@Override
  protected void initParser() throws MtasConfigException {
    namespaceURI = "http://ilk.uvt.nl/folia";
    namespaceURI_id = "http://www.w3.org/XML/1998/namespace";
    rootTag = "FoLiA";
    contentTag = "text";
    allowNonContent = true;
    super.initParser();
  }
645960
private void parseSeeString() {
        int len = text.length();
        if (len == 0) {
            return;
        }
        switch (text.charAt(0)) {
            case '<':
                if (text.charAt(len-1) != '>') {
                    docenv().warning(holder,
                                     "tag.see.no_close_bracket_on_url",
                                     name, text);
                }
                return;
            case '"':
                if (len == 1 || text.charAt(len-1) != '"') {
                    docenv().warning(holder,
                                     "tag.see.no_close_quote",
                                     name, text);
                } else {
//                    text = text.substring(1,len-1); // strip quotes
                }
                return;
        }

        // check that the text is one word, with possible parentheses
        // this part of code doesn't allow
        // @see <a href=.....>asfd</a>
        // comment it.

        // the code assumes that there is no initial white space.
        int parens = 0;
        int commentstart = 0;
        int start = 0;
        int cp;
        for (int i = start; i < len ; i += Character.charCount(cp)) {
            cp = text.codePointAt(i);
            switch (cp) {
                case '(': parens++; break;
                case ')': parens--; break;
                case '[': case ']': case '.': case '#': break;
                case ',':
                    if (parens <= 0) {
                        docenv().warning(holder,
                                         "tag.see.malformed_see_tag",
                                         name, text);
                        return;
                    }
                    break;
                case ' ': case '\t': case '\n': case CR:
                    if (parens == 0) { //here onwards the comment starts.
                        commentstart = i;
                        i = len;
                    }
                    break;
                default:
                    if (!Character.isJavaIdentifierPart(cp)) {
                        docenv().warning(holder,
                                         "tag.see.illegal_character",
                                         name, ""+cp, text);
                    }
                    break;
            }
        }
        if (parens != 0) {
            docenv().warning(holder,
                             "tag.see.malformed_see_tag",
                             name, text);
            return;
        }

        String seetext = "";
        String labeltext = "";

        if (commentstart > 0) {
            seetext = text.substring(start, commentstart);
            labeltext = text.substring(commentstart + 1);
            // strip off the white space which can be between seetext and the
            // actual label.
            for (int i = 0; i < labeltext.length(); i++) {
                char ch2 = labeltext.charAt(i);
                if (!(ch2 == ' ' || ch2 == '\t' || ch2 == '\n')) {
                    label = labeltext.substring(i);
                    break;
                }
            }
        } else {
            seetext = text;
            label = "";
        }

        int sharp = seetext.indexOf('#');
        if (sharp >= 0) {
            // class#member
            where = seetext.substring(0, sharp);
            what = seetext.substring(sharp + 1);
        } else {
            if (seetext.indexOf('(') >= 0) {
                docenv().warning(holder,
                                 "tag.see.missing_sharp",
                                 name, text);
                where = "";
                what = seetext;
            }
            else {
                // no member specified, text names class
                where = seetext;
                what = null;
            }
        }
    }
1067961
private void parse(String[] args) {
        for (int i=0; i<args.length; i++) {
            if (opt_with_value.containsKey(args[i])) {
                String key = opt_with_value.get(args[i]);
                values.put(key, args[i+1]);
                i++;
            } else if (args[i].startsWith("-")) {
                opt_without_value.add(args[i]);
            } else {
                arglist.add(args[i]);
            }
        }
    }
1035524
@Override
    public void parse() throws IOException, InterruptedException, SQLException, ClassNotFoundException {
        Map<String, String> seqRegionMap = VariationUtils.parseSeqRegionToMap(ensemblVariationDir);
        Map<String, String> phenotypeMap = VariationUtils.parsePhenotypeToMap(ensemblVariationDir);
        Map<String, String> sourceMap = VariationUtils.parseSourceToMap(ensemblVariationDir);
        Map<String, String> studyMap = VariationUtils.parseStudyToMap(ensemblVariationDir);
        Map<String, String> attribTypeMap = VariationUtils.parseAttribTypeToMap(ensemblVariationDir);

        Map<String, Set<String>> phenotypeToGeneList = new HashMap<>(20000);

        prepare(ensemblVariationDir);
        createPhenFeatAttribTable(ensemblVariationDir);
        raf = new RandomAccessFile(ensemblVariationDir.resolve("phenotype_feature_attrib.txt").toFile(), "r");

        VariationPhenotypeAnnotation mutation;
        String seqRegion = null;
        String phenotype = null;
        String source = null;
        String study = null;
        String externalId = null;

        String clinSignificance = null;
        List<String> associatedGenes = new ArrayList<>();
        String riskAllele = null;
        float pValue = 0.0f;
        float oddsRatio = 0.0f;

        String chunkIdSuffix = CHUNK_SIZE / 1000 + "k";

        BufferedReader br = FileUtils.newBufferedReader(ensemblVariationDir.resolve("phenotype_feature.txt.gz"), Charset.defaultCharset());
        String[] fields = null;
        String[] rafFields = null;
        String line = null;
        int count = 0;
        while ((line = br.readLine()) != null) {
            fields = line.split("\t");

            if (fields[4].equals("Variation")) {
                seqRegion = seqRegionMap.get(fields[7]);
                phenotype = phenotypeMap.get(fields[1]);
                source = sourceMap.get(fields[2]).split(",")[0];
                study = studyMap.get(fields[3]);
// anyadir type: variation, SV, ...

                clinSignificance = "";
                externalId = "";
                associatedGenes = new ArrayList<>();
                riskAllele = "";
                pValue = -1f;
                oddsRatio = -1f;
                List<String> resultPhenAnnot = queryByVariationId(Integer.parseInt(fields[0]), ensemblVariationDir);
                if (++count % 10000 == 0) {
                    System.out.println(resultPhenAnnot);
//                    if(count > 200000) break;
                }
                for (String result : resultPhenAnnot) {
                    rafFields = result.split("\t", -1);
                    switch (rafFields[1]) {
                        case "10":
                            clinSignificance = rafFields[2];
                            break;
                        case "13":
                            associatedGenes = Splitter.on(",").trimResults().splitToList(rafFields[2]);
                            break;
                        case "14":  // riskAllele
                            riskAllele = rafFields[2];
                            break;
                        case "15":  // pValue
                            pValue = (rafFields[2] != null && !rafFields[2].equalsIgnoreCase("null"))
                                    ? Float.parseFloat(rafFields[2])
                                    : -1f;
                            break;
                        case "22":  // pValue
                            externalId = rafFields[2];
                            break;
                        case "23":  // pValue
                            oddsRatio = Float.parseFloat(rafFields[2]);
                            break;
                        default:
                            break;
                    }

                }

                if (!phenotypeToGeneList.containsKey(phenotype)) {
                    phenotypeToGeneList.put(phenotype, new HashSet<String>());
                }
                phenotypeToGeneList.get(phenotype).addAll(associatedGenes);

                mutation = new VariationPhenotypeAnnotation(fields[5], seqRegion, Integer.parseInt(fields[8]),
                        Integer.parseInt(fields[9]), fields[10], phenotype, source, study, clinSignificance, associatedGenes,
                        riskAllele, pValue, oddsRatio, "", externalId);
                int chunkStart = (mutation.getStart()) / CHUNK_SIZE;
                int chunkEnd = (mutation.getEnd()) / CHUNK_SIZE;

                if (mutation.getChunkIds() == null) {
                    mutation.setChunkIds(new ArrayList<String>());
                }
                for (int i = chunkStart; i <= chunkEnd; i++) {
                    mutation.getChunkIds().add(mutation.getChromosome() + "_" + i + "_" + chunkIdSuffix);
                }
                serializer.serialize(mutation);
            }
        }
        raf.close();
        br.close();

        BufferedWriter bw = Files.newBufferedWriter(Paths.get("/tmp/phenotype.json"), Charset.defaultCharset());
//        Iterator<String> iter = phenotypeToGeneList.keySet().iterator();
//        for (Object o : iter) {
//            jsonObjectWriter.writeValueAsString(phenotypeToGeneList);
//        }
        for (Map.Entry<String, Set<String>> elem : phenotypeToGeneList.entrySet()) {
            bw.write(jsonObjectWriter.writeValueAsString(elem)
                    .replace("\"key\"", "\"phenotype\"")
                    .replace("\"value\"", "\"associatedGenes\""));
            bw.newLine();
        }
        bw.close();

        clean(ensemblVariationDir);
    }
1097224
final public void NonLiteral() throws ParseException {
    if (jj_2_6(5)) {
      LambdaExpressionOrInvocation();
    } else {
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
      case LPAREN:
        jj_consume_token(LPAREN);
        Expression();
        jj_consume_token(RPAREN);
        break;
      default:
        jj_la1[39] = jj_gen;
        if (jj_2_7(2147483647)) {
          Function();
        } else {
          switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
          case IDENTIFIER:
            Identifier();
            break;
          default:
            jj_la1[40] = jj_gen;
            if (jj_2_8(3)) {
              SetData();
            } else {
              switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
              case LBRACK:
                ListData();
                break;
              case START_SET_OR_MAP:
                MapData();
                break;
              default:
                jj_la1[41] = jj_gen;
                jj_consume_token(-1);
                throw new ParseException();
              }
            }
          }
        }
      }
    }
  }