From 854c120916bc08ac631bd1cd9180b3be70760240 Mon Sep 17 00:00:00 2001 From: Waldir Leoncio Date: Tue, 14 Jul 2020 14:35:48 +0200 Subject: [PATCH] Documentation update --- NAMESPACE | 1 + R/greedyMix.R | 123 -------------------------------------------------- 2 files changed, 1 insertion(+), 123 deletions(-) diff --git a/NAMESPACE b/NAMESPACE index 70e107a..b7d74df 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -17,6 +17,7 @@ export(inputdlg) export(isfield) export(laskeMuutokset4) export(learn_simple_partition) +export(linkage) export(logml2String) export(lueGenePopData) export(lueNimi) diff --git a/R/greedyMix.R b/R/greedyMix.R index 1939e69..51e4e3d 100644 --- a/R/greedyMix.R +++ b/R/greedyMix.R @@ -832,75 +832,6 @@ greedyMix <- function( # k = children(~t) - m; # end - -# %--------------------------------------------------------------------------------------- - -# function [Z, dist] = newGetDistances(data, rowsFromInd) - -# ninds = max(data(:,end)); -# nloci = size(data,2)-1; -# riviLkm = nchoosek(ninds,2); - -# empties = find(data<0); -# data(empties)=0; -# data = uint8(data); % max(noalle) oltava <256 - -# pariTaulu = zeros(riviLkm,2); -# aPointer=1; -# for a=1:ninds-1 -# pariTaulu(aPointer:aPointer+ninds-1-a,1) = ones(ninds-a,1)*a; -# pariTaulu(aPointer:aPointer+ninds-1-a,2) = (a+1:ninds)'; -# aPointer = aPointer+ninds-a; -# end - -# eka = pariTaulu(:,ones(1,rowsFromInd)); -# eka = eka * rowsFromInd; -# miinus = repmat(rowsFromInd-1 : -1 : 0, [riviLkm 1]); -# eka = eka - miinus; - -# toka = pariTaulu(:,ones(1,rowsFromInd)*2); -# toka = toka * rowsFromInd; -# toka = toka - miinus; - -# %eka = uint16(eka); -# %toka = uint16(toka); - -# summa = zeros(riviLkm,1); -# vertailuja = zeros(riviLkm,1); - -# clear pariTaulu; clear miinus; - -# x = zeros(size(eka)); x = uint8(x); -# y = zeros(size(toka)); y = uint8(y); - -# for j=1:nloci; - -# for k=1:rowsFromInd -# x(:,k) = data(eka(:,k),j); -# y(:,k) = data(toka(:,k),j); -# end - -# for a=1:rowsFromInd -# for b=1:rowsFromInd -# vertailutNyt = double(x(:,a)>0 & y(:,b)>0); -# vertailuja = vertailuja + vertailutNyt; -# lisays = (x(:,a)~=y(:,b) & vertailutNyt); -# summa = summa+double(lisays); -# end -# end -# end - -# clear x; clear y; clear vertailutNyt; -# nollat = find(vertailuja==0); -# dist = zeros(length(vertailuja),1); -# dist(nollat) = 1; -# muut = find(vertailuja>0); -# dist(muut) = summa(muut)./vertailuja(muut); -# clear summa; clear vertailuja; - -# Z = linkage(dist'); - - # %---------------------------------------------------------------------------------------- @@ -946,60 +877,6 @@ greedyMix <- function( # %---------------------------------------------------------------------------------------- -# function Z = linkage(Y, method) -# [k, n] = size(Y); -# m = (1+sqrt(1+8*n))/2; -# if k ~= 1 | m ~= fix(m) -# error('The first input has to match the output of the PDIST function in size.'); -# end -# if nargin == 1 % set default switch to be 'co' -# method = 'co'; -# end -# method = lower(method(1:2)); % simplify the switch string. -# monotonic = 1; -# Z = zeros(m-1,3); % allocate the output matrix. -# N = zeros(1,2*m-1); -# N(1:m) = 1; -# n = m; % since m is changing, we need to save m in n. -# R = 1:n; -# for s = 1:(n-1) -# X = Y; -# [v, k] = min(X); -# i = floor(m+1/2-sqrt(m^2-m+1/4-2*(k-1))); -# j = k - (i-1)*(m-i/2)+i; -# Z(s,:) = [R(i) R(j) v]; % update one more row to the output matrix A -# I1 = 1:(i-1); I2 = (i+1):(j-1); I3 = (j+1):m; % these are temp variables. -# U = [I1 I2 I3]; -# I = [I1.*(m-(I1+1)/2)-m+i i*(m-(i+1)/2)-m+I2 i*(m-(i+1)/2)-m+I3]; -# J = [I1.*(m-(I1+1)/2)-m+j I2.*(m-(I2+1)/2)-m+j j*(m-(j+1)/2)-m+I3]; - -# switch method -# case 'si' %single linkage -# Y(I) = min(Y(I),Y(J)); -# case 'av' % average linkage -# Y(I) = Y(I) + Y(J); -# case 'co' %complete linkage -# Y(I) = max(Y(I),Y(J)); -# case 'ce' % centroid linkage -# K = N(R(i))+N(R(j)); -# Y(I) = (N(R(i)).*Y(I)+N(R(j)).*Y(J)-(N(R(i)).*N(R(j))*v^2)./K)./K; -# case 'wa' -# Y(I) = ((N(R(U))+N(R(i))).*Y(I) + (N(R(U))+N(R(j))).*Y(J) - ... -# N(R(U))*v)./(N(R(i))+N(R(j))+N(R(U))); -# end -# J = [J i*(m-(i+1)/2)-m+j]; -# Y(J) = []; % no need for the cluster information about j. - -# % update m, N, R -# m = m-1; -# N(n+s) = N(R(i)) + N(R(j)); -# R(i) = n+s; -# R(j:(n-1))=R((j+1):n); -# end - - -# %----------------------------------------------------------------------------------- - # function logml = ... # initialCounts(partition, data, npops, rows, noalle, adjprior)