Need help to built Bootstrapping Phylogenetic Trees in MATLAB
0
0
Entering edit mode
2.4 years ago
anasjamshed ▴ 120

I have these 4 sequences:

X: TACCCGAT 
Y: TAAACGAT 
Z: AAAACGCG 
W: AAAACGAT

I run this code in MATLAB:

%store all sequences in a single variable 'data'
data = {'X'   'TACCCGAT'
        'Y'   'TAAACGAT'
        'Z'   'AAAACGCG'
        'W'   'AAAACGAT'}
%find number of sequences
num_seqs = length(data)
%find distance among all sequences
dist = seqpdist(data)
%build average linkage tree by using all 4 sequences
tree =  seqlinkage(dist,'average',data)
%View Tree
phytreeviewer(tree);
num_boots = 5;
seq_len = length(data);

boots = cell(num_boots,1);
for n = 1:num_boots
    reorder_index = randsample(seq_len,seq_len,true);
    for i = num_seqs:-1:1 %reverse order to preallocate memory
        bootseq(i) = data(i);
        bootseq(i) = strrep(data(i),'-',''); 
    end
    boots{n} = bootseq; 
end

fun = @(x) seqlinkage(x,'average',{data});
boot_trees = cell(num_boots,1);
parpool('local');


for i = num_seqs-1:-1:1  % for every branch, reverse order to preallocate
    branch_pointer = i + num_seqs;
    sub_tree = subtree(tree,branch_pointer);
    orig_pointers{i} = getcanonical(sub_tree);
    orig_species{i} = sort(get(sub_tree,'LeafNames'));
end

But I got the error that: you need 2 leaves at least to make subtree.

Can anyone help me to solve this and also help me Confidence Values of the tree?

MATLAB • 494 views
ADD COMMENT

Login before adding your answer.

Traffic: 2505 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6