def test_get_num_kept_reads():
    """
    Test the scale factor functinos
    """
    args = "--bam {}  -o /tmp/test".format(BAMFILE_A, BAMFILE_B).split()

    args = bam_cov.process_args(args)
    num_kept_reads, total_reads = gs.get_num_kept_reads(args)

    # bam file 1 has 2 reads in 3R and 2 read in chr_cigar
    assert num_kept_reads == 3, "num_kept_reads is wrong"
    assert total_reads == 3, "num total reads is wrong"

    # ignore chr_cigar to count the total number of reads
    args = "--bam {} --ignoreForNormalization chr_cigar  -o /tmp/test".format(
        BAMFILE_A, BAMFILE_B).split()
    args = bam_cov.process_args(args)
    num_kept_reads, total_reads = gs.get_num_kept_reads(args)

    # the  number of kept reads should be 2 as the read on chr_cigar is skipped
    assert num_kept_reads == 2, "num_kept_reads is wrong ({})".format(
        num_kept_reads)

    # test filtering by read direction. Only forward reads are kept
    args = "--bam {}  -o /tmp/test --samFlagExclude 16 --ignoreForNormalization chr_cigar ".format(
        BAMFILE_A, BAMFILE_B).split()

    args = bam_cov.process_args(args)
    num_kept_reads, total_reads = gs.get_num_kept_reads(args)

    # only one forward read is expected in
    assert num_kept_reads == 1, "num_kept_reads is wrong"
def test_get_num_kept_reads():
    """
    Test the scale factor functinos
    """
    args = "--bam {}  -o /tmp/test".format(BAMFILE_A, BAMFILE_B).split()

    args = bam_cov.process_args(args)
    num_kept_reads, total_reads = gs.get_num_kept_reads(args)

    # bam file 1 has 2 reads in 3R and 2 read in chr_cigar
    assert num_kept_reads == 3, "num_kept_reads is wrong"
    assert total_reads == 3, "num total reads is wrong"

    # ignore chr_cigar to count the total number of reads
    args = "--bam {} --ignoreForNormalization chr_cigar  -o /tmp/test".format(BAMFILE_A, BAMFILE_B).split()
    args = bam_cov.process_args(args)
    num_kept_reads, total_reads = gs.get_num_kept_reads(args)

    # the  number of kept reads should be 2 as the read on chr_cigar is skipped
    assert num_kept_reads == 2, "num_kept_reads is wrong ({})".format(num_kept_reads)

    # test filtering by read direction. Only forward reads are kept
    args = "--bam {}  -o /tmp/test --samFlagExclude 16 --ignoreForNormalization chr_cigar ".format(BAMFILE_A, BAMFILE_B).split()

    args = bam_cov.process_args(args)
    num_kept_reads, total_reads = gs.get_num_kept_reads(args)

    # only one forward read is expected in
    assert num_kept_reads == 1, "num_kept_reads is wrong"