Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesjcai committed May 5, 2024
1 parent 6ce2b35 commit 962cf0b
Show file tree
Hide file tree
Showing 7 changed files with 78 additions and 45 deletions.
74 changes: 37 additions & 37 deletions +gui/callback_CompareCellScoreBtwCls.m
Original file line number Diff line number Diff line change
Expand Up @@ -73,22 +73,22 @@

% ------------------------------------------------

[selecteditem] = gui.i_selectcellscore;
[selecteditem, speciesid] = gui.i_selgenesetcollection;
if isempty(selecteditem), return; end
%try

switch selecteditem
%case 'Global Coordination Level (GCL) [PMID:33139959]'

case 'Define a New Score...'
ttxt = 'Customized Score';
[posg] = gui.i_selectngenes(sce.g,[],FigureHandle);
if isempty(posg)
helpdlg('No feature genes selected.', '')
return;
end
[y] = gui.e_cellscore(sce, posg);
case 'MSigDB Signature Score...'
% case 'Define a New Score...'
% ttxt = 'Customized Score';
% [posg] = gui.i_selectngenes(sce.g,[],FigureHandle);
% if isempty(posg)
% helpdlg('No feature genes selected.', '')
% return;
% end
% [y] = gui.e_cellscore(sce, posg);
case 'MSigDB Molecular Signatures'
speciestag = gui.i_selectspecies(2, true);
if isempty(speciestag), return; end
try
Expand All @@ -112,7 +112,7 @@
gui.gui_waitbar(fw);


case 'PanglaoDB Cell Type Marker Score...'
case 'PanglaoDB Cell Type Markers'
speciestag = gui.i_selectspecies(2, true);
if isempty(speciestag), return; end

Expand Down Expand Up @@ -216,7 +216,7 @@
% 'Expression Level', cL, colorit);
% return;

case 'Select a Predefined Score...'
case 'Custom Gene Sets'
if ~gui.gui_showrefinfo('Predefined Cell Score'), return; end
[~, T] = pkg.e_cellscores(sce.X, sce.g, 0);
listitems = T.ScoreType;
Expand All @@ -237,20 +237,20 @@
end
gui.gui_waitbar(fw);

case 'Other Cell Attribute...'
[y, clabel, ~, newpickclabel] = gui.i_select1state(sce, true);
if isempty(y)
helpdlg('No cell attribute is available.');
return;
end
if ~isempty(newpickclabel)
ttxt = newpickclabel;
else
ttxt = clabel;
end
posg = [];
% case 'Other Cell Attribute...'
% [y, clabel, ~, newpickclabel] = gui.i_select1state(sce, true);
% if isempty(y)
% helpdlg('No cell attribute is available.');
% return;
% end
% if ~isempty(newpickclabel)
% ttxt = newpickclabel;
% else
% ttxt = clabel;
% end
% posg = [];
case {'TF Activity Score [PMID:33135076] 🐢', ...
'TF Targets Expression Score...'}
'DoRothEA TF Targets'}
[T] = pkg.e_gettflist;
listitems = unique(T.tf);

Expand All @@ -259,19 +259,19 @@
'SelectionMode', 'single', 'ListString', ...
listitems, 'ListSize', [220, 300]);
if tf2 ~= 1, return; end
species = gui.i_selectspecies(2);
if isempty(species), return; end
%species = gui.i_selectspecies(2);
%if isempty(species), return; end

if strcmp(selecteditem, 'TF Targets Expression Score...')
methodid = 1; % UCell method
disp('Using the UCell method...');
if strcmp(selecteditem, 'DoRothEA TF Targets')
methodid = 4; % UCell method
% disp('Using the UCell method...');
else
methodid = 4;
end
if methodid ~= 4, fw = gui.gui_waitbar; end
try
[cs, tflist] = sc_tfactivity(sce.X, sce.g, [], ...
species, methodid);
speciesid, methodid);
catch ME
if methodid ~= 4, gui.gui_waitbar(fw,true); end
errordlg(ME.message);
Expand Down Expand Up @@ -310,13 +310,13 @@
if ~exist("ttxt", "var"), ttxt = []; end

if showcomparision
if iscell(y)
%if iscell(y)
gui.i_violintabs(y, ttxt, thisc, FigureHandle);
else
gui.i_violinplot(y, thisc, ttxt, true, [], posg, FigureHandle);
xlabel('Cell group');
ylabel('Cellular score');
end
%else
% gui.i_violinplot(y, thisc, ttxt, true, [], posg, FigureHandle);
% xlabel('Cell group');
% ylabel('Cellular score');
% end
else
% [methodid]=gui.i_pickscatterstem('Scatter+Stem');
% if isempty(methodid), return; end
Expand Down
4 changes: 2 additions & 2 deletions +gui/callback_DPGene2Groups.m
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ function callback_DPGene2Groups(src, ~)
end


[indx1,species] = gui.i_selgenecollection;
[indx1,speciesid] = gui.i_selgenecollection;
if isempty(indx1), return; end
[setmatrx, setnames, setgenes] = pkg.e_getgenesets(indx1,species); %(indx1);
[setmatrx, setnames, setgenes] = pkg.e_getgenesets(indx1,speciesid); %(indx1);
if isempty(setmatrx) || isempty(setnames) || isempty(setgenes)
return;
end
Expand Down
10 changes: 8 additions & 2 deletions +gui/i_selgenecollection.m
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,17 @@

%see also: i_selectcellscore

%MSigDB Molecular Signatures
%PanglaoDB Cell Type Markers
%DoRothEA TF Targets
%Custom Gene Sets

species=[];
indx1=[];
selitems={'MSigDB Molecular Signatures',...
'DoRothEA TF Targets Expression',...
'Predefined Gene Collections'};
'DoRothEA TF Targets',...
'Custome Gene Sets'};

[indx1, tf1]=listdlg('PromptString',...
'Select a gene set collection.',...
'SelectionMode','single','ListString',selitems, ...
Expand Down
27 changes: 27 additions & 0 deletions +gui/i_selgenesetcollection.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
function [selecteditem, speciesid] = i_selgenesetcollection

speciesid = [];
selecteditem = [];

%MSigDB Molecular Signatures
%PanglaoDB Cell Type Markers
%DoRothEA TF Targets
%Custom Gene Sets

selitems={'MSigDB Molecular Signatures',...
'DoRothEA TF Targets',...
'PanglaoDB Cell Type Markers',...
'Custom Gene Sets'};

[selectedindx, tf1]=listdlg('PromptString',...
'Select a gene set collection.',...
'SelectionMode','single','ListString',selitems, ...
'ListSize', [220, 300]);
if tf1~=1, return; end
selecteditem = selitems{selectedindx};
if selectedindx == 2
speciesid = gui.i_selectspecies(2);
else
speciesid = 'human';
end
end
4 changes: 2 additions & 2 deletions +gui/i_violinplot.m
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@
pkg.i_addbutton2fig(tb, 'on', @i_viewgenenames, 'HDF_point.gif', 'Show Gene Names');
pkg.i_addbutton2fig(tb, 'on', {@gui.i_resizewin, hFig}, 'HDF_pointx.gif', 'Resize Plot Window');

i_addsamplesize([],[]);
i_testdata([],[]);
%i_addsamplesize([],[]);
%i_testdata([],[]);
if nargout > 0
return;
end
Expand Down
2 changes: 1 addition & 1 deletion +gui/i_violintabs.m
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
function i_violintabs(y, tabnamelist, thisc, parentfig)
%see also: gui.i_violinplot, gui.i_scattertabs

if ~iscell(y), y = {y}; end
if nargin<4, parentfig = []; end
tabnamelist = string(tabnamelist);

Expand All @@ -13,7 +14,6 @@ function i_violintabs(y, tabnamelist, thisc, parentfig)
thisc = strrep(string(thisc), '_', '\_');
colorit = true;


import mlreportgen.ppt.*;
pw1 = fileparts(mfilename('fullpath'));
pth = fullfile(pw1, '..', 'resources', 'myTemplate.pptx');
Expand Down
2 changes: 1 addition & 1 deletion scgeatool.m
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ function in_fixfield(oldf, newf)

function in_CompareCellScoreBtwCls(src, events)
if gui.callback_CompareCellScoreBtwCls(src, events)
sce = guidata(FigureHandle);
sce = guidata(FigureHandle);
end
end

Expand Down

0 comments on commit 962cf0b

Please sign in to comment.