string experlist,str_resol,st_mw,st_h,str_width; string filename,expername,line,lanestring,lastlane,gelname; float mw,h,width; integer i,lanenr,resol,ok; FILE fp; CRFPRINT fpr; DIALOG dlg; if not(FilePromptName("Select the GeneScan file you want to import",filename,0)) then stop; for i=1 to DbGetExperCount do if DbGetExperClass(i)="FPR" then experlist=experlist+DbGetExperName(i)+" "; expername=""; str_resol="1000"; str_width="5"; gelname=filename; while find(gelname,"\",1)>0 do splitstring(gelname,"\"); if find(gelname,".",1) then gelname=splitstring(gelname,"."); DlgAddText(dlg,"Select the experiment",20,20,180,15); DlgAddList(dlg,experlist,expername,20,40,150,200,"LIST"); DlgAddText(dlg,"Gel file name in BioNumerics",200,20,150,15); DlgAddEdit(dlg,gelname,200,40,150,22); DlgAddText(dlg,"Curve resolution",200,70,150,15); DlgAddEdit(dlg,str_resol,200,90,70,22); DlgAddText(dlg,"Band width",200,120,150,15); DlgAddEdit(dlg,str_width,200,140,70,22); ok=0; while not(ok) do { if not(DlgShow(dlg,"Import GeneScan file",370,300)) then stop; ok=1; if expername="" then { ok=0; message("You should select an experiment!"); } resol=val(str_resol); width=val(str_width); } if not(FileOpenRead(fp,filename)) then { message("ERROR: unable to read file"); stop; } gelname=filename; while find(gelname,"\",1)>0 do splitstring(gelname,"\"); CrFprCreate(fpr,gelname,expername); setbusy("Importing band table..."); lastlane="";lanenr=0; while not(FileIsEnd(fp)) do { line=FileRead(fp,999); lanestring=splitstring(line,","); splitstring(line," ");splitstring(line," "); st_mw=splitstring(line," "); mw=val(st_mw); st_h=splitstring(line," "); h=val(st_h); if (lanestring<>"") and (st_mw<>"") and (st_h<>"") then { if lanestring<>lastlane then { if not(DbIsKeyPresent(lanestring)) then DbAddEntry(lanestring); lanenr=CrFprAddLane(fpr,expername,lanestring); lastlane=lanestring; } CrFprAddBand(fpr,lanenr,mw,h,width); } } FileClose(fp); CrFprBandsToCurve(fpr,resol); CrFprSave(fpr); setbusy("");