Пример #1
0
def main():
    parser = argparse.ArgumentParser()

    help_backtrack = "Backtrack and output an optimal alignment along with the cost"
    parser.add_argument('-b',
                        '--backtrack',
                        help=help_backtrack,
                        action='store_true')
    help_seqs = "Path to FASTA file containing the three sequences"
    parser.add_argument('sequences', help=help_seqs)
    help_substmatrix = "Path to a file containing the score matrix"
    parser.add_argument("substmatrix", help=help_substmatrix)
    help_gapcost = 'Value for the linear gapcost'
    parser.add_argument('gapcost', type=int, help=help_gapcost)

    args = parser.parse_args()

    sequences_names_tuples = prj3.read_input_fasta(args.sequences)
    seqs = [tup[1] for tup in sequences_names_tuples]
    alphabet, substmatrix = prj2.read_input_score(args.substmatrix)
    gapcost = args.gapcost

    backtrack = args.backtrack
    print(
        prj3.sp_exact_3(seqs[0], seqs[1], seqs[2], substmatrix, gapcost,
                        alphabet, backtrack))
Пример #2
0
def main():
    parser = argparse.ArgumentParser()

    help_seqs = "Path to FASTA file containing the sequences"
    parser.add_argument('sequences', help=help_seqs)
    help_substmatrix = "Path to a file containing the score matrix"
    parser.add_argument("substmatrix", help=help_substmatrix)

    args = parser.parse_args()

    sequences_names_tuples = read_input_fasta(args.sequences)
    alphabet, substmatrix = prj2.read_input_score(args.substmatrix)

    run_tests(sequences_names_tuples, substmatrix, alphabet, 5)
Пример #3
0
def main():
    parser = argparse.ArgumentParser()

    help_seqs = "Path to FASTA file containing the three sequences"
    parser.add_argument('sequences', help=help_seqs)
    help_substmatrix = "Path to a file containing the score matrix"
    parser.add_argument("substmatrix", help=help_substmatrix)
    help_gapcost = 'Value for the linear gapcost'
    parser.add_argument('gapcost', type=int, help=help_gapcost)

    args = parser.parse_args()

    sequences_names_tuples = prj3.read_input_fasta(args.sequences)
    alphabet, substmatrix = prj2.read_input_score(args.substmatrix)
    gapcost = args.gapcost

    prj3.sp_approx_2(sequences_names_tuples, alphabet, substmatrix, gapcost)
Пример #4
0
def main():
    parser = argparse.ArgumentParser()

    input_seq1 = "Path to FASTA file containing the first sequence"
    parser.add_argument("seq1", help=input_seq1)
    input_seq2 = "Path to FASTA file containing the second sequence"
    parser.add_argument("seq2", help=input_seq2)
    input_scoreMatrix = "Path to a file containing the score matrix"
    parser.add_argument("scoreMatrix", help=input_scoreMatrix)
    input_alpha = "alpha value to be used in affine cost function"
    parser.add_argument("alpha", help=input_alpha, type=int)
    input_beta = "beta value to be used in affine cost function"
    parser.add_argument("beta", help=input_beta, type=int)
    input_backtrack = "returns an optimal alignment along with the cost"
    parser.add_argument('-b',
                        '--backtrack',
                        help=input_backtrack,
                        action='store_true')

    args = parser.parse_args()

    seq1 = p2.read_input_fasta(args.seq1)
    seq2 = p2.read_input_fasta(args.seq2)

    alphabet, scoreMatrix = p2.read_input_score(args.scoreMatrix)

    alphaCost = args.alpha
    betaCost = args.beta
    bool_backtrack = args.backtrack

    p2.alpha = alphaCost
    p2.beta = betaCost
    p2.mSub = scoreMatrix
    p2.alph = alphabet

    cost, alignment = p2.optimal_cost(seq1, seq2, min, bool_backtrack)
    print('cost: %i' % cost)
    if bool_backtrack:
        print('>seq1')
        print(alignment[0])
        print()
        print('>seq2')
        print(alignment[1])