Implemented decodeLoc(..)

git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@3713 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
weisburd 2010-07-02 21:01:36 +00:00
parent cd2e4b0a1e
commit f7593435eb
2 changed files with 22 additions and 3 deletions

View File

@ -75,11 +75,17 @@ public class AnnotatorInputTableCodec implements FeatureCodec<AnnotatorInputTabl
return null; // TODO: do we want the header to be a concrete type? return null; // TODO: do we want the header to be a concrete type?
} }
// todo -- probably worth implementing for performance reasons @Override
public Feature decodeLoc(String line) { public Feature decodeLoc(String line) {
return decode(line); int tabIndex = line.indexOf(DELIMITER);
if(tabIndex <= 0) {
throw new CodecLineParsingException("Couldn't parse GenomeLoc out the following line because line.indexOf(DELIMITER) returned " + tabIndex + ".\nLine: " + line);
}
GenomeLoc loc = GenomeLocParser.parseGenomeLoc(line.substring(0, tabIndex));
return new AnnotatorInputTableFeature(loc.getContig(), (int) loc.getStart(), (int) loc.getStop());
} }
/** /**
* Parses the line into an AnnotatorInputTableFeature object. * Parses the line into an AnnotatorInputTableFeature object.
* *

View File

@ -60,6 +60,19 @@ public class AnnotatorInputTableFeature implements Feature {
/**
* Constructor.
* @param chr The chromosome name.
* @param start
* @param end
*/
public AnnotatorInputTableFeature(String chr, int start, int end) {
this.chr = chr;
this.start = start;
this.end = end;
}
/** /**
* Constructor. * Constructor.
* @param columnNames The column names as parsed out of the file header. * @param columnNames The column names as parsed out of the file header.