Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Source file bed.ml
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108typeparser_error=[`Bed_parser_errorofint*string][@@derivingsexp]moduleField=Table.Fieldtypeitem=string*int*int*stringlistletitem_of_linel=letopenResultinmatchLine.splitl~on:'\t'with|chrom::chrom_start::chrom_end::others->Field.(parse~ctx:"chrom_start"int)chrom_start>>=funchrom_start->Field.(parse~ctx:"chrom_end"int)chrom_end>>|funchrom_end->chrom,chrom_start,chrom_end,others|_->Error"Expected at least 3 fields separated by tab characters"letline_of_item(chr,start_pos,stop_pos,others)=String.concat~sep:"\t"(chr::Int.to_stringstart_pos::Int.to_stringstop_pos::others)|>Line.of_string_unsafemoduleBed3=structtypeitem={chrom:string;chrom_start:int;chrom_end:int;others:stringarray;}[@@derivingsexp]endmoduleBed4=structtypeitem={chrom:string;chrom_start:int;chrom_end:int;name:string;others:stringarray;}[@@derivingsexp]endmoduleBed5_raw=structtypeitem={chrom:string;chrom_start:int;chrom_end:int;name:string;score:int;others:stringlist;}[@@derivingsexp]letmake~chrom~chrom_start~chrom_end~name~score?(others=[])()=letopenResultinField.(parse~ctx:"chrom"string_with_no_sep)chrom>>=funchrom->Field.(parse~ctx:"name"string_with_no_sep)name>>=funname->Field.(parse_allstring_with_no_sep)others>>=funothers->Ok{chrom;chrom_start;chrom_end;name;score;others}letset_scoreitscore={itwithscore}letitem_of_linel=letopenResultinmatchLine.splitl~on:'\t'with|chrom::chrom_start::chrom_end::name::score::others->Field.(parse~ctx:"chrom_start"int)chrom_start>>=funchrom_start->Field.(parse~ctx:"chrom_end"int)chrom_end>>=funchrom_end->Field.(parse~ctx:"score"int)score>>=funscore->(* don't call [make] to avoid unnecessary checks*)Ok{chrom;chrom_start;chrom_end;name;score;others}|_->Error"Expected at least 5 fields separated by tab characters"letline_of_itemit=it.chrom::Int.to_stringit.chrom_start::Int.to_stringit.chrom_end::it.name::Int.to_stringit.score::it.others|>String.concat~sep:"\t"|>Line.of_string_unsafeendmoduleBed5=structincludeBed5_rawletmake~chrom~chrom_start~chrom_end~name~score?(others=[])()=letopenResultinField.(parse~ctx:"chrom"string_with_no_sep)chrom>>=funchrom->Field.(parse~ctx:"name"string_with_no_sep)name>>=funname->Field.(parse_all~ctx:"others"string_with_no_sep)others>>=funothers->Ok{chrom;chrom_start;chrom_end;name;score;others}letitem_of_linel=letopenResultinmatchLine.splitl~on:'\t'with|chrom::chrom_start::chrom_end::name::score::others->Field.(parse~ctx:"chrom_start"positive_int)chrom_start>>=funchrom_start->Field.(parse~ctx:"chrom_end"positive_int)chrom_end>>=funchrom_end->Field.(parse~ctx:"score"(bounded_int~lo:0~hi:1000))score>>=funscore->(* don't call [make] to avoid unnecessary checks*)Ok{chrom;chrom_start;chrom_end;name;score;others}|_->Error"Expected at least 5 fields separated by tab characters"letline_of_item=Bed5_raw.line_of_itemend