www.gusucode.com > bioinfo 案例源码程序 matlab代码 > bioinfo/CleaveASequenceExample.m

    %% Cleave a sequence 
% This example shows how to cleave a sequence using trypsin.

% Copyright 2015 The MathWorks, Inc.


%%
% Retrieve a protein sequence from the GenPept database.

S = getgenpept('AAA59174');

%%
% Cleave the sequence using trypsin's cleavage rules and all known
% exceptions.
parts = cleave(S.Sequence,'trypsin');

%%
% Display the first ten fragments.
parts(1:10)
%%
% Cleave the sequence using trypsin's cleavage rules and a single specific
% exception rule.
parts = cleave(S.Sequence,'trypsin','exception','KD');
parts(1:10)
%%
% Cleave the sequence using one of trypsin's cleavage rules, which is to
% cleave after K or R when the next residue is not P.
[parts, sites, lengths] = cleave(S.Sequence,'[KR](?!P)',1);
for i = 1:10
    fprintf('%5d%5d   %s\n',sites(i),lengths(i),parts{i})
end
%%
% Cut the sequence using trypsin, allowing for 1 missed cleavage site.
[parts2, sites2, lengths2, missed] = cleave(S.Sequence,'trypsin','missedsites',1);
%%
% Display the first 10 fragments that have 1 missed cleavage site.
idx = find(missed);
for i = 1:10
    fprintf('%5d%5d   %s\n',sites2(idx(i)),lengths2(idx(i)),parts2{idx(i)})
end