edu.unc.csbio.util
Class GTFParser

java.lang.Object
  extended by edu.unc.csbio.util.GTFParser

public class GTFParser
extends java.lang.Object

A GTF Parser conforms to GTF2.2 (http://mblab.wustl.edu/GTF22.html)

Version:
0.1
Author:
Shunping Huang , Jack Wang

Field Summary
private static java.lang.String assignmentDelimiter
          three delimiters
private static java.lang.String attributeDelimiter
          three delimiters
private static java.lang.String basicDelimiter
          three delimiters
private static java.lang.String[] basicKeyArray
          right basic fields as a String array
private static java.lang.String quoteSign
          a quote sign
 
Constructor Summary
GTFParser()
           
 
Method Summary
static java.util.HashMap<java.lang.String,java.lang.String> parse(java.lang.String line)
          This method returns a HashMap that contain the fields.
private static java.lang.String stripLine(java.lang.String line)
          A method to remove the leading and trailing whitespaces.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

basicKeyArray

private static final java.lang.String[] basicKeyArray
right basic fields as a String array


basicDelimiter

private static final java.lang.String basicDelimiter
three delimiters

See Also:
Constant Field Values

attributeDelimiter

private static final java.lang.String attributeDelimiter
three delimiters

See Also:
Constant Field Values

assignmentDelimiter

private static final java.lang.String assignmentDelimiter
three delimiters

See Also:
Constant Field Values

quoteSign

private static final java.lang.String quoteSign
a quote sign

See Also:
Constant Field Values
Constructor Detail

GTFParser

public GTFParser()
Method Detail

stripLine

private static java.lang.String stripLine(java.lang.String line)
A method to remove the leading and trailing whitespaces. "#" will be removed.

Parameters:
line - orignal line
Returns:
formatted line

parse

public static java.util.HashMap<java.lang.String,java.lang.String> parse(java.lang.String line)
This method returns a HashMap that contain the fields. Each field is represented as a key=>value mapping The first eight fields are the basic fields, and the names of keys are listed in the array. The last field contains additional attributes. Those attributes are also inserted into the HashMap as the basic fields, except the names of their keys will have a "_" as prefix.

Parameters:
line - original line
Returns:
a HashMap that contain the fields