Skip to content

Commit 460e2a7

Browse files
updated
1 parent 6bb7ae5 commit 460e2a7

File tree

1 file changed

+28
-7
lines changed

1 file changed

+28
-7
lines changed

MATLAB/scrabble.m

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
function dataRecovered = scrabble(data,parameter,nIter)
1+
function dataRecovered = scrabble(data,parameter,nIter,nIter_inner,error_inner_threshold,error_outer_threshold)
22

33
%% DESCRIPTION
44
% SCRABBLE: scrabble is used to impute the scRNAseq combining with
@@ -23,18 +23,41 @@
2323
% input data matrix.
2424
%
2525
% nIter: nIter is the maximal number of iterations. The recommmdation times of
26-
% iteration are 100.
26+
% iteration are 20.
2727

2828
% AUTHOR: Tao Peng
2929
% Email: pengt@email.chop.edu
3030

3131
%% Main Codes
3232
% Check the inputs of SCRABBLE
33-
if nargin < 3
33+
if nargin < 2
3434
disp('The inputs of SCRABBLE are not enough. Please check your input.')
3535
return;
3636
end
3737

38+
if nargin == 2
39+
nIter = 20;
40+
nIter_inner = 20; % the maximum iteration times in the inner optimization
41+
error_inner_threshold = 1e-4; % set up the threshold for the inner loop
42+
error_outer_threshold = 1e-4; % set up the threshold for the outer loop
43+
end
44+
45+
if nargin == 3
46+
nIter_inner = 20; % the maximum iteration times in the inner optimization
47+
error_inner_threshold = 1e-4; % set up the threshold for the inner loop
48+
error_outer_threshold = 1e-4; % set up the threshold for the outer loop
49+
end
50+
51+
52+
if nargin == 4
53+
error_inner_threshold = 1e-4; % set up the threshold for the inner loop
54+
error_outer_threshold = 1e-4; % set up the threshold for the outer loop
55+
end
56+
57+
if nargin == 5
58+
error_outer_threshold = 1e-4; % set up the threshold for the outer loop
59+
end
60+
3861
% Determine if the data is consistent or not.
3962
if ~isempty(data.data_sc) && ~isempty(data.data_bulk)
4063
disp('The scRNAseq data and bulk RNAseq data is loaded.')
@@ -50,7 +73,7 @@
5073
zones = (Y > 0); % calculate the projection operator
5174
alpha = parameter(1); % define the weight of rank
5275
beta = parameter(2); % define the weight of consistency of bulk RNAseq
53-
gamma = 1e-3*parameter(1); % define the regularization coefficient
76+
gamma = parameter(3); % define the regularization coefficient
5477

5578
% generate the bulk RNAseq.
5679
% Here we consider two cases. One is the input including the bulk RNAseq
@@ -83,9 +106,7 @@
83106
% Since we save the time of optimization, we found that the 2 can get good
84107
% performance. If we could not get good performance, we could increase the
85108
% iteration times here.
86-
nIter_inner = 10; % the maximum iteration times in the inner optimization
87-
error_inner_threshold = 1e-6; % set up the threshold for the inner loop
88-
error_outer_threshold = 1e-7; % set up the threshold for the outer loop
109+
89110
gamma = double(gamma); % make the scalar double
90111
Y = double(Y); % make the matrix double
91112
B = double(B); % make the matrix double

0 commit comments

Comments
 (0)