#NEWLINE# def link_elements( chanjo_db , bed_iterable , batch_size = 10000 ) : #NEWLINE# #INDENT# 'Load Sambamba BED output from a stream.' #NEWLINE# rows = bed . chanjo ( bed_iterable ) #NEWLINE# stats = link_mod . rows ( chanjo_db . session , rows ) #NEWLINE# for ( index , stat ) in enumerate ( stats ) : #NEWLINE# #INDENT# chanjo_db . add ( stat ) #NEWLINE# if ( ( rows % batch_size ) == 0 ) : #NEWLINE# #INDENT# chanjo_db . save ( ) #NEWLINE# logger . debug ( 'processed %s exons...' , index ) #NEWLINE# #UNINDENT# #UNINDENT# chanjo_db . save ( )