Team:Alberta/Project/Modeling/FindMatchesArray

From 2009.igem.org

Revision as of 02:04, 18 October 2009 by Ebennett (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
function [MatchListArray, Diff, minimumDiff, positionOfMinimumDiff] = FindMatchListArray(List, CellArrayOfLists)
%example: CellArrayOfLists = MinimalGenomeArray;
%example: List = YourSuspectedResearchedLiteratureEssentialGenes; (or your
%suspected minimal genome)
%If the lists were chosen in this way, the Researched List would be compared with every
%Minimal Genome list one at a time.  For each comparison, this code
%would output (for this example) the list of matches and lets you know which
%list you should analyze further to improve your researched gene list.
Diff=zeros(1);
MatchListArray=cell(1);

for z=1:length(CellArrayOfLists)
z
    r=1;
    MatchList=cell(1);

    Match=zeros(max(length(CellArrayOfLists{z}), length(List)));

    for a=(1:length(CellArrayOfLists{z}))
        for b=(1:length(List))
            if strcmp(CellArrayOfLists{z}(a), List(b)) == 1
                Match(b)=1;
            end
        end
        a;
    end


    for c=1:length(List)
        if Match(c) == 1
            MatchList(r) = List(c);
            r=r+1;
        end
    end
    
    MatchList=MatchList';
    %NumberOfMatches=sum(Match) %sum(Match) not MatchList

    MatchListArray{z}=MatchList
end


for t=1:length(CellArrayOfLists)
    Diff(t)=length(CellArrayOfLists{t})-length(MatchListArray{t});
end
Diff
 
[minimumDiff, positionOfMinimumDiff] = min(Diff)

[maxValue minValue avg minPosition] = MaxMinAvg(MatchListArray)

disp('Use InvertList.m on the researched essential genes and the MatchListArray entry that has the smallest difference')
disp('Or use InverListArray.m on the researched essential genes and the whole MatchListArray')
disp('It would output what genes the model is suggesting should be included in the researched list')