def parse_s2bins(s2bins):
s2b = {}<EOL>b2s = {}<EOL>for line in s2bins:<EOL><INDENT>line = line.strip().split()<EOL>s, b = line[<NUM_LIT:0>], line[<NUM_LIT:1>]<EOL>if '<STR_LIT>' in b:<EOL><INDENT>continue<EOL><DEDENT>if len(line) > <NUM_LIT:2>:<EOL><INDENT>g = '<STR_LIT:U+0020>'.join(line[<NUM_LIT:2>:])<EOL><DEDENT>else:<EOL><INDENT>g = '<STR_LIT>'<EOL><DEDENT>b = '<STR_LIT>' % (b, g)<EOL>s2b[s] = b <EOL>if b not in b2s:<EOL><INDENT>b2s[b] = []<EOL><DEDENT>b2s[b].append(s)<EOL><DEDENT>return s2b, b2s<EOL>
parse ggKbase scaffold-to-bin mapping
    - scaffolds-to-bins and bins-to-scaffolds