Class BedRecord
Data structure for storing BED records.

All Subcl's Bed12Record, Bed3Record, Bed4Record, Bed5Record, Bed6Record
Defined in <seqan/bed_io.h>
Signature template <typename TSpec> class BedRecord;

Template Parameters

TSpec The specialization to use. Default: Bed12.

Member Function Overview

Interface Function Overview

Member Variable Overview

Detailed Description

BED files allow the easy representation of intervals on the genome. Originally, they were designed for tracks in the UCSC genome browser. The original format has 12 columns but often variants using fewer columns with interpreted data are used and the rest is kept as application dependent data.

The BedRecord class allows for storing BED records. The various subclasses provide access to 3, 4, 5, 6, or 12 fields of the BED format. For example, a BedRecord<Bed>> has members variables for the first 5 columns of a BED file. The remaining data is stored as the CharString member variable data.


The ref field is the name of the reference as loaded from the BED file. The rID field can be used to store a numeric reference id. When loading without using a BedIOContext, the rID field remains set to INVALID_REFID, otherwise the field is set to a different value.

Note that while the BED file format is 1-based, the coordinates in the BedRecord are 0-based.

Member Functions Detail



Interface Functions Detail

void clear(record);

Reset BED record to state after default initialization.


record BedRecord to reset.

int readRecord(record, reader[, context], Bed());

Read a BED record from a file.


record BedRecord object to write to. Types: BedRecord
context The optional BedIOContext to use.
reader The SinglePassRecordReader to use.


int Status code, 0 on success, other value on errors.

The type of the parameter record decides which fields are interpreted. The remainder of the line (excluding the line break) is written to

When context is given, the rID field is filled and the context's name store may be updated if a previously unknown reference occurs.

int writeRecord(stream, record[, context], Bed());

Write a BED record to a file.


record The BedRecord to write.
stream Stream object to write to.
context The optional BedIOContext to use.


int Status code, 0 on success, other values on errors.

When context is given, the first field is written from the sequence with index record.rID in the context's name store.

Member Variables Detail

__int32 BedRecord::beginPosition

Begin position on the reference.

CharString BedRecord::data

Any data after the last position.

__int32 BedRecord::endPosition

End position on the reference.

__int32 BedRecord::INVALID_POS

Constant for invalid positions.

__int32 BedRecord::INVALID_REFID

Constant for invalid references.

CharString BedRecord::ref

Name of the interval's reference name.

__int32 BedRecord::rID

Numeric id of the interval's reference (__int32, defaults to INVALID_REFID).