def _convert_to_df(in_file, freq, raw_file):
dat = defaultdict(Counter)<EOL>if isinstance(in_file, (str, unicode)):<EOL><INDENT>with open(in_file) as in_handle:<EOL><INDENT>for line in in_handle:<EOL><INDENT>cols = line.strip().split("<STR_LIT:\t>")<EOL>counts = freq[cols[<NUM_LIT:3>]]<EOL>dat = _expand(dat, counts, int(cols[<NUM_LIT:1>]), int(cols[<NUM_LIT:2>]))<EOL><DEDENT><DEDENT><DEDENT>else:<EOL><INDENT>if raw_file:<EOL><INDENT>out_handle = open(raw_file, "<STR_LIT:w>")<EOL><DEDENT>for name in in_file:<EOL><INDENT>counts = freq[name]<EOL>if raw_file:<EOL><INDENT>print("<STR_LIT>" % ("<STR_LIT>", in_file[name][<NUM_LIT:0>], in_file[name][<NUM_LIT:1>], name, sum(counts.values()), "<STR_LIT:+>"), file=out_handle, end="<STR_LIT>")<EOL><DEDENT>dat = _expand(dat, counts, in_file[name][<NUM_LIT:0>], in_file[name][<NUM_LIT:1>])<EOL><DEDENT><DEDENT>for s in dat:<EOL><INDENT>for p in dat[s]:<EOL><INDENT>dat[s][p] = mlog2(dat[s][p] + <NUM_LIT:1>)<EOL><DEDENT><DEDENT>return dat<EOL>
convert data frame into table with pandas