summaryrefslogtreecommitdiff
path: root/src/matlab/quikr.m
diff options
context:
space:
mode:
authorCalvin <calvin@EESI>2013-05-14 17:00:33 -0400
committerCalvin <calvin@EESI>2013-05-14 17:00:33 -0400
commit5df6980969d7fefd0ca90769bd3b566cb5210c01 (patch)
tree866cf746553ac44d985f331ee6bb29f14ca6adad /src/matlab/quikr.m
parent6f4da548141286f7236823294788c3c18f5153db (diff)
have matlab use global executables
Diffstat (limited to 'src/matlab/quikr.m')
-rw-r--r--src/matlab/quikr.m23
1 files changed, 7 insertions, 16 deletions
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