Skip to content

main

Find the minimum number of responsive genes in a list of DataFrames.

This function takes a list of DataFrames and finds the minimum number of responsive genes in any of the DataFrames. This is used to normalize the rank response across expression data sets.

Parameters:

Name Type Description Default
args Namespace

The parsed command line arguments.

required

Returns:

Type Description
None

None. prints the minimum number of responsive genes in any of the

None

DataFrames to stdout.

Source code in callingcardstools/Analysis/yeast/rank_response/find_min_responsive_main.py
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
def main(args: argparse.Namespace) -> None:
    """
    Find the minimum number of responsive genes in a list of DataFrames.

    This function takes a list of DataFrames and finds the minimum number of
    responsive genes in any of the DataFrames. This is used to normalize the
    rank response across expression data sets.

    Args:
        args (argparse.Namespace): The parsed command line arguments.

    Returns:
        None. prints the minimum number of responsive genes in any of the
        DataFrames to stdout.
    """
    none_pattern = r'(?i)^none$'

    try:
        effect_col_list = \
            [None if bool(re.match(none_pattern, x)) else str(x)
             for x in args.effect_col_list]
    except ValueError as exc:
        logger.error("Error in `find_min_responsive_main()`: %s", exc)
        raise

    try:
        effect_thres_list = \
            [None if bool(re.match(none_pattern, x)) else float(x)
             for x in args.effect_thres_list]
    except ValueError as exc:
        logger.error("Error in `find_min_responsive_main()`: %s", exc)
        raise

    try:
        pval_col_list = \
            [None if bool(re.match(none_pattern, x)) else str(x)
             for x in args.pval_col_list]
    except ValueError as exc:
        logger.error("Error in `find_min_responsive_main()`: %s", exc)
        raise

    try:
        pval_thres_list = \
            [None if bool(re.match(none_pattern, x)) else float(x)
             for x in args.pval_thres_list]
    except ValueError as exc:
        logger.error("Error in `find_min_responsive_main()`: %s", exc)
        raise

    try:
        min_responsive = find_min_responsive(args.data_path_list,
                                             args.identifier_col_list,
                                             effect_col_list,
                                             effect_thres_list,
                                             pval_col_list,
                                             pval_thres_list)

        print(min_responsive)
    except (KeyError, TypeError, FileNotFoundError) as exc:
        logger.error("Error in `find_min_responsive_main()`: %s", exc)
        raise