static int gt_seqmutate_runner(int argc, const char **argv, int parsed_args, void *tool_arguments, GtError *err) { MutateArguments *arguments = tool_arguments; GtBioseqIterator *bsi; unsigned long i; GtBioseq *bioseq; GtSeq *mutated_seq; int had_err; gt_error_check(err); gt_assert(arguments); bsi = gt_bioseq_iterator_new(argc - parsed_args, argv + parsed_args); while (!(had_err = gt_bioseq_iterator_next(bsi, &bioseq, err)) && bioseq) { for (i = 0; i < gt_bioseq_number_of_sequences(bioseq); i++) { mutated_seq = gt_mutate_seq(gt_bioseq_get_description(bioseq, i), gt_bioseq_get_sequence(bioseq, i), gt_bioseq_get_sequence_length(bioseq, i), gt_bioseq_get_alphabet(bioseq), arguments->rate); gt_fasta_show_entry(gt_seq_get_description(mutated_seq), gt_seq_get_orig(mutated_seq), gt_seq_length(mutated_seq), arguments->width, arguments->outfp); gt_seq_delete(mutated_seq); } gt_bioseq_delete(bioseq); } gt_bioseq_iterator_delete(bsi); return had_err; }
GtPBSResults* gt_pbs_find(const char *seq, const char *rev_seq, GtLTRElement *element, GtPBSOptions *o, GtError *err) { GtSeq *seq_forward, *seq_rev; GtPBSResults *results; unsigned long j; GtAlignment *ali; GtAlphabet *a = gt_alphabet_new_dna(); GtScoreFunction *sf = gt_dna_scorefunc_new(a, o->ali_score_match, o->ali_score_mismatch, o->ali_score_insertion, o->ali_score_deletion); gt_assert(seq && rev_seq && sf && a && element); results = gt_pbs_results_new(element, o); seq_forward = gt_seq_new(seq + (gt_ltrelement_leftltrlen(element)) - (o->radius), 2*o->radius + 1, a); seq_rev = gt_seq_new(rev_seq + (gt_ltrelement_rightltrlen(element)) - (o->radius), 2*o->radius + 1, a); for (j=0;j<gt_bioseq_number_of_sequences(o->trna_lib);j++) { GtSeq *trna_seq, *trna_from3; char *trna_from3_full; unsigned long trna_seqlen; trna_seq = gt_bioseq_get_seq(o->trna_lib, j); trna_seqlen = gt_seq_length(trna_seq); trna_from3_full = gt_calloc(trna_seqlen, sizeof (char)); memcpy(trna_from3_full, gt_seq_get_orig(trna_seq), sizeof (char)*trna_seqlen); (void) gt_reverse_complement(trna_from3_full, trna_seqlen, err); trna_from3 = gt_seq_new_own(trna_from3_full, trna_seqlen, a); ali = gt_swalign(seq_forward, trna_from3, sf); gt_pbs_add_hit(results->hits, ali, o, trna_seqlen, gt_seq_get_description(trna_seq), GT_STRAND_FORWARD, results); gt_alignment_delete(ali); ali = gt_swalign(seq_rev, trna_from3, sf); gt_pbs_add_hit(results->hits, ali, o, trna_seqlen, gt_seq_get_description(trna_seq), GT_STRAND_REVERSE, results); gt_alignment_delete(ali); gt_seq_delete(trna_from3); } gt_seq_delete(seq_forward); gt_seq_delete(seq_rev); gt_score_function_delete(sf); gt_alphabet_delete(a); gt_array_sort(results->hits, gt_pbs_hit_compare); return results; }