use of utils.BedLineCodec in project ASCIIGenome by dariober.
the class MakeTabixIndex method addLineToIndex.
/**
* Set vcfHeader and vcfCodec to null if reading non-vcf line.
*/
private void addLineToIndex(String line, TabixIndexCreator indexCreator, long filePosition, TabixFormat fmt, VCFHeader vcfHeader, VCFCodec vcfCodec) throws InvalidRecordException {
if (fmt.equals(TabixFormat.BED)) {
BedLineCodec bedCodec = new BedLineCodec();
BedLine bed = bedCodec.decode(line);
indexCreator.addFeature(bed, filePosition);
} else if (fmt.equals(TabixFormat.GFF)) {
GtfLine gtf = new GtfLine(line.split("\t"));
indexCreator.addFeature(gtf, filePosition);
} else if (fmt.equals(TabixFormat.VCF)) {
VariantContext vcf = vcfCodec.decode(line);
indexCreator.addFeature(vcf, filePosition);
} else {
System.err.println("Unexpected TabixFormat: " + fmt.sequenceColumn + " " + fmt.startPositionColumn);
throw new InvalidRecordException();
}
}
Aggregations