{Gel_Plotting_Macros_Andreas This macro was modified by Andreas Becker in may 1995. If you have questions or suggestions email to becker@ps1515.chemie.uni-marburg.de This macro works in the same way as the original macro. The chances are: 1.) The windows are named like the original file they have been created from: Original window: acb000.tif Temp window: Temp abc000.tif Plots window: Plots abc000.tif The name of the window appears in the pictures too. Peaks are numbered in order of measuring. 2.) In the original macro the plotted lanes were compressed to a limited window size in the "plots window", it doesn’t matter how many lanes you evaluated. Plotting a lot of lanes each lane become very small. This causes an overestimation error for small peaks, the impossibility of measuring very small peaks and an inaccuracy for all the peaks. This happens always if you plot several lanes with quiet different pixel values. This problem is solved by leaving the lane hight equal for any numbers of lanes. It is an disadvantage of my macro that you need more buffer. May be you have to change the UnDoBufferSize in the preferences. } var {Global variables} RoiLeft,RoiTop,RoiWidth,RoiHeight:integer; GelPid,MarkedPid,TempPid,PlotsPid,nLanes,count,ppv:integer; SaveRoiLeft,SaveRoiTop,hOffset,vOffset:integer; MinY,MaxY,xscale,yscale:real; VerticalLanes,Uncalibrated:boolean; { Andreas: Macro modified } GelTitel, TempTitel, Plotstitle:string; GelPid,MarkedPid,PlotsPid,nLanes,count,ppv:integer; procedure MarkLane; var left,top,width,height:integer; GelNotCalibrated:boolean; min,max:real; begin GetRoi(left,top,width,height); if width=0 then begin PutMessage('Please outline the next lane.'); exit; end; if (VerticalLanes and (left=RoiLeft)) or (not VerticalLanes and (top=RoiTop)) then begin PutMessage('This lane has already been marked.'); exit; end; nLanes:=nLanes+1; ChoosePic(GelPid); if VerticalLanes then begin MakeRoi(left+hOffset,RoiTop+vOffset,RoiWidth,RoiHeight); RoiLeft:=left; rUser1[nLanes]:=left; end else begin MakeRoi(RoiLeft+hOffset,top+vOffset,RoiWidth,RoiHeight); RoiTop:=top; rUser1[nLanes]:=top; end; GetPlotData(count,ppv,min,max); if minMaxY then MaxY:=max; SelectPic(MarkedPid); if VerticalLanes then MakeRoi(left,RoiTop,RoiWidth,RoiHeight) else MakeRoi(RoiLeft,top,RoiWidth,RoiHeight); DrawBoundary; SetFontSize(9); if VerticalLanes then begin SetText('Centered, No Background'); MoveTo(RoiLeft+RoiWidth/2,RoiTop-6); end else begin SetText('Right Justified, No Background'); MoveTo(RoiLeft-2,RoiTop+RoiHeight/2); end; Write(nLanes:1); RestoreRoi; SelectPic(MarkedPid); end; macro 'Mark First Lane [1]'; var GelWidth,GelHeight,left,width:integer; margin,leftm,rightm,topm,bottomm:integer; begin RequiresVersion(1.54); if WindowTitle='Temp' then begin PutMessage('To restart, select the first lane in the gel.'); exit; end; GetRoi(RoiLeft,RoiTop,RoiWidth,RoiHeight); if RoiWidth=0 then begin PutMessage('The Setup macro expects the Gel to be displayed and the first lane outlined.'); exit; end; VerticalLanes:=RoiHeight>RoiWidth; Uncalibrated:=not Calibrated; GelPid:=PidNumber; SetForegroundColor(255); SetBackgroundColor(0); MinY:=999999; MaxY:=-999999; nLanes:=0; margin:=20; GetPicSize(GelWidth,GelHeight); leftm:=RoiLeft; if leftm>margin then leftm:=margin; rightm:=GelWidth-(RoiWidth+RoiLeft); if rightm>margin then rightm:=margin; bottomm:=GelHeight-(RoiHeight+RoiTop); if bottomm>margin then bottomm:=margin; topm:=RoiTop; if topm>margin then topm:=margin; if VerticalLanes then MakeRoi(RoiLeft-leftm,RoiTop-topm, GelWidth-RoiLeft+leftm,RoiHeight+topm+bottomm) else MakeRoi(RoiLeft-leftm,RoiTop-topm, RoiWidth+leftm+rightm,GelHeight-RoiTop+topm); { Andreas: Macro modified } ChoosePic(GelPid); TempTitel:=WindowTitle; Duplicate('Temp ',TempTitel); TempPid:=PidNumber; SetText('centered Justified'); SetFontSize(8); MoveTo(5,5); write(TempTitel); MarkedPid:=PidNumber; SaveRoiLeft:=RoiLeft; SaveRoiTop:=RoiTop; hOffset:=RoiLeft-leftm; vOffset:=RoiTop-topm; RoiLeft:=leftm; RoiTop:=topm; SelectPic(GelPid); KillRoi; SelectPic(MarkedPid); MakeRoi(RoiLeft,RoiTop,RoiWidth,RoiHeight); if VerticalLanes then RoiLeft:=-1 else RoiTop:=-1; SetPlotScale(0,0); MarkLane; end; macro 'Mark Next Lane [2]'; var left,top,width,height:integer; GelNotCalibrated:boolean; min,max:real; begin if nLanes=0 then begin PutMessage('Please use the "Mark First Lane" macro first.'); Exit; end; MarkLane; end; macro 'Plot Lanes [3]'; var left,top,width,height:integer; GelNotCalibrated:boolean; i,LaneLength:integer; xmin,xmax,ymin,ymax,min,max:real; { Andreas: Macro modified MaxPlotWindowHeight:integer; } NeededSize:integer; PlotTop,PlotBottom,PlotWidth,PlotHeight:integer; hMargin,vMargin,SavePlotTop,PlotWindowSize:integer; PlotWinHeight,PlotWinWidth,PlotsPid:integer; begin if nLanes=0 then begin PutMessage('Please use the Setup and Mark macros first.'); Exit; end; if VerticalLanes then LaneLength:=RoiHeight else LaneLength:=RoiWidth; PlotWidth:=LaneLength; if PlotWidth<500 then PlotWidth:=500; if PlotWidth>(2*LaneLength) then PlotWidth:=2*LaneLength; PlotHeight:=PlotWidth/2; if PlotHeight<200 then PlotHeight:=200; if PlotHeight>400 then PlotHeight:=400; { Andreas: Macro modified MaxPlotWindowHeight:=800; } hMargin:=5; vMargin:=25; PlotWinHeight:=nLanes*PlotHeight+2*vMargin; { Andreas: Macro modified if PlotWinHeight>MaxPlotWindowHeight then begin PlotWinHeight:=MaxPlotWindowHeight; PlotHeight:=(PlotWinHeight-2*vMargin)/nLanes; end; } PlotWinWidth:=PlotWidth+2*hMargin; PlotWindowSize:=PlotWinWidth*PlotWinHeight; if PlotWindowSize>UndoBufferSize then begin NeededSize:=(PlotWindowSize+0.05*PlotWindowSize) div 1024; PutMessage('Use Preferences(Options Menu) to increase the Undo buffer size to at least ',NeededSize:1,'K.'); KillRoi; exit; end; SetForegroundColor(255); SetBackgroundColor(0); SetNewSize(PlotWinWidth,PlotWinHeight); { Andreas: Macro modified } ChoosePic(GelPid); GelTitel:=WindowTitle; MakeNewWindow('Plots ',Geltitel); PlotsPid:=PidNumber; SetText('centered Justified'); SetFontSize(9); MoveTo(PlotWinWidth/2,vmargin-20); ChoosePic(GelPid); GelTitel:=WindowTitle; ChoosePic(Plotspid); write(GelTitel); if UnCalibrated then begin SetText('centerd Justified'); SetFontSize(9); MoveTo( PlotWinWidth/2,vmargin-10); Write(' Uncalibr.'); end else begin SetText('centered Justified'); SetFontSize(9); MoveTo(PlotWinWidth/2,vmargin-10); Write(' Uncalibr. OD'); end; xmin:=0; xmax:=count-1; ymin:=MinY; ymax:=MaxY; xscale:=PlotWidth/(xmax-xmin); yscale:=PlotHeight/(ymax-ymin); PlotTop:=vMargin; SavePlotTop:=PlotTop; RoiLeft:=SaveRoiLeft; RoiTop:=SaveRoiTop; SetLineWidth(1); for i:=1 to nLanes do begin PlotBottom:=PlotTop+(ymax-ymin)*yscale; ChoosePic(GelPid); if VerticalLanes then MakeRoi(rUser1[i]+hOffset,RoiTop,RoiWidth,RoiHeight) else MakeRoi(RoiLeft,rUser1[i]+vOffset,RoiWidth,RoiHeight); GetPlotData(count,ppv,min,max); SelectPic(PlotsPid); MoveTo(hMargin,PlotBottom); LineTo(PlotWinWidth-hMargin,PlotBottom); MoveTo(hMargin,PlotBottom-(PlotData[0]-ymin)*yscale); for i:=1 to count-1 do LineTo(hMargin+i*xscale,PlotBottom-(PlotData[i]-ymin)*yscale); PlotTop:=PlotTop+PlotHeight; end; nLanes:=0; ResetCounter; SetOptions('Area'); WandAutoMeasure(true); AdjustAreas(true); { Andreas: Macro modified } LabelParticles(true); IncludeInteriorHoles(true); SetFontSize(9); SetText('Centered'); if Uncalibrated then SetScale(0,'pixels') else SetScale(sqrt(xscale*yscale/ppv),'unit'); end;