// Exports X-Y tables of metrics (X) & densitometric values (Y) for curves in // the normalisation window //************************************************************* // Sample script provided "as is" by Applied Maths. // You are free to use and modify this script for your // own purposes. // Please notice that improper use of script commands may // corrupt your database. Running this script is entirely at // your own responsibility. Applied Maths accepts no // liability for any damage that results from using // this script. //************************************************************* //$MENU window=fprintimage;popup=Normalization;insertafter=show distortion bars;name=Export X-Y data integer i,lanenr,maxresol; float value,normpos,metric; string expername,activerefsystem,refsystem,st; FILE fp; DIALOG dlg; if AnFprGetCurrent="" then AnFprAttach; if AnFprGetCurrent="" then { message("ERROR: no fingerprint window is currently open"); stop; } expername=AnFprGetType(AnFprGetCurrent); refsystem=AnFprGetRefSystem; if FprGetActiveRefsys(expername)="" then { message("ERROR: the experiment "+expername+" does not have an active reference system"); stop; } activerefsystem=FprGetRefsysDef(expername,FprGetActiveRefsys(expername)); if activerefsystem<>refsystem then { message("ERROR: the reference system of the current gel differs from the active one"); stop; } maxresol=1; for lanenr=1 to AnFprGetLaneCount do if AnFprGetCurveResol(lanenr)>maxresol then maxresol=AnFprGetCurveResol(lanenr); st="This script will export the densitograms of all lanes as the metric values of~n"; st=st+"all the positions (X) and the corresponding densitometric values (Y)~n"; st=st+"Please note:~n"; st=st+" - The gel lanes have to be normalised properly~n"; st=st+" - The gel should be normalised with the active reference system~n"; st=st+" - This reference system should have a metrics calibration curve defined~n"; DlgAddText(dlg,st,15,15,380,100); if not(DlgShow(dlg,"Export X-Y data",420,250)) then stop; if not(FileOpenWrite(fp,DbGetPath+"\export.txt")) then { message("ERROR: Unable to create the file '"+DbGetPath+"\export.txt'"); stop; } for lanenr=1 to AnFprGetLaneCount do { if lanenr>1 then FileWrite(fp," "); FileWrite(fp,"Lane_"+str(lanenr,0,0)+"_X"); FileWrite(fp," Lane_"+str(lanenr,0,0)+"_Y"); } FileWriteLine(fp); for i=0 to maxresol-1 do { for lanenr=1 to AnFprGetLaneCount do { if lanenr>1 then FileWrite(fp," "); if i