<s> import sys <EOL> from functools import partial <EOL> from itertools import imap , starmap , repeat , izip , chain , ifilter <EOL> from operator import itemgetter , attrgetter , lt <EOL> from collections import Counter <EOL> from pbcore . io import BasH5Reader <EOL> from misc import identityFunc <EOL> if not len ( sys . argv ) >= <NUM_LIT:2> : <EOL> sys . exit ( "<STR_LIT>" ) <EOL> readers = imap ( BasH5Reader , sys . argv [ <NUM_LIT:1> : ] ) <EOL> get_prod = lambda o : getattr ( o , "<STR_LIT>" ) ( "<STR_LIT>" ) <EOL> get_rt = lambda o : getattr ( o , "<STR_LIT>" ) ( "<STR_LIT>" ) <EOL> pcg = itemgetter ( <NUM_LIT:0> , <NUM_LIT:1> , <NUM_LIT:2> ) <EOL> rtg = itemgetter ( <NUM_LIT:0> , <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> , <NUM_LIT:4> , <NUM_LIT:5> , <NUM_LIT:6> , <NUM_LIT:7> ) <EOL> print "<STR_LIT:\t>" . join ( [ "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" ] ) <EOL> for cell in readers : <EOL> movieName = cell . movieName <EOL> good_zmws_cnt = len ( cell . sequencingZmws ) <EOL> all_seq_zmws_cnt = len ( cell . allSequencingZmws ) <EOL> zmwgetters = imap ( itemgetter , cell . allSequencingZmws ) <EOL> allSeqZmws = list ( starmap ( apply , izip ( zmwgetters , repeat ( [ cell ] ) ) ) ) <EOL> subreads = ifilter ( bool , imap ( attrgetter ( "<STR_LIT>" ) , allSeqZmws ) ) <EOL> subread_lens = map ( lambda r : r . readEnd - r . readStart , chain . from_iterable ( subreads ) ) <EOL> total_bases = sum ( subread_lens ) <EOL> bases_g10k = sum ( ifilter ( partial ( lt , <NUM_LIT> ) , subread_lens ) ) <EOL> raw_prods = imap ( get_prod , allSeqZmws ) <EOL> prod_counts = Counter ( raw_prods ) <EOL> prod_summary = pcg ( prod_counts ) <EOL> read_type = imap ( get_rt , allSeqZmws ) <EOL> read_type_counts = Counter ( read_type ) <EOL> read_type_summary = rtg ( read_type_counts ) <EOL> outdata = [ movieName , good_zmws_cnt , all_seq_zmws_cnt ] <EOL> outdata += list ( prod_summary ) <EOL> outdata += list ( read_type_summary ) <EOL> outdata += [ total_bases , bases_g10k ] <EOL> print "<STR_LIT:\t>" . join ( map ( str , outdata ) ) <EOL> cell . close ( ) </s>
