diff options
author | Calvin Morrison <mutantturkey@gmail.com> | 2014-03-06 20:37:04 -0500 |
---|---|---|
committer | Calvin Morrison <mutantturkey@gmail.com> | 2014-03-06 20:37:04 -0500 |
commit | d3a935d76bc5ee6c211184c50790e6576654ca67 (patch) | |
tree | df5c6ab8913e6820ea5973ae1edf4641dd038369 /src/matlab/quikrTrain.m | |
parent | 36e44b275cc40c7151bbc5c311bef4fd31d6f89c (diff) |
UNVERIFIED but progress on converting quikr.m to dna-utils
Diffstat (limited to 'src/matlab/quikrTrain.m')
-rw-r--r-- | src/matlab/quikrTrain.m | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/matlab/quikrTrain.m b/src/matlab/quikrTrain.m index 86a994b..be4a85b 100644 --- a/src/matlab/quikrTrain.m +++ b/src/matlab/quikrTrain.m @@ -19,17 +19,14 @@ outputfilename=fullfile(pathtofile, [filename sprintf('-sensingmatrixK%d.txt',k) %crashes when unix() returns as many entries as ./probabilities-by-read
%does (on the order of ~2*10^10).
-kmerfilename=sprintf('%dmers.txt',k); %This contains the list of 6-mers to count. In future versions this will be computed locally instead of being read in.
-
-unix(['probabilities-by-read ' sprintf('%d',k) ' ' inputfasta ' <( generate_kmers ' sprintf('%d',k) ') > ' outputfilename]); %obtain the k-mer counts of the inputfasta read-by-read
+unix(['kmer_counts_per_sequence -k ' sprintf('%d',k) ' -i ' inputfasta '>' outputfilename]);
fid=fopen(outputfilename); %open the output file
-
-%A=textscan(fid,'%f'); %get all the counts
-%A=A{:};
A=fscanf(fid,'%f');
+
mat=sparse(reshape(A,4^k,length(A)/4^k)); %form into a matrix
mat=bsxfun(@rdivide,mat,sum(mat,1)); %column-normalize
+
fclose(fid); %close file
delete(outputfilename); %delete the file
|