grelu.io.bed#

Functions related to reading and writing BED and BED-like files

Functions#

read_bed(→ pandas.DataFrame)

Read a BED file into a pandas DataFrame of genomic intervals.

read_narrowpeak(→ pandas.DataFrame)

Read a narrowPeak file into a pandas DataFrame of genomic intervals.

Module Contents#

grelu.io.bed.read_bed(bed_file: str, has_header: bool = False, str_index: bool = True, **kwargs) pandas.DataFrame[source]#

Read a BED file into a pandas DataFrame of genomic intervals.

Parameters:
  • bed_file – The path to the BED file.

  • has_header – If True, the BED file is assumed to have a header. If False, it is assumed to have no header.

  • str_index – If True, the index is converted into a string format. If False, the index is unchanged.

  • **kwargs – Additional arguments to pass to pd.read_table

Returns:

A DataFrame of genomic intervals, with columns ‘chrom’, ‘start’, and ‘end’, and a string index if str_index is True.

grelu.io.bed.read_narrowpeak(peak_file: str, skiprows: int = 0, str_index: bool = False, **kwargs) pandas.DataFrame[source]#

Read a narrowPeak file into a pandas DataFrame of genomic intervals.

Parameters:
  • peak_file – The path to the narrowpeak file.

  • skiprows – number of rows to skip at the beginning of the file.

  • str_index – If True, the index is converted into a string format. If False, the index is unchanged.

  • **kwargs – Additional arguments to pass to pd.read_table.

Returns:

A DataFrame of genomic intervals, with a string index if str_index is True.