Permalink
Browse files

slightly revised plotting for view3D

  • Loading branch information...
1 parent 0110bc4 commit 1bbb5ed7a47239d952b77c4c12c45612581636f4 Alistair Boettiger committed Jun 18, 2011
Showing with 236 additions and 86 deletions.
  1. +7 −7 Unsupervised_DotFinding.m
  2. +6 −6 Unsupervised_DotFinding.m~
  3. +4 −4 Unsupervised_DotFinding2.m
  4. +110 −35 view3Dchromatin.m
  5. +109 −34 view3Dchromatin.m~
View
14 Unsupervised_DotFinding.m
@@ -9,15 +9,15 @@
tot_time = tic;
% Input options
old_lab = 0;
-folder = '/Users/alistair/Documents/Berkeley/Levine_Lab/Projects/mRNA_counting/Data/'; % '/Users/alistair/Documents/Berkeley/Levine_Lab/Projects/Enhancer_Modeling/Data/';
+folder = '/Users/alistair/Documents/Berkeley/Levine_Lab/Projects/mRNA_counting/Data/2011-05-22/'; % '/Users/alistair/Documents/Berkeley/Levine_Lab/Projects/Enhancer_Modeling/Data/';
rawfolder = '/Volumes/Data/Lab Data/Raw_Data/2011-05-22/'; % '/Volumes/Data/Lab Data/Raw_Data/02-17-11/'; %% %
-stackfolder = 's01_MP09/';% 's02_MP01/';% 's10_bcd1x/';% 's11_bcd6x/'; %'s14_comp_cntrl/'; % 's12_cntrl_2label/'; %'MP02_22C/'; %'MP01_22C/'; % 'MGa1x/'; % 'MP10_22C/'; %'MP05_22C/'; %'YW_ths_sog/'; % 'MP10_22C/'; % % 'MP09_22C/'; % 'MGa2x/'; % 'MGa1x/'; % 'MGa2x/'; % 'MP10_22C_sna_y_c/'; %
-fname = 's01_MP09_Hz_22C_b';% 's02_MP01_Hz_22C'; % 's10_bcd1x';% 's11_bcd6x'; % 's14_comp_cntrl'; Es =1; % 's12_cntrl_2label'; Es = 1; % 'MP09_22C_hb_y_f'; Es = 7; % 'MP02_22C_hb_y'; Es = 9; % 'MP02_22C_hb_y_b'; Es = 10; % % 'MP01_22C_hb_y_f'; Es = 12; % 'MP01_22C_hb_y_c'; Es = 10; % 'MP01_22C_hb_y'; Es = 13; % 'MGa1x_LacZ_b'; Es = 12; % 'MP10_22C_sna_y_e'; Es = 12; % 'MP05_22C_sna_y_c'; Es =7; % 'MP10_22C_sna_y_d3'; Es = 1; %'YW_ths_sog'; Es = 12; % % 'MP09_22C_hb_y_e'; Es = 10; % 'MP09_22C_hb_y_d'; Es=11; % 'MGa2x_LacZ_sna_b'; Es = 10; % 'MP10_22C_sna_y_d'; % 'MGa_LacZ'; %'MGa2x_LacZ_sna'; %'MP10_22C_sna_y_c'; old_lab = 1; % 'MP05_22C_sna_y'; old_lab = 1; %
+stackfolder = 's03_MP02/';% 's01_MP09/';% 's02_MP01/';% 's10_bcd1x/';% 's11_bcd6x/'; %'s14_comp_cntrl/'; % 's12_cntrl_2label/'; %'MP02_22C/'; %'MP01_22C/'; % 'MGa1x/'; % 'MP10_22C/'; %'MP05_22C/'; %'YW_ths_sog/'; % 'MP10_22C/'; % % 'MP09_22C/'; % 'MGa2x/'; % 'MGa1x/'; % 'MGa2x/'; % 'MP10_22C_sna_y_c/'; %
+fname = 's03_MP02_Hz_22C_b';% 's01_MP09_Hz_22C_b';% 's02_MP01_Hz_22C'; % 's10_bcd1x';% 's11_bcd6x'; % 's14_comp_cntrl'; Es =1; % 's12_cntrl_2label'; Es = 1; % 'MP09_22C_hb_y_f'; Es = 7; % 'MP02_22C_hb_y'; Es = 9; % 'MP02_22C_hb_y_b'; Es = 10; % % 'MP01_22C_hb_y_f'; Es = 12; % 'MP01_22C_hb_y_c'; Es = 10; % 'MP01_22C_hb_y'; Es = 13; % 'MGa1x_LacZ_b'; Es = 12; % 'MP10_22C_sna_y_e'; Es = 12; % 'MP05_22C_sna_y_c'; Es =7; % 'MP10_22C_sna_y_d3'; Es = 1; %'YW_ths_sog'; Es = 12; % % 'MP09_22C_hb_y_e'; Es = 10; % 'MP09_22C_hb_y_d'; Es=11; % 'MGa2x_LacZ_sna_b'; Es = 10; % 'MP10_22C_sna_y_d'; % 'MGa_LacZ'; %'MGa2x_LacZ_sna'; %'MP10_22C_sna_y_c'; old_lab = 1; % 'MP05_22C_sna_y'; old_lab = 1; %
mRNA_channels = 2; % 3; % 1; % total mRNA channels
-sname = 's01_MP09Hz_b';
-ver = '_v2';% '_v2';
+sname = fname; % 's03_MP02_Hz_22C_b';%
+ver = '';% '_v2';
% MP10_22C_sna_y_c and MP05_22C all done at 3.5, 4, 0.03, 30, 30
% MGa2x and MGa1x all done at 2.5, 3, 0.03, 30, 30
@@ -111,9 +111,9 @@
for mRNAchn = 1:mRNA_channels % mRNAchn =2
if mRNAchn == 1;
- min_int = 0.03; % just for speed
+ min_int = 0.05; % just for speed
else
- min_int = 0.01; %
+ min_int = 0.02; %
end
DotLabels= cell(1,Zs);
View
12 Unsupervised_DotFinding.m~
@@ -12,12 +12,12 @@ old_lab = 0;
folder = '/Users/alistair/Documents/Berkeley/Levine_Lab/Projects/mRNA_counting/Data/'; % '/Users/alistair/Documents/Berkeley/Levine_Lab/Projects/Enhancer_Modeling/Data/';
rawfolder = '/Volumes/Data/Lab Data/Raw_Data/2011-05-22/'; % '/Volumes/Data/Lab Data/Raw_Data/02-17-11/'; %% %
-stackfolder = 's01_MP09/';% 's02_MP01/';% 's10_bcd1x/';% 's11_bcd6x/'; %'s14_comp_cntrl/'; % 's12_cntrl_2label/'; %'MP02_22C/'; %'MP01_22C/'; % 'MGa1x/'; % 'MP10_22C/'; %'MP05_22C/'; %'YW_ths_sog/'; % 'MP10_22C/'; % % 'MP09_22C/'; % 'MGa2x/'; % 'MGa1x/'; % 'MGa2x/'; % 'MP10_22C_sna_y_c/'; %
-fname = 's01_MP09_Hz_22C_b';% 's02_MP01_Hz_22C'; % 's10_bcd1x';% 's11_bcd6x'; % 's14_comp_cntrl'; Es =1; % 's12_cntrl_2label'; Es = 1; % 'MP09_22C_hb_y_f'; Es = 7; % 'MP02_22C_hb_y'; Es = 9; % 'MP02_22C_hb_y_b'; Es = 10; % % 'MP01_22C_hb_y_f'; Es = 12; % 'MP01_22C_hb_y_c'; Es = 10; % 'MP01_22C_hb_y'; Es = 13; % 'MGa1x_LacZ_b'; Es = 12; % 'MP10_22C_sna_y_e'; Es = 12; % 'MP05_22C_sna_y_c'; Es =7; % 'MP10_22C_sna_y_d3'; Es = 1; %'YW_ths_sog'; Es = 12; % % 'MP09_22C_hb_y_e'; Es = 10; % 'MP09_22C_hb_y_d'; Es=11; % 'MGa2x_LacZ_sna_b'; Es = 10; % 'MP10_22C_sna_y_d'; % 'MGa_LacZ'; %'MGa2x_LacZ_sna'; %'MP10_22C_sna_y_c'; old_lab = 1; % 'MP05_22C_sna_y'; old_lab = 1; %
+stackfolder = 's03_MP02/';% 's01_MP09/';% 's02_MP01/';% 's10_bcd1x/';% 's11_bcd6x/'; %'s14_comp_cntrl/'; % 's12_cntrl_2label/'; %'MP02_22C/'; %'MP01_22C/'; % 'MGa1x/'; % 'MP10_22C/'; %'MP05_22C/'; %'YW_ths_sog/'; % 'MP10_22C/'; % % 'MP09_22C/'; % 'MGa2x/'; % 'MGa1x/'; % 'MGa2x/'; % 'MP10_22C_sna_y_c/'; %
+fname = 's03_MP02_Hz_22C_b';% 's01_MP09_Hz_22C_b';% 's02_MP01_Hz_22C'; % 's10_bcd1x';% 's11_bcd6x'; % 's14_comp_cntrl'; Es =1; % 's12_cntrl_2label'; Es = 1; % 'MP09_22C_hb_y_f'; Es = 7; % 'MP02_22C_hb_y'; Es = 9; % 'MP02_22C_hb_y_b'; Es = 10; % % 'MP01_22C_hb_y_f'; Es = 12; % 'MP01_22C_hb_y_c'; Es = 10; % 'MP01_22C_hb_y'; Es = 13; % 'MGa1x_LacZ_b'; Es = 12; % 'MP10_22C_sna_y_e'; Es = 12; % 'MP05_22C_sna_y_c'; Es =7; % 'MP10_22C_sna_y_d3'; Es = 1; %'YW_ths_sog'; Es = 12; % % 'MP09_22C_hb_y_e'; Es = 10; % 'MP09_22C_hb_y_d'; Es=11; % 'MGa2x_LacZ_sna_b'; Es = 10; % 'MP10_22C_sna_y_d'; % 'MGa_LacZ'; %'MGa2x_LacZ_sna'; %'MP10_22C_sna_y_c'; old_lab = 1; % 'MP05_22C_sna_y'; old_lab = 1; %
mRNA_channels = 2; % 3; % 1; % total mRNA channels
-sname = 's01_MP09Hz_b';
-ver = '_v2';% '_v2';
+sname = fname; % 's03_MP02_Hz_22C_b';%
+ver = '';% '_v2';
% MP10_22C_sna_y_c and MP05_22C all done at 3.5, 4, 0.03, 30, 30
% MGa2x and MGa1x all done at 2.5, 3, 0.03, 30, 30
@@ -111,9 +111,9 @@ for e= 1:Es
for mRNAchn = 1:mRNA_channels % mRNAchn =2
if mRNAchn == 1;
- min_int = 0.03; % just for speed
+ min_int = 0.05; % just for speed
else
- min_int = 0.01; %
+ min_int = 0.02; %
end
DotLabels= cell(1,Zs);
View
8 Unsupervised_DotFinding2.m
@@ -13,11 +13,11 @@
rawfolder = '/Volumes/Data/Lab Data/Raw_Data/2011-05-22/'; % '/Volumes/Data/Lab Data/Raw_Data/02-17-11/'; %% %
stackfolder = 's02_MP01/';% 's06_MP10_sna18/'; %'s01_MP09/'; %'s10_bcd1x/';% 's11_bcd6x/'; %'s14_comp_cntrl/'; % 's12_cntrl_2label/'; %'MP02_22C/'; %'MP01_22C/'; % 'MGa1x/'; % 'MP10_22C/'; %'MP05_22C/'; %'YW_ths_sog/'; % 'MP10_22C/'; % % 'MP09_22C/'; % 'MGa2x/'; % 'MGa1x/'; % 'MGa2x/'; % 'MP10_22C_sna_y_c/'; %
-fname ='s02_MP01_Hz_22C'; % 's06_MP10_sna18'; %'s10_bcd1x';% 's11_bcd6x'; % 's14_comp_cntrl'; Es =1; % 's12_cntrl_2label'; Es = 1; % 'MP09_22C_hb_y_f'; Es = 7; % 'MP02_22C_hb_y'; Es = 9; % 'MP02_22C_hb_y_b'; Es = 10; % % 'MP01_22C_hb_y_f'; Es = 12; % 'MP01_22C_hb_y_c'; Es = 10; % 'MP01_22C_hb_y'; Es = 13; % 'MGa1x_LacZ_b'; Es = 12; % 'MP10_22C_sna_y_e'; Es = 12; % 'MP05_22C_sna_y_c'; Es =7; % 'MP10_22C_sna_y_d3'; Es = 1; %'YW_ths_sog'; Es = 12; % % 'MP09_22C_hb_y_e'; Es = 10; % 'MP09_22C_hb_y_d'; Es=11; % 'MGa2x_LacZ_sna_b'; Es = 10; % 'MP10_22C_sna_y_d'; % 'MGa_LacZ'; %'MGa2x_LacZ_sna'; %'MP10_22C_sna_y_c'; old_lab = 1; % 'MP05_22C_sna_y'; old_lab = 1; %
+fname ='s02_MP01_Hz_22C_b'; % 's06_MP10_sna18'; %'s10_bcd1x';% 's11_bcd6x'; % 's14_comp_cntrl'; Es =1; % 's12_cntrl_2label'; Es = 1; % 'MP09_22C_hb_y_f'; Es = 7; % 'MP02_22C_hb_y'; Es = 9; % 'MP02_22C_hb_y_b'; Es = 10; % % 'MP01_22C_hb_y_f'; Es = 12; % 'MP01_22C_hb_y_c'; Es = 10; % 'MP01_22C_hb_y'; Es = 13; % 'MGa1x_LacZ_b'; Es = 12; % 'MP10_22C_sna_y_e'; Es = 12; % 'MP05_22C_sna_y_c'; Es =7; % 'MP10_22C_sna_y_d3'; Es = 1; %'YW_ths_sog'; Es = 12; % % 'MP09_22C_hb_y_e'; Es = 10; % 'MP09_22C_hb_y_d'; Es=11; % 'MGa2x_LacZ_sna_b'; Es = 10; % 'MP10_22C_sna_y_d'; % 'MGa_LacZ'; %'MGa2x_LacZ_sna'; %'MP10_22C_sna_y_c'; old_lab = 1; % 'MP05_22C_sna_y'; old_lab = 1; %
mRNA_channels = 2; % 3; % 1; % total mRNA channels
sver = '';% '_1'; % additional label on slide.
-ver = '_v2';% '_v2';
+ver = '';% '_v2';
% MP10_22C_sna_y_c and MP05_22C all done at 3.5, 4, 0.03, 30, 30
% MGa2x and MGa1x all done at 2.5, 3, 0.03, 30, 30
@@ -111,9 +111,9 @@
for mRNAchn = 1:mRNA_channels % mRNAchn =2
if mRNAchn == 1;
- min_int = 0.03; % .05 just for speed
+ min_int = 0.05; % .05 just for speed
else
- min_int = 0.01; %
+ min_int = 0.02; %
end
DotLabels= cell(1,Zs);
View
145 view3Dchromatin.m
@@ -1,6 +1,6 @@
%% view3Dchromatin.m
-% Alistair Boettiger Date Begun: 02/14/11
-% Last Modified: 03/20/11
+% Alistair Boettiger Date Begun: 02/14/11
+% Last Modified: 06/17/11
%% Updates
@@ -11,26 +11,43 @@
% folder = '/Volumes/Data/Lab Data/Raw_Data/02-06-11/';
% fname = 'MP10_22C_sna_y_c'; emb = '01';
- folder = '/Volumes/Data/Lab Data/Raw_Data/02-17-11/';
- datafolder = '/Users/alistair/Documents/Berkeley/Levine_Lab/Projects/Enhancer_Modeling/Data/';
- stackfolder = 'CadN/'; % 'MP09_22C/'; %
- %fname ='MP09_22C_hb_y_a'; emb = '01' ; xp1 = 600; yp1 = 660; xp2 = xp1+100; yp2 = yp1+100;
- fname = 'CadN'; emb = '06'; xp1 = 1275; yp1 = 1050; xp2 = xp1+100; yp2 = yp1+100;
+% folder = '/Volumes/Data/Lab Data/Raw_Data/02-17-11/';
+% datafolder = '/Users/alistair/Documents/Berkeley/Levine_Lab/Projects/Enhancer_Modeling/Data/';
+% stackfolder = 'CadN/'; % 'MP09_22C/'; %
+ % fname ='MP09_22C_hb_y_a'; emb = '01' ; xp1 = 600; yp1 = 660; xp2 = xp1+100; yp2 = yp1+100;
+ % fname = 'CadN'; emb = '06'; xp1 = 1275; yp1 = 1050; xp2 = xp1+100; yp2 = yp1+100;
- stackdisks = 0;
+
+datafolder = '/Users/alistair/Documents/Berkeley/Levine_Lab/Projects/mRNA_counting/Data/2011-05-11/'; %
+folder = '/Volumes/Data/Lab Data/Raw_Data/2011-05-22/'; % /02-17-11/'; %% %
+stackfolder = 's01_MP09/';% 's03_MP02/';% 's02_MP01/';% 's10_bcd1x/';% 's11_bcd6x/'; %'s14_comp_cntrl/'; % 's12_cntrl_2label/'; %'MP02_22C/'; %'MP01_22C/'; % 'MGa1x/'; % 'MP10_22C/'; %'MP05_22C/'; %'YW_ths_sog/'; % 'MP10_22C/'; % % 'MP09_22C/'; % 'MGa2x/'; % 'MGa1x/'; % 'MGa2x/'; % 'MP10_22C_sna_y_c/'; %
+fname = 's01_MP09_Hz_22C'; emb = '09'; % 's03_MP02_Hz_22C'; emb = '01'; % 's02_MP01_Hz_22C'; emb = '04'; % 's10_bcd1x';% 's11_bcd6x'; % 's14_comp_cntrl'; Es =1; % 's12_cntrl_2label'; Es = 1; % 'MP09_22C_hb_y_f'; Es = 7; % 'MP02_22C_hb_y'; Es = 9; % 'MP02_22C_hb_y_b'; Es = 10; % % 'MP01_22C_hb_y_f'; Es = 12; % 'MP01_22C_hb_y_c'; Es = 10; % 'MP01_22C_hb_y'; Es = 13; % 'MGa1x_LacZ_b'; Es = 12; % 'MP10_22C_sna_y_e'; Es = 12; % 'MP05_22C_sna_y_c'; Es =7; % 'MP10_22C_sna_y_d3'; Es = 1; %'YW_ths_sog'; Es = 12; % % 'MP09_22C_hb_y_e'; Es = 10; % 'MP09_22C_hb_y_d'; Es=11; % 'MGa2x_LacZ_sna_b'; Es = 10; % 'MP10_22C_sna_y_d'; % 'MGa_LacZ'; %'MGa2x_LacZ_sna'; %'MP10_22C_sna_y_c'; old_lab = 1; % 'MP05_22C_sna_y'; old_lab = 1; %
+
+
+ stackdisks = 0; zspace = 330;
+ shownucs = 0; disp_nascent = 0;
Imax = imread([folder,stackfolder,'max_',fname,'_',emb,'.tif']);
- figure(10); clf; imagesc(Imax);
- [h,w] = size(Imax);
%%
-%xp1 = 600; yp1 = 660; xp2 = xp1+100; yp2 = yp1+100;
- xp1 = 1850; yp1 = 990; xp2 = xp1+100; yp2 = yp1+100;
- figure(10); clf; imagesc(Imax(xp1:xp2,yp1:yp2,:));
- disp(['Coordinates: ', num2str(xp1), ' : ', num2str(xp2), ', ' num2str(yp1), ' : ', num2str(yp2) ] );
- [hs,ws] = size(Imax(xp1:xp2,yp1:yp2,1));
+%xp1 = 600; yp1 = 660; xp2 = xp1+100; yp2 = yp1+100; nt = 5;
+% xp1 = 1850; yp1 = 990; xp2 = xp1+100; yp2 = yp1+100; nt = 5;
+ xp1 = 145; yp1 = 1660; xp2 = xp1+260; yp2 = yp1+260; nt = 5; % MP09_09;
+ % xp1 = 1245; yp1 = 1260; xp2 = xp1+260; yp2 = yp1+260; nt = 15; % MP01_04 nascent;
+ % xp1 = 200; yp1 = 1200; xp2 = xp1+260; yp2 = yp1+260; nt = 15; % MP01_04; dots
+ % xp1 = 1130; yp1 = 700; xp2 = xp1+260; yp2 = yp1+260; nt = .5; % MP02_01;
+
+ % Imax(:,:,2) = 10*Imax(:,:,2);
+
+ figure(10); clf; imagesc(Imax); colordef black; set(gcf,'color','k');
+ hold on; plot([yp1,yp2,yp2,yp1,yp1],[xp1,xp1,xp2,xp2,xp1],'w');
+
+ figure(9); clf; imagesc(Imax(xp1:xp2,yp1:yp2,:));
+ disp(['Coordinates: ', num2str(xp1), ' : ', num2str(xp2), ', ' num2str(yp1), ' : ', num2str(yp2) ] );
+ [hs,ws] = size(Imax(xp1:xp2,yp1:yp2,1));
+ [h,w] = size(Imax);
@@ -49,7 +66,8 @@
try
im_folder{z} = [folder,stackfolder,fname,'_',emb,'_z',num2str(z),'.tif'];
Iin_z = imread(im_folder{z});
- catch
+ catch err
+ disp(err.message);
break
end
@@ -67,38 +85,95 @@
toc
+%% load mRNA data Prep 3D-isosurfaces view
+% load([datafolder,fname,'_slidedata'], 'Data');
+load([datafolder,fname,'_',emb,'_chn1','_data.mat']);
+
+d = dotC;
+d1 = d(d(:,2)>xp1 & d(:,2)<xp2 & d(:,1)>yp1 & d(:,1)<yp2,:);
+
+load([datafolder,fname,'_',emb,'_chn2','_data.mat']);
+d = dotC;
+d2 = d(d(:,2)>xp1 & d(:,2)<xp2 & d(:,1)>yp1 & d(:,1)<yp2,:);
-%% 3D-isosurfaces view
-stp = 1;
-Zmax = 30;
+
+%% 3D-isosurfaces view, Prep
+stp = 1;
+Zmax = 50;
x = (1:stp:ws)*50;
y = (1:stp:hs)*50;
- z = Zs*380-380*(1:Zmax);
-% z = 380*(1:Zs);
+ z = Zs*zspace-zspace*(1:Zmax);
[X,Y,Z] = meshgrid(x,y,z);
data = Inuc(1:stp:end,1:stp:end,1:Zmax);
data(isnan(data)) = 0;
-data = smooth3(data,'box',5);
+data = smooth3(data,'box',15);
+
+%% 3D-isosurfaces view, Draw
+tic
+disp('plotting data...');
-%%
+
+
+% adust intensity threshold for nascent transcript detection
+lev1 = 6;
+lev2 = .92;
figure(4); clf;
-% patch(isosurface(Y,X,Z,data,35),'FaceColor','blue','EdgeColor','none'); hold on; alpha 1;
-% patch(isosurface(Y,X,Z,Isect1(1:stp:end,1:stp:end,1:Zmax),9550),'FaceColor','red','EdgeColor','none'); alpha .5
-% patch(isosurface(Y,X,Z,Isect2(1:stp:end,1:stp:end,1:Zmax),2550),'FaceColor','green','EdgeColor','none');
-
-patch(isosurface(Y,X,Z,data,40),'FaceColor','blue','EdgeColor','none'); hold on; alpha .5;
-patch(isosurface(Y,X,Z,Isect1(1:stp:end,1:stp:end,1:Zmax),21000),'FaceColor','red','EdgeColor','none'); alpha .5
-patch(isosurface(Y,X,Z,Isect2(1:stp:end,1:stp:end,1:Zmax),11000),'FaceColor','green','EdgeColor','none');
-
- camlight(5,30);
-light('Position',[1000,1.5E4 8000],'Style','local');
- lighting phong; % view(112,34);
-view(-111,38);
+if shownucs ==1
+patch(isosurface(Y,X,Z,data,nt,'material','dull'),'FaceColor','blue','EdgeColor','none'); hold on; alpha .3;
+end
+
+if disp_nascent == 1
+patch(isosurface(Y,X,Z,Isect1(1:stp:end,1:stp:end,1:Zmax),lev1*25000,'material','shiny'),'FaceColor','red','EdgeColor','none'); alpha .3
+patch(isosurface(Y,X,Z,Isect2(1:stp:end,1:stp:end,1:Zmax),lev2*15100,'material','shiny'),'FaceColor','green','EdgeColor','none');
+end
+
set(gcf,'color','k'); set(gca,'color','k');
+toc
+
+%% 3D-isosurfaces Draw dots
+tic
+
+points1 = [d1(:,1)*50-yp1*50,d1(:,2)*50-xp1*50,zspace*Zs-zspace*d1(:,3)];
+points2 = [d2(:,1)*50-yp1*50,d2(:,2)*50-xp1*50,zspace*Zs-zspace*d2(:,3)];
+
+V1 = zeros(size(X)); V2 = V1;
+
+ind1 = cell(Zs,1);
+ind2 = cell(Zs,1);
+for zs =1:Zs;
+ layer = d1(:,3)<zs+1 & d1(:,3)>zs -1;
+ xs = points1(layer,1)/(50*ws)*length(x);
+ ys = points1(layer,2)/(50*hs)*length(y);
+ ind1{zs} = floor(xs) + length(y)*(floor(ys)) + length(x)*length(y)*(zs-1);
+
+ layer = d2(:,3)<zs+1 & d2(:,3)>zs -1;
+ xs = points2(layer,1)/(50*ws)*length(x);
+ ys = points2(layer,2)/(50*hs)*length(y);
+ ind2{zs} = floor(xs) + length(y)*(floor(ys)) + length(x)*length(y)*(zs-1);
+
+end
+inds1 = cell2mat(ind1);
+inds2 = cell2mat(ind2);
+V1(inds1) = 20;
+V2(inds2) = 20;
+
+
+figure(4); hold on;
+ patch(isosurface(X,Y,Z,V1,1,'material','dull'),'FaceColor','c','EdgeColor','none');
+patch(isosurface(X,Y,Z,V2,.5,'material','dull'),'FaceColor','k','EdgeColor','none');
+% camlight left;
+%light('Position',[1000,1.5E4 8000],'Style','local');
+% lighting phong; % view(112,34);
+view(194,80);
+%
+
+toc
+
+
View
143 view3Dchromatin.m~
@@ -11,26 +11,43 @@ clear all;
% folder = '/Volumes/Data/Lab Data/Raw_Data/02-06-11/';
% fname = 'MP10_22C_sna_y_c'; emb = '01';
- folder = '/Volumes/Data/Lab Data/Raw_Data/02-17-11/';
- datafolder = '/Users/alistair/Documents/Berkeley/Levine_Lab/Projects/Enhancer_Modeling/Data/';
- stackfolder = 'CadN/'; % 'MP09_22C/'; %
- %fname ='MP09_22C_hb_y_a'; emb = '01' ; xp1 = 600; yp1 = 660; xp2 = xp1+100; yp2 = yp1+100;
- fname = 'CadN'; emb = '06'; xp1 = 1275; yp1 = 1050; xp2 = xp1+100; yp2 = yp1+100;
-
- stackdisks = 0;
+% folder = '/Volumes/Data/Lab Data/Raw_Data/02-17-11/';
+% datafolder = '/Users/alistair/Documents/Berkeley/Levine_Lab/Projects/Enhancer_Modeling/Data/';
+% stackfolder = 'CadN/'; % 'MP09_22C/'; %
+ % fname ='MP09_22C_hb_y_a'; emb = '01' ; xp1 = 600; yp1 = 660; xp2 = xp1+100; yp2 = yp1+100;
+ % fname = 'CadN'; emb = '06'; xp1 = 1275; yp1 = 1050; xp2 = xp1+100; yp2 = yp1+100;
+
+
+datafolder = '/Users/alistair/Documents/Berkeley/Levine_Lab/Projects/mRNA_counting/Data/'; % '/Users/alistair/Documents/Berkeley/Levine_Lab/Projects/Enhancer_Modeling/Data/';
+folder = '/Volumes/Data/Lab Data/Raw_Data/2011-05-22/'; % '/Volumes/Data/Lab Data/Raw_Data/02-17-11/'; %% %
+stackfolder = 's01_MP09/';% 's03_MP02/';% 's02_MP01/';% 's10_bcd1x/';% 's11_bcd6x/'; %'s14_comp_cntrl/'; % 's12_cntrl_2label/'; %'MP02_22C/'; %'MP01_22C/'; % 'MGa1x/'; % 'MP10_22C/'; %'MP05_22C/'; %'YW_ths_sog/'; % 'MP10_22C/'; % % 'MP09_22C/'; % 'MGa2x/'; % 'MGa1x/'; % 'MGa2x/'; % 'MP10_22C_sna_y_c/'; %
+fname = 's01_MP09_Hz_22C'; emb = '09'; % 's03_MP02_Hz_22C'; emb = '01'; % 's02_MP01_Hz_22C'; emb = '04'; % 's10_bcd1x';% 's11_bcd6x'; % 's14_comp_cntrl'; Es =1; % 's12_cntrl_2label'; Es = 1; % 'MP09_22C_hb_y_f'; Es = 7; % 'MP02_22C_hb_y'; Es = 9; % 'MP02_22C_hb_y_b'; Es = 10; % % 'MP01_22C_hb_y_f'; Es = 12; % 'MP01_22C_hb_y_c'; Es = 10; % 'MP01_22C_hb_y'; Es = 13; % 'MGa1x_LacZ_b'; Es = 12; % 'MP10_22C_sna_y_e'; Es = 12; % 'MP05_22C_sna_y_c'; Es =7; % 'MP10_22C_sna_y_d3'; Es = 1; %'YW_ths_sog'; Es = 12; % % 'MP09_22C_hb_y_e'; Es = 10; % 'MP09_22C_hb_y_d'; Es=11; % 'MGa2x_LacZ_sna_b'; Es = 10; % 'MP10_22C_sna_y_d'; % 'MGa_LacZ'; %'MGa2x_LacZ_sna'; %'MP10_22C_sna_y_c'; old_lab = 1; % 'MP05_22C_sna_y'; old_lab = 1; %
+
+
+ stackdisks = 0; zspace = 330;
+ shownucs = 0; disp_nascent = 0;
Imax = imread([folder,stackfolder,'max_',fname,'_',emb,'.tif']);
- figure(10); clf; imagesc(Imax);
- [h,w] = size(Imax);
%%
-%xp1 = 600; yp1 = 660; xp2 = xp1+100; yp2 = yp1+100;
- xp1 = 215; yp1 = 750; xp2 = xp1+100; yp2 = yp1+100;
- figure(10); clf; imagesc(Imax(xp1:xp2,yp1:yp2,:));
- disp(['Coordinates: ', num2str(xp1), ' : ', num2str(xp2), ', ' num2str(yp1), ' : ', num2str(yp2) ] );
- [hs,ws] = size(Imax(xp1:xp2,yp1:yp2,1));
+%xp1 = 600; yp1 = 660; xp2 = xp1+100; yp2 = yp1+100; nt = 5;
+% xp1 = 1850; yp1 = 990; xp2 = xp1+100; yp2 = yp1+100; nt = 5;
+ xp1 = 145; yp1 = 1660; xp2 = xp1+260; yp2 = yp1+260; nt = 5; % MP09_09;
+ % xp1 = 1245; yp1 = 1260; xp2 = xp1+260; yp2 = yp1+260; nt = 15; % MP01_04 nascent;
+ % xp1 = 200; yp1 = 1200; xp2 = xp1+260; yp2 = yp1+260; nt = 15; % MP01_04; dots
+ % xp1 = 1130; yp1 = 700; xp2 = xp1+260; yp2 = yp1+260; nt = .5; % MP02_01;
+
+ % Imax(:,:,2) = 10*Imax(:,:,2);
+
+ figure(10); clf; imagesc(Imax); colordef black; set(gcf,'color','k');
+ hold on; plot([yp1,yp2,yp2,yp1,yp1],[xp1,xp1,xp2,xp2,xp1],'w');
+
+ figure(9); clf; imagesc(Imax(xp1:xp2,yp1:yp2,:));
+ disp(['Coordinates: ', num2str(xp1), ' : ', num2str(xp2), ', ' num2str(yp1), ' : ', num2str(yp2) ] );
+ [hs,ws] = size(Imax(xp1:xp2,yp1:yp2,1));
+ [h,w] = size(Imax);
@@ -49,7 +66,8 @@ for z = 1:Zs % z = 20
try
im_folder{z} = [folder,stackfolder,fname,'_',emb,'_z',num2str(z),'.tif'];
Iin_z = imread(im_folder{z});
- catch
+ catch err
+ disp(err.message);
break
end
@@ -67,38 +85,95 @@ end
toc
+%% load mRNA data Prep 3D-isosurfaces view
+% load([datafolder,fname,'_slidedata'], 'Data');
+load([datafolder,fname,'_',emb,'_chn1','_data.mat']);
+
+d = dotC;
+d1 = d(d(:,2)>xp1 & d(:,2)<xp2 & d(:,1)>yp1 & d(:,1)<yp2,:);
+
+load([datafolder,fname,'_',emb,'_chn2','_data.mat']);
+d = dotC;
+d2 = d(d(:,2)>xp1 & d(:,2)<xp2 & d(:,1)>yp1 & d(:,1)<yp2,:);
-%% 3D-isosurfaces view
-stp = 1;
-Zmax = 30;
+
+%% 3D-isosurfaces view, Prep
+stp = 1;
+Zmax = 50;
x = (1:stp:ws)*50;
y = (1:stp:hs)*50;
- z = Zs*380-380*(1:Zmax);
-% z = 380*(1:Zs);
+ z = Zs*zspace-zspace*(1:Zmax);
[X,Y,Z] = meshgrid(x,y,z);
data = Inuc(1:stp:end,1:stp:end,1:Zmax);
data(isnan(data)) = 0;
-data = smooth3(data,'box',5);
+data = smooth3(data,'box',15);
+
+%% 3D-isosurfaces view, Draw
+tic
+disp('plotting data...');
-%%
+
+
+% adust intensity threshold for nascent transcript detection
+lev1 = 6;
+lev2 = .92;
figure(4); clf;
-% patch(isosurface(Y,X,Z,data,35),'FaceColor','blue','EdgeColor','none'); hold on; alpha 1;
-% patch(isosurface(Y,X,Z,Isect1(1:stp:end,1:stp:end,1:Zmax),9550),'FaceColor','red','EdgeColor','none'); alpha .5
-% patch(isosurface(Y,X,Z,Isect2(1:stp:end,1:stp:end,1:Zmax),2550),'FaceColor','green','EdgeColor','none');
-
-patch(isosurface(Y,X,Z,data,40),'FaceColor','blue','EdgeColor','none'); hold on; alpha .5;
-patch(isosurface(Y,X,Z,Isect1(1:stp:end,1:stp:end,1:Zmax),21000),'FaceColor','red','EdgeColor','none'); alpha .5
-patch(isosurface(Y,X,Z,Isect2(1:stp:end,1:stp:end,1:Zmax),11000),'FaceColor','green','EdgeColor','none');
-
- camlight(5,30);
-light('Position',[1000,1.5E4 8000],'Style','local');
- lighting phong; % view(112,34);
-view(-111,38);
+if shownucs ==1
+patch(isosurface(Y,X,Z,data,nt,'material','dull'),'FaceColor','blue','EdgeColor','none'); hold on; alpha .3;
+end
+
+if disp_nascent == 1
+patch(isosurface(Y,X,Z,Isect1(1:stp:end,1:stp:end,1:Zmax),lev1*25000,'material','shiny'),'FaceColor','red','EdgeColor','none'); alpha .3
+patch(isosurface(Y,X,Z,Isect2(1:stp:end,1:stp:end,1:Zmax),lev2*15100,'material','shiny'),'FaceColor','green','EdgeColor','none');
+end
+
set(gcf,'color','k'); set(gca,'color','k');
+toc
+
+%% 3D-isosurfaces Draw dots
+tic
+
+points1 = [d1(:,1)*50-yp1*50,d1(:,2)*50-xp1*50,zspace*Zs-zspace*d1(:,3)];
+points2 = [d2(:,1)*50-yp1*50,d2(:,2)*50-xp1*50,zspace*Zs-zspace*d2(:,3)];
+
+V1 = zeros(size(X)); V2 = V1;
+
+ind1 = cell(Zs,1);
+ind2 = cell(Zs,1);
+for zs =1:Zs;
+ layer = d1(:,3)<zs+1 & d1(:,3)>zs -1;
+ xs = points1(layer,1)/(50*ws)*length(x);
+ ys = points1(layer,2)/(50*hs)*length(y);
+ ind1{zs} = floor(xs) + length(y)*(floor(ys)) + length(x)*length(y)*(zs-1);
+
+ layer = d2(:,3)<zs+1 & d2(:,3)>zs -1;
+ xs = points2(layer,1)/(50*ws)*length(x);
+ ys = points2(layer,2)/(50*hs)*length(y);
+ ind2{zs} = floor(xs) + length(y)*(floor(ys)) + length(x)*length(y)*(zs-1);
+
+end
+inds1 = cell2mat(ind1);
+inds2 = cell2mat(ind2);
+V1(inds1) = 20;
+V2(inds2) = 20;
+
+
+figure(4); hold on;
+ patch(isosurface(X,Y,Z,V1,1,'material','dull'),'FaceColor','c','EdgeColor','none');
+patch(isosurface(X,Y,Z,V2,.5,'material','dull'),'FaceColor','k','EdgeColor','none');
+% camlight left;
+%light('Position',[1000,1.5E4 8000],'Style','local');
+% lighting phong; % view(112,34);
+view(194,80);
+%
+
+toc
+
+

0 comments on commit 1bbb5ed

Please sign in to comment.