• Please explain to me this MATLAB function

    Adelaid Member
    s={'CCCAGCTCCCGAATTCCCCA'};
    rec={'AG^CT'};
    cutsite=rebase_hassite(s,rec)
    
    function cutpos= rebase_hassite(s, rec)
    %coded by John Rozolis
    %tests string for cutting site AG^CT from regular expression
    %output is cut locations for string
    poscarrot=strfind(rec,'^');
    nocarrot=rec;
    nocarrot(poscarrot)=[];
    cutpos= strfind(s,nocarrot) + poscarrot -2;
    

    The second important function, ‘rebase_hassite.m’, receives two inputs: the user’s string and the recognition sequence field from the enzyme’s structure. The function uses strfind to locate the recognition sequence along the user’s string. Because recognition sequences are displayed with carrots, ‘rebase_hassite.m’ adjusts to look for the recognition sequences without a carrot. Then, the function records the location of the removed carrot within the sequence. The output of this function, a variable called cutpos, will be a vector of all locations of the cut positions found within the user’s string.

  • SapnaVishwas Member

    First it does strfind on rec and save it in poscarrot
    the original string will be saved in nocarrot
    That function stores in the variable cutpos the “cutted” position of your entered string. Look at what strfind does and try to answer why it does a + poscarrot-2

Viewing 1 reply thread
  • You must be logged in to reply to this topic.
en_USEnglish