Пример #1
0
def reverse_complement(context, dataset, sort_result=False, listing=False):
    """
    Runs reverse_complement(pattern). The input variable 'pattern' is read from the DATASET
    argument, where DATASET is the text file containing the input data.
    """
    challenge = context.obj['CHALLENGE']

    data = dsr.ReverseComplementDataset(dataset, challenge)

    pattern = data.pattern
    correct_result = get_correct_result(data, challenge)

    args = [pattern]
    func = bioinfo1.reverse_complement

    cli_output(challenge, correct_result, sort_result, listing, func, args)
Пример #2
0
def minimum_skew(context, dataset, sort_result=False, listing=False):
    """
    Runs minimum_skew(genome). The input variable 'genome' is read from the DATASET argument, where
    DATASET is the text file containing the input data.
    """
    challenge = context.obj['CHALLENGE']

    data = dsr.MinimumSkewDataset(dataset, challenge)

    genome = data.genome
    correct_result = get_correct_result(data, challenge)

    args = [genome]
    func = bioinfo1.minimum_skew

    cli_output(challenge, correct_result, sort_result, listing, func, args)
Пример #3
0
def median_string(context, dataset, sort_result=True, listing=False):
    """
    Runs median_string(dna, k). The input variables 'dna' and 'k'
    are read from the DATASET argument, where DATASET is the text file containing the input data.
    """
    challenge = context.obj['CHALLENGE']

    data = dsr.MedianString(dataset, challenge)
    dna = data.dna
    k = data.k

    correct_result = get_correct_result(data, challenge)

    args = dna, k
    func = bioinfo1.median_string

    cli_output(challenge, correct_result, sort_result, listing, func, args)
Пример #4
0
def frequent_words(context, dataset, sort_result=False, listing=False):
    """
    Runs frequent_words_by_sorting(text, k). The input variables 'text' and 'k' are read from the
    DATASET argument, where DATASET is the text file containing the input data.
    """
    challenge = context.obj['CHALLENGE']

    data = dsr.FrequentWordsDataset(dataset, challenge)

    text = data.text
    k = data.k
    correct_result = get_correct_result(data, challenge)

    args = text, k
    func = bioinfo1.frequent_words_by_sorting

    cli_output(challenge, correct_result, sort_result, listing, func, args)
Пример #5
0
def number_to_pattern(context, dataset, sort_result=False, listing=False):
    """
    Runs number_to_pattern(number, k). The input variables 'number' and 'k' are read from the
    DATASET argument, where DATASET is the text file containing the input data.
    """
    challenge = context.obj['CHALLENGE']

    data = dsr.NumberToPatternDataset(dataset, challenge)

    number = data.number
    k = data.k
    correct_result = get_correct_result(data, challenge)

    args = number, k
    func = bioinfo1.number_to_pattern

    cli_output(challenge, correct_result, sort_result, listing, func, args)
Пример #6
0
def neighbors(context, dataset, sort_result=True, listing=True):
    """
    Runs neighbors(pattern, d). The input variables 'pattern' and 'd' are read from the DATASET
    argument, where DATASET is the text file containing the input data.
    """
    challenge = context.obj['CHALLENGE']

    data = dsr.NeighborsDataset(dataset, challenge)

    pattern = data.pattern
    d = data.d
    correct_result = get_correct_result(data, challenge)

    args = pattern, d
    func = bioinfo1.neighbors

    cli_output(challenge, correct_result, sort_result, listing, func, args)
Пример #7
0
def hamming_distance(context, dataset, sort_result=False, listing=False):
    """
    Runs hamming_distance(string1, string2). The input variables 'string1' and 'string2' are read
    from the DATASET argument, where DATASET is the text file containing the input data.
    """
    challenge = context.obj['CHALLENGE']

    data = dsr.HammingDistanceDataset(dataset, challenge)

    string1 = data.string1
    string2 = data.string2
    correct_result = get_correct_result(data, challenge)

    args = string1, string2
    func = bioinfo1.hamming_distance

    cli_output(challenge, correct_result, sort_result, listing, func, args)
Пример #8
0
def greedy_motif_search(context, dataset, sort_result=False, listing=False):
    """
    Runs greedy_motif_search(dna, k, t). The input variables 'dna', 'k' and 't'
    are read from the DATASET argument, where DATASET is the text file containing the input data.
    """
    challenge = context.obj['CHALLENGE']

    data = dsr.GreedyMotifSearch(dataset, challenge)
    dna = data.dna
    k = data.k
    t = data.t

    correct_result = get_correct_result(data, challenge)

    args = dna, k, t
    func = bioinfo1.greedy_motif_search
    cli_output(challenge, correct_result, sort_result, listing, func, args)
Пример #9
0
def approx_count(context, dataset, sort_result=False, listing=False):
    """
    Runs approx_pattern_count(pattern, text, d). The input variables 'pattern', 'text' and 'd' are
    read from the DATASET argument, where DATASET is the text file containing the input data.
    """
    challenge = context.obj['CHALLENGE']

    data = dsr.ApproxCountDataset(dataset, challenge)

    pattern = data.pattern
    text = data.text
    d = data.d
    correct_result = get_correct_result(data, challenge)

    args = pattern, text, d
    func = bioinfo1.approx_pattern_count

    cli_output(challenge, correct_result, sort_result, listing, func, args)
Пример #10
0
def pattern_matching(context, dataset, sort_result=False, listing=False):
    """
    Runs pattern_matching_problem(pattern, genome). The input variables 'pattern' and 'genome' are
    read from the DATASET argument, where DATASET is the text file containing the input data. This
    function is only available in Code Challenge mode.
    """
    challenge = context.obj['CHALLENGE']

    data = dsr.PatternMatchingDataset(dataset, challenge)

    pattern = data.pattern
    genome = data.genome
    correct_result = get_correct_result(data, challenge)

    args = pattern, genome
    func = bioinfo1.pattern_matching_problem

    cli_output(challenge, correct_result, sort_result, listing, func, args)
Пример #11
0
def pattern_count(context, dataset, sort_result=False, listing=False):
    """
    Runs pattern_count(text, pattern). The input variables 'text' and 'pattern' are read from the
    DATASET argument, where DATASET is the text file containing the input data.
    """
    import ipdb
    ipdb.set_trace()
    challenge = context.obj['CHALLENGE']

    data = dsr.PatternCountDataset(dataset, challenge)

    text = data.text
    pattern = data.pattern
    correct_result = get_correct_result(data, challenge)

    args = text, pattern
    func = bioinfo1.pattern_count

    cli_output(challenge, correct_result, sort_result, listing, func, args)
Пример #12
0
def motif_enumeration(context, dataset, sort_result=True, listing=False):
    """
    Runs motif_enumeration(dna, k, d). The input variables 'dna', 'k' and 'd' are read from the
    DATASET argument, where DATASET is the text file containing the input data.
    """
    challenge = context.obj['CHALLENGE']

    data = dsr.MotifEnumerationDataset(dataset, challenge)

    dna = data.dna
    k = data.k
    d = data.d

    correct_result = get_correct_result(data, challenge)

    args = dna, k, d
    func = bioinfo1.motif_enumeration

    cli_output(challenge, correct_result, sort_result, listing, func, args)
Пример #13
0
def clump_finding(context, dataset, sort_result=False, listing=False):
    """
    Runs better_clump_finding(genome, k, l, t). The input variables 'genome', 'k', 'l', and 't' are
    read from the DATASET argument, where DATASET is the text file containing the input data.
    """
    challenge = context.obj['CHALLENGE']

    data = dsr.ClumpFindingDataset(dataset, challenge)

    genome = data.genome
    k = data.k
    l = data.l
    t = data.t
    correct_result = get_correct_result(data, challenge)

    args = genome, k, l, t
    func = bioinfo1.better_clump_finding

    cli_output(challenge, correct_result, sort_result, listing, func, args)
Пример #14
0
def gibbs_sampler(context, dataset, sort_result=False, listing=False):
    """

    """
    challenge = context.obj['CHALLENGE']
    if challenge:
        listing = True

    data = dsr.GibbsSampler(dataset, challenge)
    dna = data.dna
    k = data.k
    t = data.t
    n = data.n

    correct_result = get_correct_result(data, challenge)

    args = dna, k, t, n
    # func = bioinfo1.gibbs_sampler
    func = bioinfo1.gibbs_sampler_loop
    cli_output(challenge, correct_result, sort_result, listing, func, args)
Пример #15
0
def frequent_words_mismatches(context,
                              dataset,
                              sort_result=False,
                              listing=False):
    """
    Runs frequent_words_with_mismatches(pattern, k, d). The input variables 'pattern', 'k' and 'd'
    are read from the DATASET argument, where DATASET is the text file containing the input data.
    """
    challenge = context.obj['CHALLENGE']

    data = dsr.FrequentWordsMismatchesDataset(dataset, challenge)

    text = data.text
    k = data.k
    d = data.d
    correct_result = get_correct_result(data, challenge)

    args = text, k, d
    func = bioinfo1.frequent_words_with_mismatches_sorting

    cli_output(challenge, correct_result, sort_result, listing, func, args)
Пример #16
0
def distance_between_pattern_and_string(context,
                                        dataset,
                                        sort_result=True,
                                        listing=False):
    """
    Runs distance_between_pattern_and_string(pattern, dna). The input variables 'pattern' and 'dna'
    are read from the DATASET argument, where DATASET is the text file containing the input data.
    """
    challenge = context.obj['CHALLENGE']

    data = dsr.DistanceBetweenPatternAndString(dataset, challenge)

    pattern = data.pattern
    dna = data.dna

    correct_result = get_correct_result(data, challenge)

    args = pattern, dna
    func = bioinfo1.distance_between_pattern_and_strings

    cli_output(challenge, correct_result, sort_result, listing, func, args)
Пример #17
0
def profile_most_probable_kmer(context,
                               dataset,
                               sort_result=False,
                               listing=False):
    """
    Runs profile_most_probable_kmer(text, k, profile). The input variables 'text', 'k' and 'profile'
    are read from the DATASET argument, where DATASET is the text file containing the input data.
    """
    challenge = context.obj['CHALLENGE']

    data = dsr.ProfileMostProbableKmer(dataset, challenge)
    text = data.text
    k = data.k
    profile = data.profile

    correct_result = get_correct_result(data, challenge)

    args = text, k, profile
    func = bioinfo1.profile_most_probable_kmer

    cli_output(challenge, correct_result, sort_result, listing, func, args)