コード例 #1
0
ファイル: filter_results.py プロジェクト: mmysinger/labware
def handler(in_fn=None, out_fn=None, **kwargs):
    """I/O handling for the script."""
    if in_fn is None:
        in_f = sys.stdin
        logging.info("Inputing scores file from standard in")
    else:
        in_f = gopen(in_fn, "r")
        logging.info("Inputing scores file from %s" % in_fn)
    if out_fn is None:
        out_f = sys.stdout
        logging.info("Outputing scores file to standard out")
    else:
        out_f = gopen(out_fn, "w")
        logging.info("Outputing scores file to %s" % out_fn)
    sea_reader = csv.reader(in_f)
    sea_writer = csv.writer(out_f)
    try:
        try:
            filter_results(sea_reader, sea_writer, **kwargs)
        except ScriptError, message:
            logging.error(message)
            return message.value
    finally:
        in_f.close()
        out_f.close()
    return 0
コード例 #2
0
ファイル: compare_results.py プロジェクト: mmysinger/labware
def handler(seaware_fn, sea_fn, out_fn=None, **kwargs):
    """I/O handling for the script."""
    if out_fn is None:
        out_f = sys.stdout
    else:
        out_f = gopen(out_fn, "w")
    out_f.write("Using SEAware file: %s\n" % seaware_fn)
    seaware_f = gopen(seaware_fn , "r")
    seaware_reader = csv.reader(seaware_f)
    out_f.write("Using SEA file: %s\n" % sea_fn)
    sea_f = gopen(sea_fn , "r")
    sea_reader = csv.reader(sea_f)
    
    try:
        try:
            for result in compare_results(seaware_reader, sea_reader, **kwargs):
                out_f.write(result + "\n")
        except ScriptError, message:
            logging.error(message)
            return message.value
    finally:
        seaware_f.close()
        sea_f.close()
        out_f.close()
    return 0
コード例 #3
0
def handler(in_fn=None, out_fn=None, **kwargs):
    """I/O handling for the script."""
    if in_fn is None:
        in_f = sys.stdin
        in_location = "standard in"
    else:
        in_f = gopen(in_fn)
        in_location = in_fn
    logging.info("Input file: %s" % in_location)
    if out_fn is None:
        out_f = sys.stdout
        out_location = "standard out"
    else:
        out_f = gopen(out_fn, "w")
        out_location = out_fn
    logging.info("Output file: %s" % out_location)
    targets_reader = csv.reader(in_f)
    events_writer = csv.writer(out_f)
    try:
        try:
            for result in targets_to_events(targets_reader, **kwargs):
                events_writer.writerow(result)
        except ScriptError, message:
            logging.error(message)
            return message.value
    finally:
        in_f.close()
        out_f.close()
    return 0
コード例 #4
0
def handler(seaware_fn, sea_fn, out_fn=None, **kwargs):
    """I/O handling for the script."""
    if out_fn is None:
        out_f = sys.stdout
    else:
        out_f = gopen(out_fn, "w")
    out_f.write("Using SEAware file: %s\n" % seaware_fn)
    seaware_f = gopen(seaware_fn, "r")
    seaware_reader = csv.reader(seaware_f)
    out_f.write("Using SEA file: %s\n" % sea_fn)
    sea_f = gopen(sea_fn, "r")
    sea_reader = csv.reader(sea_f)

    try:
        try:
            for result in compare_results(seaware_reader, sea_reader,
                                          **kwargs):
                out_f.write(result + "\n")
        except ScriptError, message:
            logging.error(message)
            return message.value
    finally:
        seaware_f.close()
        sea_f.close()
        out_f.close()
    return 0
コード例 #5
0
ファイル: ef_sea_heatmap.py プロジェクト: mmysinger/labware
def handler(ef_fn, sea_fn, out_fn, **kwargs):
    """I/O handling for the script."""
    logging.info("EF input file: %s" % ef_fn)
    ef_f = gopen(ef_fn)
    ef_csv = csv.reader(ef_f)
    logging.info("SEA input file: %s" % sea_fn)
    sea_f = gopen(sea_fn)
    sea_csv = csv.reader(sea_f)
    logging.info("Output file: %s" % out_fn)
    try:
        try:
            dual_heatmap(ef_csv, sea_csv, out_fn, **kwargs)
        except ScriptError, message:
            logging.error(message)
            return message.value
    finally:
        ef_f.close()
        sea_f.close()
    return 0
コード例 #6
0
ファイル: ef_heatmap.py プロジェクト: mmysinger/labware
def handler(in_fn=None, out_fn=None, **kwargs):
    """I/O handling for the script."""
    in_f = gopen(in_fn)
    in_csv = csv.reader(in_f)
    try:
        try:
            heatmap(in_csv, out_fn, **kwargs)
        except ScriptError, message:
            logging.error(message)
            return message.value
    finally:
        in_f.close()
    return 0
コード例 #7
0
ファイル: heatmap.py プロジェクト: mmysinger/labware
def handler(in_fn=None, out_fn=None, **kwargs):
    """I/O handling for the script."""
    in_f = gopen(in_fn, "r")
    in_csv = csv.reader(in_f)
    try:
        try:
            heatmap(in_csv, out_fn, **kwargs)
        except ScriptError, message:
            logging.error(message)
            return message.value
    finally:
        in_f.close()
    return 0
コード例 #8
0
def handler(in_fn, targets_fn, out_fn, **kwargs):
    """I/O handling for the script."""
    logging.info("Input file: %s" % in_fn)
    in_f = gopen(in_fn)
    in_reader = csv.reader(in_f)
    logging.info("Targets file: %s" % targets_fn)
    targets_f = gopen(targets_fn)
    targets_reader = csv.reader(targets_f)
    logging.info("Output file: %s" % out_fn)
    out_f = gopen(out_fn, "wb")
    out_writer = csv.writer(out_f)
    try:
        try:
            for result in seaware_input_to_random_events(
                    in_reader, targets_reader, **kwargs):
                out_writer.writerow(result)
        except ScriptError, message:
            logging.error(message)
            return message.value
    finally:
        in_f.close()
        targets_f.close()
        out_f.close()
    return 0