Module Expr Str Import alias identifier Import alias Import alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias alias alias alias alias alias alias alias alias alias ClassDef bases NameLoad body FunctionDef arguments args NameParam NameParam defaults body Assign NameStore Call AttributeLoad Call AttributeLoad NameLoad attr attr Str Assign AttributeStore NameLoad attr SubscriptLoad NameLoad Index Num Assign AttributeStore NameLoad attr Call NameLoad SubscriptLoad NameLoad Index Num Assign AttributeStore NameLoad attr SubscriptLoad NameLoad Index Num Assign AttributeStore NameLoad attr SubscriptLoad NameLoad Index Num Assign AttributeStore NameLoad attr SubscriptLoad NameLoad Index Num Assign AttributeStore NameLoad attr SubscriptLoad NameLoad Index Num Assign AttributeStore NameLoad attr SubscriptLoad NameLoad Index Num Assign AttributeStore NameLoad attr SubscriptLoad NameLoad Index Num Assign AttributeStore NameLoad attr SubscriptLoad NameLoad Index Num Assign AttributeStore NameLoad attr SubscriptLoad NameLoad Index Num Assign AttributeStore NameLoad attr SubscriptLoad NameLoad Index Num Assign AttributeStore NameLoad attr SubscriptLoad NameLoad Slice Num decorator_list FunctionDef arguments args NameParam defaults body Return Call AttributeLoad Str attr GeneratorExp Call NameLoad NameLoad comprehension NameStore TupleLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr Call AttributeLoad Str attr AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body Return IfExp CompareEq BinOpBitAnd AttributeLoad NameLoad attr Num Num Str Str decorator_list NameLoad FunctionDef arguments args NameParam defaults body If CompareEq BinOpBitAnd AttributeLoad NameLoad attr Num Num body Assign NameStore Str orelse If CompareEq BinOpBitAnd AttributeLoad NameLoad attr Num Num body Assign NameStore Str orelse Assign NameStore Str AugAssignAdd AttributeStore NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam defaults body Assign NameStore SubscriptLoad Call AttributeLoad AttributeLoad NameLoad attr attr Str Num Index Num Return BinOpMod Str TupleLoad AttributeLoad NameLoad attr NameLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr decorator_list NameLoad decorator_list ClassDef bases NameLoad body FunctionDef arguments args NameParam NameParam NameParam defaults NameLoad body Assign NameStore Call NameLoad NameLoad For NameStore NameLoad body If CompareEq SubscriptLoad NameLoad Index Num Str body Continue Assign NameStore Call NameLoad NameLoad If NameLoad body Expr Call NameLoad NameLoad decorator_list decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults Num body Assign NameStore Call AttributeLoad NameLoad attr Str If UnaryOpNot NameLoad body Return BinOpAdd NameLoad Call AttributeLoad Str attr NameLoad Assign TupleStore NameStore NameStore TupleLoad Str Call AttributeLoad Str attr NameLoad AugAssignAdd NameStore Call AttributeLoad Str attr NameLoad NameLoad NameLoad Return NameLoad decorator_list ClassDef bases NameLoad body FunctionDef arguments args NameParam NameParam defaults body Assign NameStore Call AttributeLoad NameLoad attr Assign AttributeStore NameLoad attr SubscriptLoad NameLoad Index Num Assign AttributeStore NameLoad attr Call NameLoad SubscriptLoad NameLoad Index Num Assign AttributeStore NameLoad attr Call NameLoad SubscriptLoad NameLoad Index Num Assign AttributeStore NameLoad attr Call NameLoad SubscriptLoad NameLoad Index Num Assign AttributeStore NameLoad attr Call NameLoad SubscriptLoad NameLoad Index Num decorator_list decorator_list ClassDef bases NameLoad body FunctionDef arguments args NameParam NameParam defaults body Expr Call AttributeLoad Call NameLoad NameLoad NameLoad attr NameLoad Assign NameStore Call NameLoad NameLoad For NameStore NameLoad body Expr Call AttributeLoad NameLoad attr Call NameLoad NameLoad decorator_list FunctionDef arguments args NameParam defaults body For TupleStore NameStore NameStore Call NameLoad NameLoad keyword Lambda arguments args NameParam defaults AttributeLoad NameLoad attr body Assign NameStore Call NameLoad NameLoad Assign NameStore AttributeLoad SubscriptLoad NameLoad Index Num attr Assign NameStore Num For NameStore NameLoad body AugAssignAdd NameStore BinOpMult AttributeLoad NameLoad attr AttributeLoad NameLoad attr Expr Yield TupleLoad NameLoad BinOpDiv BinOpMult NameLoad Num NameLoad decorator_list decorator_list FunctionDef arguments args NameParam NameParam defaults body Assign NameStore SubscriptLoad Call AttributeLoad Call AttributeLoad Call AttributeLoad NameLoad attr NameLoad attr Str Str attr Str Num Index Num Assign NameStore SubscriptLoad Call AttributeLoad Call AttributeLoad NameLoad attr NameLoad attr Str Index Num Return Call AttributeLoad Str attr TupleLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam NameParam defaults NameLoad NameLoad NameLoad NameLoad body Assign NameStore Call NameLoad NameLoad NameLoad Assign NameStore IfExp NameLoad Str Str Assign NameStore BinOpAdd NameLoad NameLoad Assign NameStore IfExp NameLoad Str NameLoad Assign NameStore IfExp NameLoad BinOpAdd BinOpAdd NameLoad Str NameLoad NameLoad Assign NameStore IfExp NameLoad BinOpAdd BinOpAdd NameLoad Str NameLoad NameLoad Return TupleLoad NameLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Assign NameStore Call AttributeLoad Call AttributeLoad Call AttributeLoad NameLoad attr Str Str attr Str Str attr Str Str Assign NameStore Call AttributeLoad Call AttributeLoad NameLoad attr NameLoad attr Str Call AttributeLoad Str attr NameLoad Assign NameStore BinOpAdd NameLoad Str If Call AttributeLoad NameLoad attr NameLoad body Expr Call NameLoad Call AttributeLoad Str attr NameLoad Assign NameStore Call AttributeLoad Str attr NameLoad NameLoad AugAssignAdd NameStore Call AttributeLoad Str attr NameLoad Expr Call NameLoad NameLoad Expr Call NameLoad Call AttributeLoad Str attr NameLoad Return NameLoad decorator_list FunctionDef arguments args defaults body Assign NameStore TupleLoad TupleLoad Str Str TupleLoad Str Str TupleLoad Str Str TupleLoad Str Str TupleLoad Str Str TupleLoad Str Str TupleLoad Str Str TupleLoad Str Str TupleLoad Str Str TupleLoad Str Str TupleLoad Str Str TupleLoad Str Str TupleLoad Str Str TupleLoad Str Str Assign NameStore Call NameLoad NameLoad Expr Call AttributeLoad NameLoad attr Call NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Call NameLoad AttributeLoad NameLoad attr Assign TupleStore NameStore NameStore Call AttributeLoad NameLoad attr NameLoad If CompareNotEq Call NameLoad NameLoad Num body Expr Call AttributeLoad NameLoad attr UnaryOpNot Call AttributeLoad NameLoad attr Assign TupleStore NameStore NameLoad Assign NameStore Call AttributeLoad Str attr NameLoad Assign NameStore BinOpAdd SubscriptLoad Call AttributeLoad NameLoad attr Str Num Index Num Str Assign NameStore Call AttributeLoad Str attr NameLoad Assign NameStore Call NameLoad NameLoad keyword NameLoad For NameStore Call NameLoad NameLoad body If CompareEq SubscriptLoad NameLoad Index Num Str body Print AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr orelse Assign NameStore Call NameLoad NameLoad Expr Call AttributeLoad NameLoad attr Print AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Call NameLoad AttributeLoad NameLoad attr Assign TupleStore NameStore NameStore Call AttributeLoad NameLoad attr NameLoad If CompareLt Call NameLoad NameLoad Num body Expr Call AttributeLoad NameLoad attr UnaryOpNot Call AttributeLoad NameLoad attr Assign NameStore SubscriptLoad NameLoad Index Num Assign NameStore SubscriptLoad NameLoad Slice Num For NameStore NameLoad body Assign NameStore Call AttributeLoad Str attr NameLoad Expr Call NameLoad NameLoad keyword NameLoad keyword NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str ImportFrom alias Assign NameStore Call NameLoad AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr keyword Str keyword Str Assign TupleStore NameStore NameStore Call AttributeLoad NameLoad attr NameLoad If CompareLt Call NameLoad NameLoad Num body Expr Call AttributeLoad NameLoad attr UnaryOpNot Call AttributeLoad NameLoad attr Assign NameStore SubscriptLoad NameLoad Index Num Assign NameStore SubscriptLoad NameLoad Slice Num Expr Call NameLoad NameLoad Assign NameStore ListLoad For NameStore NameLoad body AugAssignAdd NameStore Call NameLoad Call AttributeLoad NameLoad attr NameLoad Str Assign NameStore ListComp NameLoad comprehension NameStore NameLoad CompareNotIn Str NameLoad Expr Call AttributeLoad NameLoad attr Call AttributeLoad Str attr Call NameLoad NameLoad Assign NameStore AttributeLoad NameLoad attr Assign NameStore Lambda arguments args NameParam defaults SubscriptLoad Call AttributeLoad Call AttributeLoad NameLoad attr NameLoad attr NameLoad Index Num Expr Call AttributeLoad NameLoad attr keyword NameLoad Assign NameStore Call NameLoad For TupleStore NameStore NameStore Call NameLoad NameLoad keyword NameLoad body Assign NameStore Call NameLoad Call NameLoad NameLoad Assign NameStore Call NameLoad NameLoad Assign NameStore Call AttributeLoad Str attr NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad Call AttributeLoad NameLoad attr SubscriptLoad NameLoad Index Num If CompareEq NameLoad Num body Assign NameStore Call NameLoad NameLoad Assign NameStore Call AttributeLoad Str attr NameLoad NameLoad Expr Call AttributeLoad NameLoad attr Str NameLoad NameLoad orelse Assign NameStore Call AttributeLoad Str attr NameLoad NameLoad Expr Call AttributeLoad NameLoad attr NameLoad NameLoad NameLoad keyword NameLoad Expr Call AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Call NameLoad AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Str keyword Str keyword Str Expr Call AttributeLoad NameLoad attr keyword Num Assign TupleStore NameStore NameStore Call AttributeLoad NameLoad attr NameLoad If CompareNotEq Call NameLoad NameLoad Num body Expr Call AttributeLoad NameLoad attr UnaryOpNot Call AttributeLoad NameLoad attr Assign TupleStore NameStore NameStore NameLoad Assign NameStore AttributeLoad NameLoad attr Assign NameStore SubscriptLoad Call AttributeLoad NameLoad attr Str Index Num Assign NameStore BinOpAdd NameLoad Str If UnaryOpNot Call NameLoad NameLoad NameLoad body Return Assign NameStore BinOpAdd NameLoad Str Assign TupleStore NameStore NameStore TupleLoad BinOpAdd NameLoad Str BinOpAdd NameLoad Str If Call NameLoad NameLoad NameLoad body Assign NameStore Call AttributeLoad Str attr NameLoad NameLoad NameLoad Expr Call NameLoad NameLoad Assign NameStore Call AttributeLoad Str attr NameLoad NameLoad Expr Call NameLoad NameLoad keyword NameLoad If Call NameLoad NameLoad NameLoad body Assign NameStore Str AugAssignAdd NameStore Call AttributeLoad Str attr AttributeLoad NameLoad attr AugAssignAdd NameStore Call AttributeLoad Str attr NameLoad NameLoad Expr Call NameLoad NameLoad keyword NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Call NameLoad AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Str keyword Str keyword TupleLoad Str Str Str keyword Str Expr Call AttributeLoad NameLoad attr Str keyword NameLoad keyword Str keyword Str Assign TupleStore NameStore NameStore Call AttributeLoad NameLoad attr NameLoad If CompareNotEq Call NameLoad NameLoad Num body Expr Call AttributeLoad NameLoad attr UnaryOpNot Call AttributeLoad NameLoad attr Assign TupleStore NameStore NameStore NameLoad Assign NameStore AttributeLoad NameLoad attr If AttributeLoad NameLoad attr body Expr Call AttributeLoad NameLoad attr Str orelse Assign NameStore Call NameLoad ListLoad NameLoad Call AttributeLoad Str attr NameLoad Assign NameStore SubscriptLoad Call AttributeLoad NameLoad attr Str Num Index Num Assign NameStore AttributeLoad Call NameLoad NameLoad attr Assign NameStore Call AttributeLoad Str attr NameLoad NameLoad If CompareIn NameLoad TupleLoad Str Str body AugAssignAdd NameStore Str Assign NameStore BinOpAdd NameLoad Str Expr Call NameLoad NameLoad keyword NameLoad If CompareEq NameLoad Str body Return NameLoad Assign NameStore BinOpAdd NameLoad Str Assign NameStore Call AttributeLoad Str attr NameLoad NameLoad NameLoad Expr Call NameLoad NameLoad Return NameLoad Assign NameStore BinOpAdd NameLoad Str If Call NameLoad NameLoad NameLoad body Expr Call NameLoad NameLoad keyword NameLoad Assign NameStore Call NameLoad NameLoad For TupleStore NameStore NameStore Call AttributeLoad NameLoad attr body Print Call AttributeLoad Str attr TupleLoad NameLoad Call AttributeLoad Str attr NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Call NameLoad AttributeLoad NameLoad attr Assign TupleStore NameStore NameStore Call AttributeLoad NameLoad attr NameLoad If CompareLt Call NameLoad NameLoad Num body Expr Call AttributeLoad NameLoad attr UnaryOpNot Call AttributeLoad NameLoad attr Assign NameStore SubscriptLoad NameLoad Index Num Assign NameStore SubscriptLoad NameLoad Slice Num Assign NameStore BinOpAdd SubscriptLoad Call AttributeLoad NameLoad attr Str Num Index Num Str If Call NameLoad NameLoad NameLoad body Assign NameStore Call NameLoad NameLoad Str Assign NameStore Call NameLoad NameLoad keyword NameLoad For TupleStore NameStore NameStore Call AttributeLoad NameLoad attr body Print NameLoad Call AttributeLoad Str attr GeneratorExp Call NameLoad NameLoad comprehension NameStore TupleLoad NameLoad Str Str Num NameLoad Str Str Str BinOpAdd Str NameLoad Expr Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Call AttributeLoad Str attr NameLoad Assign NameStore Call AttributeLoad Str attr NameLoad Call AttributeLoad Str attr NameLoad Expr Call NameLoad NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Import alias Assign NameStore Call NameLoad AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Assign TupleStore NameStore NameStore Call AttributeLoad NameLoad attr NameLoad If CompareNotEq Call NameLoad NameLoad Num body Expr Call AttributeLoad NameLoad attr UnaryOpNot Call AttributeLoad NameLoad attr Assign TupleStore NameStore NameLoad Assign NameStore BinOpAdd SubscriptLoad Call AttributeLoad NameLoad attr Str Num Index Num Str If Call NameLoad NameLoad NameLoad body Assign NameStore Call AttributeLoad Str attr NameLoad Expr Call NameLoad NameLoad keyword NameLoad Assign SubscriptStore NameLoad Index Call AttributeLoad NameLoad attr NameLoad NameLoad Return Call AttributeLoad AttributeLoad AttributeLoad NameLoad attr attr attr NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Call NameLoad AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Str keyword NameLoad keyword Str keyword Str Expr Call AttributeLoad NameLoad attr Str keyword Num keyword Str keyword Str Assign TupleStore NameStore NameStore Call AttributeLoad NameLoad attr NameLoad If CompareLt Call NameLoad NameLoad Num body Expr Call AttributeLoad NameLoad attr UnaryOpNot Call AttributeLoad NameLoad attr Assign TupleStore NameStore NameStore NameLoad Assign NameStore AttributeLoad NameLoad attr Assign NameStore IfExp NameLoad Str Str Assign NameStore SubscriptLoad Call AttributeLoad NameLoad attr Str Num Index Num Assign NameStore BinOpAdd NameLoad Call AttributeLoad Str attr NameLoad Assign NameStore BinOpAdd NameLoad Str Expr Call NameLoad ListLoad NameLoad NameLoad Str NameLoad AugAssignAdd NameStore Call AttributeLoad Str attr NameLoad If NameLoad body AugAssignAdd NameStore Call AttributeLoad Str attr AttributeLoad NameLoad attr Expr Call NameLoad NameLoad keyword NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str ImportFrom alias Assign NameStore TupleLoad Str Str Assign NameStore Call NameLoad AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr keyword Str Expr Call AttributeLoad NameLoad attr Str keyword NameLoad keyword Str keyword Str Expr Call AttributeLoad NameLoad attr Str keyword Str keyword NameLoad keyword Str Assign TupleStore NameStore NameStore Call AttributeLoad NameLoad attr NameLoad If CompareLt Call NameLoad NameLoad Num body Expr Call AttributeLoad NameLoad attr UnaryOpNot Call AttributeLoad NameLoad attr Assign NameStore SubscriptLoad NameLoad Index Num Assign NameStore SubscriptLoad NameLoad Slice Num Assign NameStore AttributeLoad NameLoad attr Assign NameStore ListComp NameLoad comprehension NameStore NameLoad CompareNotIn Str NameLoad If AttributeLoad NameLoad attr body Assign NameStore NameLoad orelse Assign NameStore ListComp ListLoad ListLoad NameLoad Str comprehension NameStore NameLoad Assign NameStore Call NameLoad NameLoad keyword NameLoad Expr Call AttributeLoad NameLoad attr Assign NameStore ListComp Call AttributeLoad NameLoad attr Str Str comprehension NameStore NameLoad Assign NameStore ListComp Call AttributeLoad NameLoad attr Str Str comprehension NameStore NameLoad If CompareEq NameLoad Str body Assign NameStore Str AugAssignAdd NameStore Call AttributeLoad Str attr NameLoad Call AttributeLoad Str attr NameLoad AugAssignAdd NameStore Str orelse If CompareEq NameLoad Str body Assign NameStore Str AugAssignAdd NameStore Call AttributeLoad Str attr NameLoad Call AttributeLoad Str attr NameLoad Expr Call NameLoad NameLoad keyword AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body Assign NameStore NameLoad Assign NameStore Num Assign NameStore Lambda arguments args NameParam defaults CompareIn NameLoad TupleLoad Num Num Assign NameStore Call NameLoad GeneratorExp NameLoad comprehension TupleStore NameStore NameStore AttributeLoad NameLoad attr For TupleStore NameStore NameStore AttributeLoad NameLoad attr body If BoolOpAnd CompareNotEq Call NameLoad NameLoad Call NameLoad NameLoad CompareIsNot NameLoad NameLoad body Expr Yield IfExp AttributeLoad NameLoad attr BinOpSub NameLoad NameLoad NameLoad Assign NameStore NameLoad AugAssignAdd NameStore NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Import alias ImportFrom alias Assign NameStore Call NameLoad AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Assign TupleStore NameStore NameStore Call AttributeLoad NameLoad attr NameLoad If CompareNotEq Call NameLoad NameLoad Num body Expr Call AttributeLoad NameLoad attr UnaryOpNot Call AttributeLoad NameLoad attr Assign TupleStore NameStore NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call NameLoad NameLoad Assign NameStore Call NameLoad NameLoad For NameStore Call AttributeLoad NameLoad attr body AugAssignAdd SubscriptStore NameLoad Index AttributeLoad NameLoad attr Call NameLoad Call NameLoad NameLoad AugAssignAdd SubscriptStore NameLoad Index AttributeLoad NameLoad attr Num If AttributeLoad NameLoad attr body Print AttributeLoad NameLoad attr AttributeLoad NameLoad attr SubscriptLoad Str Index AttributeLoad NameLoad attr Call NameLoad GeneratorExp NameLoad comprehension TupleStore NameStore NameStore AttributeLoad NameLoad attr AttributeLoad NameLoad attr Call NameLoad Call NameLoad NameLoad For TupleStore NameStore NameStore Call NameLoad Call AttributeLoad NameLoad attr body Assign NameStore IfExp NameLoad Call AttributeLoad Str attr GeneratorExp Call NameLoad NameLoad comprehension NameStore Call NameLoad NameLoad Str Print Call AttributeLoad Str attr TupleLoad NameLoad Call NameLoad SubscriptLoad NameLoad Index NameLoad NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Call NameLoad AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Str keyword Str keyword NameLoad keyword Str Expr Call AttributeLoad NameLoad attr Str keyword NameLoad keyword Str keyword Str Expr Call AttributeLoad NameLoad attr keyword Num Assign TupleStore NameStore NameStore Call AttributeLoad NameLoad attr NameLoad If CompareNotEq Call NameLoad NameLoad Num body Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Assign TupleStore NameStore NameLoad Assign NameStore AttributeLoad NameLoad attr Assign NameStore AttributeLoad NameLoad attr If NameLoad body Assert Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call AttributeLoad NameLoad attr Str Str If NameLoad body Assign NameStore BinOpAdd NameLoad Str If Call NameLoad NameLoad NameLoad body Expr Call NameLoad Call AttributeLoad Str attr NameLoad Assign NameStore Call AttributeLoad Str attr NameLoad NameLoad NameLoad orelse Assign NameStore Call AttributeLoad Str attr NameLoad NameLoad AugAssignAdd NameStore Call AttributeLoad Str attr NameLoad If AttributeLoad NameLoad attr body AugAssignAdd NameStore Str If BoolOpAnd Call AttributeLoad NameLoad attr Str Call NameLoad NameLoad NameLoad body Expr Call NameLoad NameLoad If Call AttributeLoad NameLoad attr Str body Assign NameStore NameLoad orelse Assign NameStore Call AttributeLoad NameLoad attr Str Str Assign NameStore BinOpAdd NameLoad Str If Call NameLoad NameLoad NameLoad body Assign NameStore Call AttributeLoad Str attr NameLoad NameLoad AugAssignAdd NameStore Call AttributeLoad Str attr NameLoad Expr Call NameLoad NameLoad Assign NameStore BinOpAdd NameLoad Str If Call NameLoad NameLoad NameLoad body Expr Call NameLoad Call AttributeLoad Str attr NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Import alias ImportFrom alias Assign NameStore Call NameLoad AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr keyword NameLoad Assign TupleStore NameStore NameStore Call AttributeLoad NameLoad attr NameLoad If CompareNotEq Call NameLoad NameLoad Num body Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Assign TupleStore NameStore NameLoad Assign NameStore ListLoad Assign TupleStore NameStore NameStore IfExp Call AttributeLoad NameLoad attr Str TupleLoad Str ListLoad Str TupleLoad Str ListLoad Assign TupleStore NameStore NameStore IfExp AttributeLoad NameLoad attr TupleLoad Str Str TupleLoad Str Str Expr Call AttributeLoad NameLoad attr NameLoad If AttributeLoad NameLoad attr body Expr Call AttributeLoad NameLoad attr Str Assign NameStore Call AttributeLoad Str attr NameLoad If AttributeLoad NameLoad attr body Assign NameStore ListComp NameLoad comprehension NameStore NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad Call AttributeLoad Str attr NameLoad Expr Call AttributeLoad NameLoad attr ListLoad Str NameLoad Call AttributeLoad Str attr NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad Call AttributeLoad Str attr NameLoad Expr Call AttributeLoad NameLoad attr ListLoad Str NameLoad Call AttributeLoad Str attr NameLoad Expr Call AttributeLoad NameLoad attr NameLoad For NameStore NameLoad body Expr Call AttributeLoad NameLoad attr Call AttributeLoad Str attr Call AttributeLoad Str attr NameLoad Assign NameStore Call NameLoad AttributeLoad NameLoad attr ListComp GeneratorExp NameLoad comprehension NameStore NameLoad comprehension NameStore NameLoad Expr Call AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Call NameLoad AttributeLoad NameLoad attr Assign TupleStore NameStore NameStore Call AttributeLoad NameLoad attr NameLoad If CompareNotEq Call NameLoad NameLoad Num body Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr FunctionDef arguments args NameParam defaults body Print AttributeLoad NameLoad attr decorator_list Expr Call NameLoad SubscriptLoad NameLoad Index Num keyword NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults Str body Expr Str Assign TupleStore NameStore NameStore TupleLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr Assign NameStore Num Assign NameStore ListLoad Assign NameStore Num If CompareIs NameLoad NameLoad body Return TupleLoad NameLoad NameLoad For TupleStore NameStore NameStore NameLoad body Assign NameStore IfExp CompareEq NameLoad Num NameLoad BinOpAdd NameLoad NameLoad If CompareEq NameLoad Num body Assign NameStore SubscriptLoad NameLoad Slice NameLoad NameLoad orelse If CompareEq NameLoad Num body Assign NameStore Str orelse If CompareEq NameLoad Num body Assign NameStore BinOpMult NameLoad NameLoad AugAssignAdd NameStore NameLoad orelse If CompareEq NameLoad Num body Assign NameStore BinOpMult Str NameLoad orelse If CompareIn NameLoad TupleLoad Num Num body Assign NameStore Str orelse Raise NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Assign NameStore NameLoad Return TupleLoad Call AttributeLoad Str attr NameLoad NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Call NameLoad AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Str keyword Str keyword Str keyword Str Expr Call AttributeLoad NameLoad attr Str keyword Str keyword NameLoad keyword Str Expr Call AttributeLoad NameLoad attr Str keyword Str keyword Num keyword Str keyword Str Expr Call AttributeLoad NameLoad attr Str keyword Str keyword Num keyword Str keyword Str Expr Call AttributeLoad NameLoad attr Str keyword NameLoad keyword Str keyword Str Expr Call AttributeLoad NameLoad attr Str keyword NameLoad keyword Str keyword Str ImportFrom alias Assign TupleStore NameStore NameStore Call AttributeLoad NameLoad attr NameLoad If CompareNotEq Call NameLoad NameLoad Num body Expr Call AttributeLoad NameLoad attr UnaryOpNot Call AttributeLoad NameLoad attr Assign TupleStore NameStore NameStore NameLoad Assign NameStore AttributeLoad NameLoad attr Assign NameStore AttributeLoad NameLoad attr Assign NameStore Call NameLoad NameLoad Assign NameStore SubscriptLoad Call AttributeLoad NameLoad attr Str Index Num Assign NameStore BinOpAdd NameLoad Str Assign NameStore BinOpAdd NameLoad Str Assign NameStore BinOpAdd NameLoad Str Expr Call AttributeLoad NameLoad attr Call AttributeLoad Str attr NameLoad Assign NameStore Call NameLoad NameLoad Str Assign NameStore AttributeLoad NameLoad attr Assign NameStore Call NameLoad GeneratorExp NameLoad comprehension TupleStore NameStore NameStore Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Call AttributeLoad Str attr NameLoad NameLoad Assign NameStore Str Assign NameStore Call NameLoad GeneratorExp Call AttributeLoad NameLoad attr NameLoad comprehension NameStore AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Call AttributeLoad Str attr NameLoad Assign NameStore Call NameLoad NameLoad Str If NameLoad body Assign NameStore Call NameLoad NameLoad Str If NameLoad body Assign NameStore Call NameLoad NameLoad Str Print NameLoad Call AttributeLoad Str attr NameLoad NameLoad Print NameLoad For TupleStore NameStore NameStore Call NameLoad AttributeLoad NameLoad attr body Assign NameStore SubscriptLoad NameLoad Index NameLoad Assign NameStore Call NameLoad NameLoad Assign NameStore ListComp NameLoad comprehension NameStore Call AttributeLoad NameLoad attr NameLoad UnaryOpNot AttributeLoad NameLoad attr Assign NameStore Call NameLoad NameLoad Assign NameStore Num Print NameLoad Call AttributeLoad Str attr NameLoad NameLoad NameLoad NameLoad Print NameLoad Call NameLoad Call NameLoad AttributeLoad NameLoad attr Print NameLoad If NameLoad body Assign NameStore Call NameLoad NameLoad NameLoad NameLoad NameLoad Print NameLoad Call AttributeLoad Str attr NameLoad NameLoad Assign NameStore Call NameLoad BinOpMult ListLoad NameLoad NameLoad keyword Str keyword Num Print NameLoad Call AttributeLoad Str attr NameLoad Print NameLoad Assign NameStore ListLoad For NameStore NameLoad body Assign NameStore AttributeLoad NameLoad attr Assign NameStore NameLoad If NameLoad body Print NameLoad NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Assign NameStore IfExp AttributeLoad NameLoad attr Str Str Assign NameStore BinOpAdd AttributeLoad NameLoad attr Num Assign NameStore Call AttributeLoad Str attr NameLoad NameLoad NameLoad Print NameLoad NameLoad Print NameLoad For TupleStore NameStore NameStore Call NameLoad NameLoad NameLoad body Assign TupleStore NameStore NameStore Call NameLoad NameLoad If CompareIs NameLoad NameLoad body Continue Assign NameStore Num Assign NameStore Num Assign NameStore Call NameLoad NameLoad Assign NameStore Call AttributeLoad Str attr NameLoad NameLoad NameLoad NameLoad Call NameLoad NameLoad Assign NameStore Call AttributeLoad Str attr NameLoad Print NameLoad NameLoad Print NameLoad Print NameLoad NameLoad Print NameLoad decorator_list If CompareEq NameLoad Str body Expr Call NameLoad
N/A N/A 
SAM alignment format. There are other tools that handles better SAM and BAM.
This script simply parses the lines in SAM into human readable fields.

http://samtools.sourceforge.net/SAM1.pdf
 N/A os.path op N/A sys N/A logging collections defaultdict itertools groupby jcvi.formats.base LineFile jcvi.formats.fasta Fasta jcvi.formats.sizes Sizes jcvi.utils.cbook fill jcvi.assembly.base Astat jcvi.apps.base OptionParser ActionDispatcher Popen PIPE need_update sh mkdir glob popen get_abs_path SamLine N/A object N/A __init__ N/A N/A self row N/A N/A N/A args N/A N/A N/A N/A row strip split N/A N/A self qname N/A args N/A 0 N/A N/A self flag N/A int N/A args N/A 1 N/A N/A self rname N/A args N/A 2 N/A N/A self pos N/A args N/A 3 N/A N/A self mapq N/A args N/A 4 N/A N/A self cigar N/A args N/A 5 N/A N/A self mrnm N/A args N/A 6 N/A N/A self mpos N/A args N/A 7 N/A N/A self isize N/A args N/A 8 N/A N/A self seq N/A args N/A 9 N/A N/A self qual N/A args N/A 10 N/A N/A self extra N/A args N/A 11 N/A __str__ N/A N/A self N/A N/A N/A N/A N/A join N/A N/A str x N/A x N/A N/A self qname N/A self flag N/A self rname N/A self pos N/A self mapq N/A self cigar N/A self mrnm N/A self mpos N/A self isize N/A self seq N/A self qual N/A N/A join N/A self extra N/A orientation N/A N/A self N/A N/A N/A N/A N/A N/A N/A self flag 16 0 - + N/A property update_readname N/A N/A self N/A N/A N/A N/A N/A N/A self flag 64 0 N/A N/A tag /1 N/A N/A N/A N/A N/A self flag 128 0 N/A N/A tag /2 N/A N/A tag N/A N/A self qname tag N/A pairline N/A N/A self N/A N/A N/A qpos N/A N/A N/A N/A self cigar split H 1 N/A 0 N/A N/A %s:%s	%s:%s N/A N/A self qname qpos N/A self rname N/A self pos N/A property N/A Sam N/A LineFile N/A __init__ N/A N/A self filename callback N/A None N/A N/A fp N/A open filename N/A row fp N/A N/A N/A N/A row N/A 0 @ N/A N/A N/A s N/A SamLine row N/A callback N/A N/A N/A callback s N/A N/A output_bam N/A N/A cmd outfile cpus N/A 8 N/A N/A bam N/A N/A outfile endswith .bam N/A N/A bam N/A N/A N/A cmd N/A N/A  > {0} format outfile N/A N/A outcmd mflag N/A samtools view -bS N/A N/A -F 4 -@ {0} format cpus N/A cmd N/A N/A  | {0} {1} - > {2} format outcmd mflag outfile N/A cmd N/A GenomeCoverageLine N/A object N/A __init__ N/A N/A self row N/A N/A N/A args N/A N/A row split N/A N/A self seqid N/A args N/A 0 N/A N/A self depth N/A int N/A args N/A 1 N/A N/A self positions N/A int N/A args N/A 2 N/A N/A self length N/A int N/A args N/A 3 N/A N/A self freq N/A float N/A args N/A 4 N/A N/A GenomeCoverageFile N/A LineFile N/A __init__ N/A N/A self filename N/A N/A N/A N/A N/A N/A super GenomeCoverageFile self __init__ filename N/A fp N/A open filename N/A row fp N/A N/A N/A N/A self append N/A GenomeCoverageLine row N/A iter_coverage_seqid N/A N/A self N/A N/A N/A N/A seqid lines N/A groupby self key N/A N/A N/A x N/A N/A x seqid N/A N/A lines N/A list lines N/A length N/A N/A lines N/A 0 length N/A counts 0 N/A r lines N/A N/A counts N/A N/A r depth N/A r positions N/A N/A N/A seqid N/A N/A counts 1.0 length N/A N/A get_prefix N/A N/A readfile dbfile N/A N/A N/A rdpf N/A N/A N/A N/A N/A N/A N/A op basename readfile replace .gz rsplit . 1 N/A 0 N/A dbpf N/A N/A N/A N/A N/A op basename dbfile split . N/A 0 N/A N/A N/A . join N/A rdpf dbpf N/A get_samfile N/A N/A readfile dbfile bam mapped unmapped bowtie N/A False False False False N/A N/A prefix N/A get_prefix readfile dbfile N/A ext N/A bam .bam .sam N/A samfile N/A prefix ext N/A ext N/A bowtie .fastq ext N/A mapped N/A mapped N/A N/A prefix .mapped ext None N/A unmapped N/A unmapped N/A N/A prefix .unmapped ext None N/A N/A samfile mapped unmapped N/A get_minibam N/A N/A bamfile region N/A N/A N/A xregion N/A N/A N/A N/A N/A N/A region replace : _ replace - _ replace , N/A minibamfile N/A N/A N/A N/A op basename bamfile replace .bam N/A N/A .{}.bam format xregion N/A baifile N/A minibamfile .bai N/A N/A N/A op exists baifile N/A N/A N/A sh N/A N/A rm {} format baifile N/A cmd N/A N/A samtools view {} {} -b format bamfile region N/A cmd N/A N/A  -o {0} format minibamfile N/A N/A sh cmd N/A N/A sh N/A N/A samtools index {0} format minibamfile N/A minibamfile N/A main N/A N/A N/A N/A N/A actions N/A N/A append append /1 or /2 to read names N/A bed convert bam files to bed N/A pair parse sam file and get pairs N/A pairs print paired-end reads from BAM file N/A chimera parse sam file from `bwasw` and list multi-hit reads N/A ace convert sam file to ace N/A index convert to bam, sort and then index N/A consensus convert bam alignments to consensus FASTA N/A fpkm calculate FPKM values from BAM file N/A coverage calculate depth for BAM file N/A vcf call SNPs on a set of bam files N/A mapped extract mapped/unmapped reads from samfile N/A count count the number of reads mapped using htseq N/A merge merge bam files N/A p N/A ActionDispatcher actions N/A N/A N/A p dispatch N/A globals N/A append N/A N/A args N/A N/A N/A 
    %prog append bamfile

    Append /1 or /2 to read names. Useful for using the Tophat2 bam file for
    training AUGUSTUS gene models.
     N/A p N/A OptionParser N/A append __doc__ N/A N/A opts args N/A N/A p parse_args args N/A N/A N/A len args 1 N/A N/A N/A N/A sys exit N/A N/A N/A p print_help N/A N/A bamfile args N/A icmd N/A N/A samtools view -h {0} format bamfile N/A bamfile N/A N/A N/A N/A bamfile rsplit . 1 N/A 0 .append.bam N/A ocmd N/A N/A samtools view -b -@ 64 - -o {0} format bamfile N/A p N/A Popen ocmd stdin PIPE N/A row N/A popen icmd N/A N/A N/A N/A row N/A 0 @ N/A N/A N/A p stdin N/A N/A row strip N/A N/A s N/A SamLine row N/A N/A N/A s update_readname N/A N/A p stdin s N/A bed N/A N/A args N/A N/A N/A 
    %prog bed bedfile bamfiles

    Convert bam files to bed.
     N/A p N/A OptionParser N/A bed __doc__ N/A N/A opts args N/A N/A p parse_args args N/A N/A N/A len args 2 N/A N/A N/A N/A sys exit N/A N/A N/A p print_help N/A bedfile N/A args N/A 0 N/A bamfiles N/A args N/A 1 N/A bamfile bamfiles N/A N/A cmd N/A N/A bamToBed -i {0} format bamfile N/A N/A sh cmd outfile bedfile append True N/A merge N/A N/A args N/A N/A N/A 
    %prog merge merged_bams bams1_dir bams2_dir ...

    Merge BAM files. Treat the bams with the same prefix as a set.
    Output the commands first.
     jcvi.apps.grid MakeManager N/A p N/A OptionParser N/A merge __doc__ N/A N/A N/A p set_sep sep _ help Separator to group per prefix N/A N/A opts args N/A N/A p parse_args args N/A N/A N/A len args 2 N/A N/A N/A N/A sys exit N/A N/A N/A p print_help N/A merged_bams N/A args N/A 0 N/A bamdirs N/A args N/A 1 N/A N/A mkdir merged_bams N/A bams N/A N/A x bamdirs N/A N/A bams N/A glob N/A N/A op join x *.bam N/A bams N/A x N/A x bams N/A nsorted x N/A N/A N/A logging debug N/A N/A Found a total of {0} BAM files. format N/A len bams N/A sep N/A opts sep N/A key N/A N/A N/A x N/A N/A N/A N/A N/A N/A op basename x split sep N/A 0 N/A N/A N/A bams sort key key N/A mm N/A MakeManager N/A N/A prefix files N/A groupby bams key key N/A N/A files N/A sorted N/A list files N/A nfiles N/A len files N/A source N/A N/A join files N/A target N/A N/A op join merged_bams N/A N/A op basename N/A files N/A 0 N/A N/A nfiles 1 N/A N/A source N/A get_abs_path source N/A cmd N/A N/A ln -s {0} {1} format source target N/A N/A N/A mm add target cmd N/A N/A cmd N/A N/A samtools merge -@ 8 {0} {1} format target source N/A N/A N/A mm add files target cmd remove True N/A N/A N/A mm write N/A count N/A N/A args N/A N/A N/A 
    %prog count bamfile gtf

    Count the number of reads mapped using `htseq-count`.
     N/A p N/A OptionParser N/A count __doc__ N/A N/A N/A p add_option --type default exon help Only count feature type N/A N/A N/A p set_cpus cpus 8 N/A N/A opts args N/A N/A p parse_args args N/A N/A N/A len args 2 N/A N/A N/A N/A sys exit N/A N/A N/A p print_help N/A N/A bamfile gtf args N/A cpus N/A opts cpus N/A pf N/A N/A N/A bamfile split . N/A 0 N/A countfile N/A pf .count N/A N/A N/A need_update bamfile countfile N/A N/A N/A nsorted N/A pf _nsorted N/A N/A nsortedbam nsortedsam N/A N/A nsorted .bam N/A nsorted .sam N/A N/A need_update bamfile nsortedsam N/A N/A cmd N/A N/A samtools sort -@ {0} -n {1} {2} format cpus bamfile nsorted N/A N/A sh cmd N/A cmd N/A N/A samtools view -@ {0} -h {1} format cpus nsortedbam N/A N/A sh cmd outfile nsortedsam N/A N/A need_update nsortedsam countfile N/A N/A cmd htseq-count --stranded=no --minaqual=10 N/A cmd N/A N/A  -t {0} format N/A opts type N/A cmd N/A N/A  {0} {1} format nsortedsam gtf N/A N/A sh cmd outfile countfile N/A coverage N/A N/A args N/A N/A N/A 
    %prog coverage fastafile bamfile

    Calculate coverage for BAM file. BAM file will be sorted unless with
    --nosort.
     N/A p N/A OptionParser N/A coverage __doc__ N/A N/A N/A p add_option --format default bigwig choices N/A bedgraph bigwig coverage help Output format N/A N/A N/A p add_option --nosort default False action store_true help Do not sort BAM N/A N/A opts args N/A N/A p parse_args args N/A N/A N/A len args 2 N/A N/A N/A N/A sys exit N/A N/A N/A p print_help N/A N/A fastafile bamfile args N/A format N/A opts format N/A N/A opts nosort N/A N/A N/A N/A logging debug BAM sorting skipped N/A N/A bamfile N/A index N/A bamfile N/A N/A --fasta={0} format fastafile N/A pf N/A N/A N/A bamfile rsplit . 2 N/A 0 N/A sizesfile N/A N/A Sizes fastafile filename N/A cmd N/A N/A genomeCoverageBed -ibam {0} -g {1} format bamfile sizesfile N/A N/A format N/A bedgraph bigwig N/A N/A cmd  -bg N/A bedgraphfile N/A pf .bedgraph N/A N/A sh cmd outfile bedgraphfile N/A N/A format bedgraph N/A N/A bedgraphfile N/A bigwigfile N/A pf .bigwig N/A cmd N/A N/A bedGraphToBigWig {0} {1} {2} format bedgraphfile sizesfile bigwigfile N/A N/A sh cmd N/A bigwigfile N/A coveragefile N/A pf .coverage N/A N/A need_update fastafile coveragefile N/A N/A N/A sh cmd outfile coveragefile N/A gcf N/A GenomeCoverageFile coveragefile N/A N/A seqid cov N/A N/A gcf iter_coverage_seqid N/A N/A N/A N/A join N/A seqid N/A N/A {0:.1f} format cov N/A fpkm N/A N/A args N/A N/A N/A 
    %prog fpkm fastafile *.bam

    Calculate FPKM values from BAM file.
     N/A p N/A OptionParser N/A fpkm __doc__ N/A N/A opts args N/A N/A p parse_args args N/A N/A N/A len args 2 N/A N/A N/A N/A sys exit N/A N/A N/A p print_help N/A fastafile N/A args N/A 0 N/A bamfiles N/A args N/A 1 N/A gffile N/A N/A N/A N/A fastafile rsplit . 1 N/A 0 .gff N/A N/A need_update fastafile gffile N/A N/A fw N/A open gffile w N/A f N/A Fasta fastafile lazy True N/A N/A key size N/A N/A f itersizes_ordered N/A N/A fw N/A N/A join N/A N/A str x N/A x N/A key dummy transcript 1 size . . . N/A ID= key N/A N/A N/A fw close N/A N/A N/A logging debug N/A N/A Dummy GFF created: {0} format gffile N/A cmd N/A N/A cuffdiff {0} {1} format gffile N/A N/A join bamfiles N/A N/A sh cmd N/A pairs N/A N/A args N/A N/A N/A 
    See __doc__ for OptionParser.set_pairs().
     N/A jcvi.formats.bed N/A p N/A OptionParser N/A pairs __doc__ N/A N/A N/A p set_pairs N/A N/A opts targs N/A N/A p parse_args args N/A N/A N/A len targs 1 N/A N/A N/A N/A sys exit N/A N/A N/A p print_help N/A N/A samfile targs N/A bedfile N/A N/A N/A N/A samfile rsplit . 1 N/A 0 .bed N/A N/A need_update samfile bedfile N/A N/A cmd N/A N/A bamToBed -i {0} format samfile N/A N/A sh cmd outfile bedfile N/A N/A args N/A N/A N/A args index samfile bedfile N/A N/A N/A N/A N/A jcvi formats bed pairs args N/A consensus N/A N/A args N/A N/A N/A 
    %prog consensus fastafile bamfile

    Convert bam alignments to consensus FASTQ/FASTA.
     N/A p N/A OptionParser N/A consensus __doc__ N/A N/A N/A p add_option --fasta default False action store_true help Generate consensus FASTA sequences [default: %default] N/A N/A N/A p add_option --mask default 0 type int help Mask bases with quality lower than N/A N/A opts args N/A N/A p parse_args args N/A N/A N/A len args 2 N/A N/A N/A N/A sys exit N/A N/A N/A p print_help N/A N/A fastafile bamfile args N/A fasta N/A opts fasta N/A suffix N/A fasta fasta fastq N/A pf N/A N/A N/A bamfile rsplit . 1 N/A 0 N/A cnsfile N/A pf N/A N/A .cns.{0} format suffix N/A vcfgzfile N/A pf .vcf.gz N/A N/A vcf N/A fastafile bamfile -o vcfgzfile N/A cmd N/A N/A zcat {0} | vcfutils.pl vcf2fq format vcfgzfile N/A fasta N/A N/A cmd N/A N/A  | seqtk seq -q {0} -A - format N/A opts mask N/A N/A sh cmd outfile cnsfile N/A vcf N/A N/A args N/A N/A N/A 
    %prog vcf fastafile bamfiles > out.vcf.gz

    Call SNPs on bam files.
     jcvi.apps.grid Jobs N/A valid_callers N/A mpileup freebayes N/A p N/A OptionParser N/A vcf __doc__ N/A N/A N/A p set_outfile outfile out.vcf.gz N/A N/A N/A p add_option --nosort default False action store_true help Do not sort the BAM files N/A N/A N/A p add_option --caller default mpileup choices valid_callers help Use variant caller [default: %default] N/A N/A opts args N/A N/A p parse_args args N/A N/A N/A len args 2 N/A N/A N/A N/A sys exit N/A N/A N/A p print_help N/A fastafile N/A args N/A 0 N/A bamfiles N/A args N/A 1 N/A caller N/A opts caller N/A unsorted N/A x N/A x bamfiles N/A .sorted. x N/A N/A opts nosort N/A N/A bamfiles unsorted N/A N/A jargs N/A N/A N/A x --unique N/A x unsorted N/A jobs N/A Jobs index args jargs N/A N/A N/A jobs run N/A bamfiles N/A N/A N/A x replace .sorted.bam .bam N/A x bamfiles N/A bamfiles N/A N/A N/A x replace .bam .sorted.bam N/A x bamfiles N/A N/A caller mpileup N/A N/A cmd samtools mpileup -E -uf N/A cmd N/A N/A  {0} {1} format fastafile N/A N/A join bamfiles N/A cmd  | bcftools call -vmO v N/A N/A N/A caller freebayes N/A N/A cmd freebayes -f N/A cmd N/A N/A  {0} {1} format fastafile N/A N/A join bamfiles N/A N/A sh cmd outfile N/A opts outfile N/A breakpoint N/A N/A r N/A N/A N/A op_prev None N/A cum_length 0 N/A is_clip N/A N/A N/A x N/A N/A x N/A 4 5 N/A rl N/A sum N/A l N/A N/A o l N/A r cigartuples N/A N/A op length N/A r cigartuples N/A N/A N/A N/A N/A is_clip op N/A is_clip op_prev N/A op_prev None N/A N/A N/A N/A N/A r is_reverse N/A rl cum_length cum_length N/A op_prev op N/A cum_length length N/A chimera N/A N/A args N/A N/A N/A 
    %prog chimera bamfile

    Parse BAM file from `bwasw` and list multi-hit reads and breakpoints.
     N/A pysam jcvi.utils.natsort natsorted N/A p N/A OptionParser N/A chimera __doc__ N/A N/A N/A p set_verbose N/A N/A opts args N/A N/A p parse_args args N/A N/A N/A len args 1 N/A N/A N/A N/A sys exit N/A N/A N/A p print_help N/A N/A samfile args N/A samfile N/A N/A pysam AlignmentFile samfile N/A rstore N/A defaultdict list N/A hstore N/A defaultdict int N/A r N/A N/A samfile fetch N/A N/A N/A rstore N/A N/A r query_name N/A list N/A breakpoint r N/A N/A hstore N/A N/A r query_name 1 N/A N/A opts verbose N/A N/A N/A sys stderr N/A r query_name N/A +- N/A N/A r is_reverse N/A sum N/A l N/A N/A o l N/A r cigartuples N/A r cigarstring N/A list N/A breakpoint r N/A N/A rn bps N/A natsorted N/A N/A rstore items N/A N/A bps N/A bps N/A N/A | join N/A N/A str x N/A x N/A sorted bps na N/A N/A N/A join N/A rn N/A str N/A hstore N/A rn bps N/A index N/A N/A args N/A N/A N/A 
    %prog index samfile/bamfile

    If SAM file, convert to BAM, sort and then index, using SAMTOOLS
     N/A p N/A OptionParser N/A index __doc__ N/A N/A N/A p add_option --fasta dest fasta default None help add @SQ header to the BAM file [default: %default] N/A N/A N/A p add_option --unique default False action store_true help only retain uniquely mapped reads [default: %default] N/A N/A N/A p set_cpus cpus 8 N/A N/A opts args N/A N/A p parse_args args N/A N/A N/A len args 1 N/A N/A N/A N/A sys exit N/A N/A p print_help N/A N/A samfile args N/A cpus N/A opts cpus N/A fastafile N/A opts fasta N/A fastafile N/A N/A N/A N/A op exists fastafile N/A bamfile N/A N/A samfile replace .sam .bam N/A fastafile N/A N/A faifile N/A fastafile .fai N/A N/A need_update fastafile faifile N/A N/A N/A sh N/A N/A samtools faidx {0} format fastafile N/A cmd N/A N/A samtools view -bt {0} {1} -F 4 -o {2} format faifile samfile bamfile N/A N/A cmd N/A N/A samtools view -bS {0} -F 4 -o {1} format samfile bamfile N/A cmd N/A N/A  -@ {0} format cpus N/A N/A opts unique N/A N/A cmd  -q 1 N/A N/A N/A N/A samfile endswith .sam N/A need_update samfile bamfile N/A N/A N/A sh cmd N/A N/A N/A bamfile endswith .sorted.bam N/A N/A sortedbamfile bamfile N/A N/A prefix N/A N/A bamfile replace .bam N/A sortedbamfile N/A prefix .sorted.bam N/A N/A need_update bamfile sortedbamfile N/A N/A cmd N/A N/A samtools sort {0} -o {1} format bamfile sortedbamfile N/A cmd N/A N/A  -@ {0} format cpus N/A N/A sh cmd N/A baifile N/A sortedbamfile .bai N/A N/A need_update sortedbamfile baifile N/A N/A N/A sh N/A N/A samtools index {0} format sortedbamfile N/A sortedbamfile N/A mapped N/A N/A args N/A N/A N/A 
    %prog mapped sam/bamfile

    Given an input sam/bam file, output a sam/bam file containing only the mapped reads.
    Optionally, extract the unmapped reads into a separate file
     N/A pysam jcvi.apps.grid Jobs N/A p N/A OptionParser N/A mapped __doc__ N/A N/A N/A p set_sam_options extra False N/A N/A opts args N/A N/A p parse_args args N/A N/A N/A len args 1 N/A N/A N/A N/A sys exit N/A N/A p print_help N/A N/A samfile args N/A view_opts N/A N/A N/A oext mopts N/A N/A N/A samfile endswith .sam N/A .sam N/A -S N/A .bam N/A N/A N/A flag ext N/A N/A opts bam N/A -b .bam N/A -h .sam N/A N/A N/A mopts append flag N/A N/A opts uniq N/A N/A N/A N/A mopts append -q1 N/A ext N/A N/A .uniq{0} format ext N/A N/A opts unmapped N/A N/A uopts N/A x N/A x mopts N/A uoutfile N/A N/A samfile replace oext N/A N/A .unmapped{0} format ext N/A N/A N/A uopts extend N/A -f4 samfile N/A N/A -o{0} format uoutfile N/A N/A N/A view_opts append uopts N/A outfile N/A N/A samfile replace oext N/A N/A .mapped{0} format ext N/A N/A N/A mopts extend N/A -F4 samfile N/A N/A -o{0} format outfile N/A N/A N/A view_opts append mopts N/A vo view_opts N/A N/A N/A N/A logging debug N/A N/A samtools view {0} format N/A N/A join vo N/A jobs N/A Jobs N/A pysam view N/A N/A z N/A z x N/A x view_opts N/A N/A N/A jobs run N/A pair N/A N/A args N/A N/A N/A 
    %prog pair samfile

    Parses the sam file and retrieve in pairs format,
    query:pos ref:pos
     N/A p N/A OptionParser N/A pair __doc__ N/A N/A opts args N/A N/A p parse_args args N/A N/A N/A len args 1 N/A N/A N/A N/A sys exit N/A N/A p print_help callback N/A N/A s N/A N/A N/A N/A s pairline N/A N/A N/A Sam N/A args N/A 0 callback callback N/A cigar_to_seq N/A N/A a gap N/A * N/A N/A 
    Accepts a pysam row.

    cigar alignment is presented as a list of tuples (operation,length). For
    example, the tuple [ (0,3), (1,5), (0,2) ] refers to an alignment with 3
    matches, 5 insertions and another 2 matches.

    Op BAM Description
    M 0 alignment match (can be a sequence match or mismatch)
    I 1 insertion to the reference
    D 2 deletion from the reference
    N 3 skipped region from the reference
    S 4 soft clipping (clipped sequences present in SEQ)
    H 5 hard clipping (clipped sequences NOT present in SEQ)
    P 6 padding (silent deletion from padded reference)
    = 7 sequence match
    X 8 sequence mismatch

    convert the sequence based on the cigar string. For example:
     N/A N/A seq cigar N/A N/A a seq N/A a cigar N/A start 0 N/A subseqs N/A N/A npadded 0 N/A N/A cigar None N/A N/A N/A None npadded N/A N/A operation length cigar N/A N/A end N/A N/A operation 2 start N/A start length N/A N/A operation 0 N/A N/A subseq N/A seq N/A start end N/A N/A N/A operation 1 N/A N/A subseq N/A N/A N/A operation 2 N/A N/A subseq N/A gap length N/A npadded length N/A N/A N/A operation 3 N/A N/A subseq N/A N length N/A N/A N/A operation N/A 4 5 N/A N/A subseq N/A N/A NotImplementedError N/A N/A N/A subseqs append subseq N/A start end N/A N/A N/A N/A join subseqs npadded N/A ace N/A N/A args N/A N/A N/A 
    %prog ace bamfile fastafile

    convert bam format to ace format. This often allows the remapping to be
    assessed as a denovo assembly format. bam file needs to be indexed. also
    creates a .mates file to be used in amos/bambus, and .astat file to mark
    whether the contig is unique or repetitive based on A-statistics in Celera
    assembler.
     N/A p N/A OptionParser N/A ace __doc__ N/A N/A N/A p add_option --splitdir dest splitdir default outRoot help split the ace per contig to dir [default: %default] N/A N/A N/A p add_option --unpaired dest unpaired default False help remove read pairs on the same contig [default: %default] N/A N/A N/A p add_option --minreadno dest minreadno default 3 type int help minimum read numbers per contig [default: %default] N/A N/A N/A p add_option --minctgsize dest minctgsize default 100 type int help minimum contig size per contig [default: %default] N/A N/A N/A p add_option --astat default False action store_true help create .astat to list repetitiveness [default: %default] N/A N/A N/A p add_option --readids default False action store_true help create file of mapped and unmapped ids [default: %default] pysam Samfile N/A N/A opts args N/A N/A p parse_args args N/A N/A N/A len args 2 N/A N/A N/A N/A sys exit N/A N/A N/A p print_help N/A N/A bamfile fastafile args N/A astat N/A opts astat N/A readids N/A opts readids N/A f N/A Fasta fastafile N/A prefix N/A N/A N/A bamfile split . N/A 0 N/A acefile N/A prefix .ace N/A readsfile N/A prefix .reads N/A astatfile N/A prefix .astat N/A N/A N/A logging debug N/A N/A Load {0} format bamfile N/A s N/A Samfile bamfile rb N/A ncontigs N/A s nreferences N/A genomesize N/A sum N/A x N/A N/A a x N/A N/A f itersizes N/A N/A N/A logging debug N/A N/A Total {0} contigs with size {1} base format ncontigs genomesize N/A qual 20 N/A totalreads N/A sum N/A N/A N/A s count x N/A x N/A s references N/A N/A N/A logging debug N/A N/A Total {0} reads mapped format totalreads N/A fw N/A open acefile w N/A astat N/A N/A astatfw N/A open astatfile w N/A readids N/A N/A readsfw N/A open readsfile w N/A fw N/A N/A AS {0} {1} format ncontigs totalreads N/A fw N/A N/A i contig N/A enumerate N/A s references N/A N/A cseq N/A f N/A contig N/A nbases N/A len cseq N/A mapped_reads N/A x N/A x N/A N/A s fetch contig N/A N/A x is_unmapped N/A nreads N/A len mapped_reads N/A nsegments 0 N/A fw N/A N/A CO {0} {1} {2} {3} U format contig nbases nreads nsegments N/A fw N/A fill N/A str N/A cseq seq N/A fw N/A astat N/A N/A astat N/A Astat nbases nreads genomesize totalreads N/A astatfw N/A N/A {0}	{1:.1f} format contig astat N/A text N/A fill N/A N/A qual nbases delimiter width 30 N/A fw N/A N/A BQ
{0} format text N/A fw N/A rnames N/A N/A a mapped_reads N/A N/A readname N/A a qname N/A rname readname N/A readids N/A N/A readsfw readname N/A N/A N/A rnames append rname N/A strand N/A N/A a is_reverse C U N/A paddedstart N/A N/A a pos 1 N/A af N/A N/A AF {0} {1} {2} format rname strand paddedstart N/A fw af N/A fw N/A N/A a rname N/A zip mapped_reads rnames N/A N/A N/A aseq npadded N/A cigar_to_seq a N/A N/A aseq None N/A N/A N/A ninfos 0 N/A ntags 0 N/A alen N/A len aseq N/A rd N/A N/A RD {0} {1} {2} {3}
{4} format rname alen ninfos ntags N/A fill aseq N/A qs N/A N/A QA 1 {0} 1 {0} format alen N/A fw rd N/A fw N/A fw qs N/A fw N/A N/A N/A __name__ __main__ N/A N/A N/A main