// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! // ! This script is provided "as is" by Applied Maths. ! // ! You are free to use and modify this script for your own needs. ! // ! Redistribution or reproduction of the script is prohibited. ! // ! DISCLAIMER: ! // ! Improper use of scripts may corrupt your database. ! // ! Running this script is entirely at your own responsibility. ! // ! Applied Maths accepts no lialibility for any consequences ! // ! resulting from its use. ! // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! integer seqcount,i,j,k,ok; string subseq[],experlist,expername; string methodlist,method; integer searchneg,useor; DIALOG dlg; string key,seqstring; SEQUENCE sq; integer present[]; for i=1 to DbGetExperCount do if dbGetExperClass(i)="SEQ" then { if length(expername)=0 then expername=DbGetExperName(i); experlist=experlist+DbGetExperName(i)+" "; } DlgAddText(dlg,"Select sequence type:",15,15,150,15); DlgAddList(dlg,experlist,expername,15,35,150,150,"LIST"); methodlist="Add to list Replace list Search in list"; method="Add to list"; DlgAddText(dlg,"Selection method:",15,190,150,15); DlgAddList(dlg,methodlist,method,15,210,150,53,"LIST"); DlgAddCheck(dlg,"Negative search",searchneg,200,140,150,15); DlgAddCheck(dlg,"Combine using OR",useor,200,160,150,15); DlgAddText(dlg,"Specify subsequence(s)~nthat should be present:",200,15,150,30); seqcount=4; for i=1 to seqcount do { subseq[i]=""; DlgAddEdit(dlg,subseq[i],200,27+i*22,170,16); } ok=0; while not(ok) do { if not(DlgShow(dlg,"Select entries according to subsequence",400,300)) then stop; ok=1; if length(expername)=0 then ok=0; } for i=1 to DbGetEntryCount do { if floor(i/10)=i/10 then setbusy("Processing "+str(i,0,0)); key=DbGetEntryKey(i); if method="Replace list" then DbSetSel(key,0); SeqLoad(sq,key,expername);SeqGet(sq,seqstring); for j=1 to seqcount do { if length(subseq[j])<=0 then present[j]=1; if length(subseq[j])>0 then present[j]=SeqFind(sq,subseq[j],0,0); } if not(useor) then { ok=1; for j=1 to seqcount do if not(present[j]) then ok=0; } if useor then { ok=0; for j=1 to seqcount do if length(subseq[j])>0 and (present[j]) then ok=1; } if method="Search in list" then ok= (ok and DbGetSel(key)); if searchneg then ok=not(ok); if ok then DbSetSel(key,1); if method="Search in list" then DbSetSel(key,ok); } setbusy("");