Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Source file sgr.ml
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566typet=(string*int*float)list(* Stored in ascending order by (string,int) pairs. *)exceptionBadofstringletraise_badmsg=raise(Badmsg)letcmpsi(s1,i1,_)(s2,i2,_)=Pervasives.compare(s1,i1)(s2,i2)letof_listl=List.sort~compare:cmpsilletto_listt=tletof_chr_listsl=letans=List.map~f:(fun(a,l)->List.map~f:(fun(b,c)->a,b,c)l)linletans=List.concatansinList.sort~compare:cmpsiansletnpartition_exn~eql=letopenListinletinsertllla=letrecloopprefixll=matchllwith|[]->rev([a]::prefix)|l::ll->ifeqa(hd_exnl)then(rev((a::l)::prefix))@llelseloop(l::prefix)llinloop[]llinmap~f:rev(fold_left~f:insertl~init:[]l)letto_chr_listst=leteq(s1,_,_)(s2,_,_)=s1=s2inletll=npartition_exn~eqtinletll=List.map~f:(funl->letx,_,_=List.hd_exnlinx,List.map~f:(fun(_,b,c)->b,c)l)llinllletof_channel?(chr_map=ident)?(increment_bp=0)cin=letparse_line'delimline=matchString.splitline~on:delimwith|[c;i;f]->chr_mapc,int_of_stringi+increment_bp,Float.of_stringf|_->raise_bad"ill-formed line"inletparse_lineline=tryparse_line''\t'linewithBad_->tryparse_line'' 'linewithBadmsg->failwithmsginIn_channel.input_linescin|>List.map~f:parse_lineletof_file?(chr_map=ident)?(increment_bp=0)file=In_channel.with_filefile~f:(of_channel~chr_map~increment_bp)letto_channel?(chr_map=ident)?(increment_bp=0)tcout=letf(s,i,v)=fprintfcout"%s\t%d\t%f\n"(chr_maps)(i+increment_bp)vinList.iter~ftletto_file?(chr_map=ident)?(increment_bp=0)tfile=Out_channel.with_filefile~f:(to_channel~chr_map~increment_bpt)