Commit fbd396d2 authored by Chris Cheshire's avatar Chris Cheshire
Browse files

frip now checks for empty files

parent febfcb6f
Loading
Loading
Loading
Loading
+21 −9
Original line number Diff line number Diff line
@@ -37,6 +37,17 @@ peak_file_list = glob.glob(args.peaks)

frips = []
for idx, bam_file in enumerate(bam_file_list):
    # Init
    frip = 0

    # Read first line
    first_line = None
    with open(peak_file_list[idx], "r") as file:
        for line in file:
            first_line = line
            break
    
    if first_line is not None:
        print("Calculating " + bam_file + " using " + peak_file_list[idx])
        cr = crpb.CountReadsPerBin([bam_file], bedFile=[peak_file_list[idx]], numberOfProcessors=int(args.threads))

@@ -49,6 +60,7 @@ for idx, bam_file in enumerate(bam_file_list):

        # Calc frip
        frip = float(total[0]) / bam.mapped

    frips.append(str(frip))

    # Log