%This script loads data and runs p value calculation functions
%taken from Mindy.
addpath('../')
addpath('./1/')
mRNAData = importdata('../oriData2/RNA_geneSymbol_filter_AFDMET.exp')
metData = importdata('../oriData2/MET_sd10_noNA_AFDMET.exp')
cnvData = importdata('../oriData2/CNV_AFDMET.exp')
k = ceil(0.16*size(mRNAData.data, 2));
%../oriData2/Human_TF_1825_20140419withTitle_AFDMET.txt
tflist = importdata(['../oriData2/Human_TF_1825_20140419withTitle_AFDMET.txt']);
tfdata = zeros(1, size(mRNAData.data, 2));

c = 1;
for i = 2 : size(tflist.textdata, 1)
  pos = find(strcmp(mRNAData.textdata(2:end, 1), tflist.textdata(i, 1)));
  if isempty(pos)
    continue
  end
  tfdata(c,:) = mRNAData.data(pos(1),:);
  c = c + 1;

end
tfdata_fil = tfdata;

%with variables nameing mRNAData, metData, tfdata_fil
Sample
run('./1/Sample.m')  % load sample filter





metdata = metData.data;
disp('cp1')
%  function generate_cmi_mi_pv_null_dist_met(mRNAdata, tfdata, metData, cnvGenesymbol, cnvdata, mRNAname, RandSample, number) 

met_shuffle(mRNAData.data, tfdata_fil, ...
				 metdata, cnvData.textdata(2:end,:), cnvData.data, ...
                                                    mRNAData.textdata(:, 1), randSAMPLE, 1);
pvfunGen(['./' num2str(1) '/step1met_cmi_mi_null_dist.mat'], 1, '_step1');






