From 5df6980969d7fefd0ca90769bd3b566cb5210c01 Mon Sep 17 00:00:00 2001 From: Calvin Date: Tue, 14 May 2013 17:00:33 -0400 Subject: have matlab use global executables --- src/matlab/quikr.m | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) (limited to 'src/matlab/quikr.m') diff --git a/src/matlab/quikr.m b/src/matlab/quikr.m index d24596e..f43ae8f 100644 --- a/src/matlab/quikr.m +++ b/src/matlab/quikr.m @@ -12,21 +12,12 @@ function xstar = quikr(inputfasta) %orientation, so as a preprocessing step, make sure everything is in the %forward (+) orientation. if nargin>1 - error('too many input arguments'); -end -if (isunix && not(ismac)) %If linux, use ./count-linux - [status, counts]=unix(['./count-linux -r 6 -1 -u ' inputfasta]); %count the 6-mers in the fasta file, in the forward direction, return the counts without labels - if status ~= 0 - error('./count-linux failed: ensure count-linux is an executable. Try chmod a+rx count-linux. Be sure matlab/octave is in the same directory as count-linux'); - end -elseif ismac %If mac, then use ./count-osx - [status, counts]=unix(['./count-osx -r 6 -1 -u ' inputfasta]); %count the 6-mers in the fasta file, in the forward direction, return the counts without labels - if status ~= 0 - error('./count-osx failed: ensure count-linux is an executable. Try chmod a+rx count-osx. Be sure matlab/octave is in the same directory as count-osx'); - end -elseif ispc - error('Windows is not yet supported'); -end + error('too many input arguments'); + +[status, counts]=unix(['count-kmers -r 6 -1 -u ' inputfasta]); %count the 6-mers in the fasta file, in the forward direction, return the counts without labels +if status ~= 0 + error('count-kmers failed: ensure count-kmers is in your path.'); + counts=textscan(counts,'%f'); %convert into floats counts=counts{:}; %make into a vector counts=counts/sum(counts); %form a probability vector from the counts @@ -49,4 +40,4 @@ end %Matlab automatically reads it in correctly, just need to rename it warning off xstar=lsqnonneg(Aaux,yaux); %perform the nonnegative least squares warning on -xstar=xstar/sum(xstar); %transform the output into a probability vector. Note this vector is on the same basis as Aaux, so the entries correspond to sequences in trainset7_112011.fa \ No newline at end of file +xstar=xstar/sum(xstar); %transform the output into a probability vector. Note this vector is on the same basis as Aaux, so the entries correspond to sequences in trainset7_112011.fa -- cgit v1.2.3