<s> import sys , re , os <EOL> def antipara ( sequence ) : <EOL> antidict = { "<STR_LIT:A>" : "<STR_LIT:T>" , "<STR_LIT:T>" : "<STR_LIT:A>" , "<STR_LIT>" : "<STR_LIT:C>" , "<STR_LIT:C>" : "<STR_LIT>" } <EOL> revseq = sequence [ : : - <NUM_LIT:1> ] <EOL> return "<STR_LIT>" . join ( [ antidict [ i ] for i in revseq ] ) <EOL> def RNAtranslate ( sequence ) : <EOL> return "<STR_LIT>" . join ( [ i if i in "<STR_LIT>" else "<STR_LIT>" for i in sequence ] ) <EOL> def dispatch ( bowtie_input , f21 , r21 , f25 , r25 ) : <EOL> IN = open ( bowtie_input ) <EOL> F21 = open ( f21 , "<STR_LIT:w>" ) <EOL> R21 = open ( r21 , "<STR_LIT:w>" ) <EOL> F25 = open ( f25 , "<STR_LIT:w>" ) <EOL> R25 = open ( r25 , "<STR_LIT:w>" ) <EOL> for line in IN : <EOL> fields = line . split ( ) <EOL> read_header = fields [ <NUM_LIT:0> ] <EOL> read_polarity = fields [ <NUM_LIT:1> ] <EOL> read_sequence = fields [ <NUM_LIT:4> ] <EOL> if "<STR_LIT:N>" in read_sequence : continue <EOL> read_size = len ( read_sequence ) <EOL> if read_polarity == "<STR_LIT:+>" and read_size == <NUM_LIT> : <EOL> seq = RNAtranslate ( read_sequence ) <EOL> print >> F25 , "<STR_LIT>" % ( read_header , seq ) <EOL> elif read_polarity == "<STR_LIT:->" and read_size == <NUM_LIT> : <EOL> seq = RNAtranslate ( antipara ( read_sequence ) ) <EOL> print >> R25 , "<STR_LIT>" % ( read_header , seq ) <EOL> elif read_polarity == "<STR_LIT:+>" and read_size == <NUM_LIT> : <EOL> seq = RNAtranslate ( read_sequence ) <EOL> print >> F21 , "<STR_LIT>" % ( read_header , seq ) <EOL> elif read_polarity == "<STR_LIT:->" and read_size == <NUM_LIT> : <EOL> seq = RNAtranslate ( antipara ( read_sequence ) ) <EOL> print >> R21 , "<STR_LIT>" % ( read_header , seq ) <EOL> IN . close ( ) <EOL> F21 . close ( ) <EOL> R21 . close ( ) <EOL> F25 . close ( ) <EOL> R25 . close ( ) <EOL> return <EOL> dispatch ( sys . argv [ <NUM_LIT:1> ] , sys . argv [ <NUM_LIT:2> ] , sys . argv [ <NUM_LIT:3> ] , sys . argv [ <NUM_LIT:4> ] , sys . argv [ <NUM_LIT:5> ] ) </s>
