The SEGSPAN command turns a stream of segments into a stream of non-overlapping segments. The input must minimally contain the three columns necessary to denote segment, i.e. Chrom, bpStart and bpStop. The output is Chrom, bpStart, bpStop, and segCount where segCount is the number of segments in the input overlapping with the one in the output.
If the -gc option is not used, maxseg is infinite unless it is explicitly set to reduce the maximum output segment size. When the -gc option is in use, maxseg must be specified to override the default of 4Mb. Larger maxseg may cause greater memory utilization. Very small maxseg may cause very large output and thus, slow execution.
gor ... | segspan [-maxseg size] [-gc cols]
The maximum span of the segments in the input stream. Defaults to 4000000 (4Mb) with -gc option. This parameter can be used to ensure that the output segments are not too large.
Group columns, i.e. the span segment is calculated separately for each group.