Skip to content

Commit

Permalink
Updated segmentation docs
Browse files Browse the repository at this point in the history
  • Loading branch information
arnavm committed Aug 5, 2020
1 parent d158cb0 commit b0ee976
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
6 changes: 2 additions & 4 deletions docs/source/pages/api/segmentation.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
API: blockify.segmentation
API: Segmentation
==========================

.. automodule:: blockify.segmentation.SegmentationRecord
.. automodule:: blockify.segmentation
:members:

.. autofunction:: blockify.segmentation.segment
11 changes: 5 additions & 6 deletions lib/blockify/segmentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@


class SegmentationRecord(object):
"""A class to store Bayesian block segmentation, to facilitate
passing segmentations between modules."""
"""A class to store a single Bayesian block genomic segmentation."""
def __init__(self):
# # File to be segmented
# self.filename = None
Expand Down Expand Up @@ -58,7 +57,7 @@ def validateSegmentationArguments(input_file, p0, prior):


def blocksToDF(chrom, ranges):
"""Convert a set of contiguous Bayesian blocks to DataFrame format"""
"""Convert a set of contiguous Bayesian blocks to ``pandas`` DataFrame format"""
output = ""
# Chromosomes need at least two events at different positions
# to be able to report a block. If output is empty,
Expand Down Expand Up @@ -89,7 +88,8 @@ def segment(input_file, method, p0=None, prior=None):
Returns
-------
SegmentationRecord
segmentation: SegmentationRecord
A SegmentationRecord from segmenting the provided data
"""

# input_file is a BedTool object
Expand Down Expand Up @@ -145,9 +145,8 @@ def segment(input_file, method, p0=None, prior=None):
return segmentation


# Segment a genomic BED/qBED file from the command line
# Thin wrapper for segment()
def segment_from_command_line(args):
"""Wrapper function for the command line function ``blockify segment``"""
input_file = BedTool(args.input)
# Segment the input file
return segment(input_file, args.method, p0=args.p0, prior=args.prior)

0 comments on commit b0ee976

Please sign in to comment.