def get_baseline_probs(baseline_f):
    """
    Read in baseline probabilities from a file that has them listed
    in the first line non commented line. # lines are ignored as comments

    Args:
        baseline_f (str): a file containing a probability array of the form:
            [ PrA PrC PrG PrT ]
           Where PrA + PrC + PrG + PrT = 1 (and all are positive and non-zero)

        note1: the file can contain header lines marked by #
        note2: file format can technically be separated by arbitrary strings of
            any whitespace characters (space, tab, newline, return, formfeed).
            Only space tested during code development.
        note3: Separator must be whitespace, commas converted to empty string.
        note4: Subsequent lines ignored once a properly formatted line is found

    Returns:
        bp_array (list): List of the probabilities for each base: [ PrA, PrC, PrT, PrG ]

    """

    # Default baseline probability numbers (assumes all are equally likely)
    bp_array = [0.25, 0.25, 0.25, 0.25]

    # YYY: note safer if check for invalid files everywhere
    if baseline_f is None:
        return bp_array

    with open(baseline_f) as f:
        try:
            for line in f:
                # remove header
                if line.startswith("#"):
                    continue
                # remove commas, brackets, and whitespace on far left and right
                line = line.strip().replace('[', '').replace(']', '').replace(',', '')
                if line != "":
                    line = line.split()
                    if (len(line) >= 4):
                        for idx in range(4):
                            bp_array[idx] = float(line[idx])
                        return bp_array
        except ValueError:
            print(("**ERROR** Baseline probability file incorrectly formatted.\n" +
                  "\tFile should contain only [ PrA PrC PrG PrT ] \n" +
                  "\tWhere PrA + PrC + PrG + PrT = 1 (and all are positive and non-zero)\n" +
                  "\tContinuing with default probabilities: " + format(bp_array)))
            return bp_array

        print(("**ERROR** Empty baseline probability file found.\n" +
              "\tFile should contain only [ PrA PrC PrG PrT ] \n" +
              "\tWhere PrA + PrC + PrG + PrT = 1 (and all are positive and non-zero)\n" +
              "\tContinuing with default probabilities: " + format(bp_array)))
        return bp_array