Module ImportFrom alias ImportFrom alias Import alias Import alias Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call NameLoad Str ListLoad Str Str Str FunctionDef arguments args NameParam NameParam defaults body Expr Str If CompareEq NameLoad Num body Return Str orelse If BoolOpAnd CompareGt NameLoad Num CompareLt BinOpDiv NameLoad NameLoad Num body Return Str orelse Return Str decorator_list FunctionDef arguments args NameParam NameParam defaults Str body Expr Str Assign NameStore ListLoad Call AttributeLoad Str attr NameLoad Call AttributeLoad Str attr NameLoad Assign NameStore ListLoad For NameStore NameLoad body Assign NameStore ListLoad Call AttributeLoad Str attr NameLoad NameLoad Expr Call AttributeLoad NameLoad attr Str NameLoad Assign NameStore Call AttributeLoad Call AttributeLoad NameLoad attr NameLoad keyword NameLoad attr Str Assign NameStore ListComp Call AttributeLoad NameLoad attr comprehension NameStore Call AttributeLoad NameLoad attr UnaryOpNot Call AttributeLoad NameLoad attr Str If CompareEq Call NameLoad NameLoad Num body Expr Call AttributeLoad NameLoad attr Call NameLoad SubscriptLoad SubscriptLoad NameLoad Index Num Index Num orelse Assign NameStore SubscriptLoad Call AttributeLoad NameLoad attr Str Index Num Expr Call AttributeLoad NameLoad attr Str NameLoad Expr Call AttributeLoad NameLoad attr Num Assign TupleStore NameStore NameStore Call NameLoad NameLoad Assign NameStore Call NameLoad NameLoad NameLoad Return Call NameLoad NameLoad NameLoad NameLoad decorator_list
N/A __future__ division collections namedtuple N/A logging N/A subprocess N/A logger N/A N/A logging getLogger __name__ N/A SexGuess N/A namedtuple SexGuess N/A x_coverage y_coverage sex predict_sex N/A N/A x_coverage y_coverage N/A N/A N/A Make a simple yet accurate prediction of a samples sex.

    The calculation is based on the average coverage across the X and Y
    chromosomes. Note that an extrapolation from a subsection of bases is
    usually quite sufficient.

    Args:
        x_coverage (float): estimated average coverage on X chromosome
        y_coverage (float): estimated average coverage on Y chromosome

    Returns:
        str: prediction, ['male', 'female', 'unknown']
     N/A N/A x_coverage 0 N/A N/A unknown N/A N/A N/A N/A y_coverage 0 N/A N/A x_coverage y_coverage 10 N/A N/A male N/A N/A female N/A sex_from_bam N/A N/A bam_path prefix N/A N/A N/A Predict the sex from a BAM alignment file.

    Args:
        bam_path (path): path to a BAM alignment file
        prefix (str, optional): string to prefix to 'X', 'Y'

    Returns:
        SexGuess: tuple of X coverage, Y coverage, and sex prediction

    Examples:
        >>> sex_from_bam('alignment.bam', prefix='chr')
        SexGuess(x_coverage=123.31, y_coverage=0.13, sex='female')
     N/A regions N/A N/A N/A {}X:1-59373566 format prefix N/A N/A {}Y:69362-11375310 format prefix N/A averages N/A N/A region regions N/A N/A command N/A N/A N/A sambamba depth region -L {} {} format region bam_path N/A N/A N/A logger debug calling: %s command N/A bed_out N/A N/A N/A N/A subprocess check_output command shell True decode utf-8 N/A bed_rows N/A N/A N/A line split N/A line N/A N/A bed_out splitlines N/A N/A N/A line startswith # N/A N/A N/A len bed_rows 1 N/A N/A N/A N/A averages append N/A float N/A N/A bed_rows N/A 0 N/A 4 N/A N/A chromosome N/A N/A N/A region split : N/A 0 N/A N/A N/A logger warn couldn't find any reads on %s-chromosome chromosome N/A N/A N/A averages append 0.0 N/A N/A x_coverage y_coverage N/A list averages N/A sex N/A predict_sex x_coverage y_coverage N/A N/A SexGuess x_coverage y_coverage sex N/A