Reading 2Bit files

You read 2Bit files using the TwoBit.Reader type.

TwoBit.ReaderType
TwoBit.Reader(input::IO)

Create a data reader of the 2bit file format.

Arguments

  • input: data source
source

The type wraps an IO type and supports random access to the sequence records in the file.

reader = TwoBit.Reader(open("sacCer.2bit", "r"))
chrIV = reader["chrIV"] # directly read chromosome 4

If you want to know the names of the sequences available in the file, you can use the seqnames method on the reader.

TwoBit.seqnames(reader)

Reading from a TwoBit.Reader will yield a TwoBit.Record type variable.