first previous next last contents

tag_shift_for_insert

#include <tagUtils.h>

void tag_shift_for_insert(
        GapIO  *io,
        int     N,
        int     pos);

This function shifts or extends tags by a single base. The purpose is to handle cases where we need to insert into a sequence. An edit at position pos will mean moving every tag to the right of this one base rightwards. A tag that spans position pos will have it's length increased by one. If N is positive it specifies the reading number to operate on, otherwise it specifies the contig number (negated).

NOTE: This function does not work correctly for complemented readings. It is planned to fix this problem by creating a new function that operates in a more intelligent fashion. To work around this problem, logic similar to the following needs to be used.

    /*
     * Adjust tags
     * NOTE: Must always traverse reading in reverse of original sense
     */
    if (complemented) {
        for(i=j=0; i < gel_len; i++) {
            if (orig_seq[i] != padded_seq[j]) {
                tag_shift_for_insert(io, gel_num, length-j);
            } else
                j++;
        }
    } else {
        for(i=j=gel_len-1; i >= 0; i--) {
            if (orig_seq[i] != padded_seq[j]) {
                tag_shift_for_insert(io, gel_num, j+1);
            } else
                j--;
        }
    }

In the above example padded_seq is a padded copy of orig_seq. The function calls tag_shift_for_insert for each pad. Note that the order of the insertions is important and differs depending on whether the reading is complemented or not.


first previous next last contents
This page is maintained by staden-package. Last generated on 1 March 2001.
URL: http://www.mrc-lmb.cam.ac.uk/pubseq/manual/scripting_170.html