pybedtools.bedtool.BedTool.expand

BedTool.expand(*args, **kwargs)[source]

Wraps bedtools expand

For convenience, the file or stream this BedTool points to is implicitly passed as the -i argument to expandCols

Original BEDTools help::

Tool:    bedtools expand 
Version: v2.31.1
Summary: Replicate lines in a file based on columns of comma-separated values.

Usage:   bedtools expand -c [COLS] 
Options: 
        -i      Input file. Assumes "stdin" if omitted.

        -c      Specify the column (1-based) that should be summarized.
                - Required.
Examples: 
  $ cat test.txt
  chr1  10      20      1,2,3   10,20,30
  chr1  40      50      4,5,6   40,50,60

  $ bedtools expand test.txt -c 5
  chr1  10      20      1,2,3   10
  chr1  10      20      1,2,3   20
  chr1  10      20      1,2,3   30
  chr1  40      50      4,5,6   40
  chr1  40      50      4,5,6   50
  chr1  40      50      4,5,6   60

  $ bedtools expand test.txt -c 4,5
  chr1  10      20      1       10
  chr1  10      20      2       20
  chr1  10      20      3       30
  chr1  40      50      4       40
  chr1  40      50      5       50
  chr1  40      50      6       60