<s> import sys , subprocess <EOL> from collections import defaultdict <EOL> from smRtools import get_fasta , antipara , RNAtranslate , SmRNAwindow <EOL> fasta_dic = get_fasta ( sys . argv [ <NUM_LIT> ] ) <EOL> objDic = { } <EOL> F = open ( sys . argv [ <NUM_LIT:1> ] , "<STR_LIT:r>" ) <EOL> for line in F : <EOL> fields = line . split ( ) <EOL> polarity = fields [ <NUM_LIT:1> ] <EOL> gene = fields [ <NUM_LIT:2> ] <EOL> offset = int ( fields [ <NUM_LIT:3> ] ) <EOL> size = len ( fields [ <NUM_LIT:4> ] ) <EOL> try : <EOL> objDic [ gene ] . addread ( polarity , offset , size ) <EOL> except KeyError : <EOL> objDic [ gene ] = SmRNAwindow ( gene , fasta_dic [ gene ] ) <EOL> objDic [ gene ] . addread ( polarity , offset , size ) <EOL> F . close ( ) <EOL> OUT = open ( sys . argv [ <NUM_LIT:6> ] , "<STR_LIT:w>" ) <EOL> for x in objDic : <EOL> sequence_list = objDic [ x ] . pairer ( <NUM_LIT:10> , sys . argv [ <NUM_LIT:2> ] , sys . argv [ <NUM_LIT:3> ] , sys . argv [ <NUM_LIT:4> ] , sys . argv [ <NUM_LIT:5> ] ) <EOL> if sequence_list : <EOL> for seq in sequence_list : <EOL> print >> OUT , seq <EOL> F24nt = open ( sys . argv [ <NUM_LIT:7> ] , "<STR_LIT:w>" ) <EOL> R24nt = open ( sys . argv [ <NUM_LIT:8> ] , "<STR_LIT:w>" ) <EOL> F25nt = open ( sys . argv [ <NUM_LIT:9> ] , "<STR_LIT:w>" ) <EOL> R25nt = open ( sys . argv [ <NUM_LIT:10> ] , "<STR_LIT:w>" ) <EOL> F26nt = open ( sys . argv [ <NUM_LIT:11> ] , "<STR_LIT:w>" ) <EOL> R26nt = open ( sys . argv [ <NUM_LIT:12> ] , "<STR_LIT:w>" ) <EOL> n = <NUM_LIT:0> <EOL> for seq in sequence_list : <EOL> n += <NUM_LIT:1> <EOL> if seq [ <NUM_LIT:0> ] == "<STR_LIT:+>" and len ( seq [ <NUM_LIT:1> : ] ) == <NUM_LIT> : print >> F24nt , "<STR_LIT>" % ( n , seq [ <NUM_LIT:1> : ] ) <EOL> if seq [ <NUM_LIT:0> ] == "<STR_LIT:->" and len ( seq [ <NUM_LIT:1> : ] ) == <NUM_LIT> : print >> R24nt , "<STR_LIT>" % ( n , seq [ <NUM_LIT:1> : ] ) <EOL> if seq [ <NUM_LIT:0> ] == "<STR_LIT:+>" and len ( seq [ <NUM_LIT:1> : ] ) == <NUM_LIT> : print >> F25nt , "<STR_LIT>" % ( n , seq [ <NUM_LIT:1> : ] ) <EOL> if seq [ <NUM_LIT:0> ] == "<STR_LIT:->" and len ( seq [ <NUM_LIT:1> : ] ) == <NUM_LIT> : print >> R25nt , "<STR_LIT>" % ( n , seq [ <NUM_LIT:1> : ] ) <EOL> if seq [ <NUM_LIT:0> ] == "<STR_LIT:+>" and len ( seq [ <NUM_LIT:1> : ] ) == <NUM_LIT> : print >> F26nt , "<STR_LIT>" % ( n , seq [ <NUM_LIT:1> : ] ) <EOL> if seq [ <NUM_LIT:0> ] == "<STR_LIT:->" and len ( seq [ <NUM_LIT:1> : ] ) == <NUM_LIT> : print >> R26nt , "<STR_LIT>" % ( n , seq [ <NUM_LIT:1> : ] ) <EOL> OUT . close ( ) <EOL> F24nt . close ( ) <EOL> R24nt . close ( ) <EOL> F25nt . close ( ) <EOL> R25nt . close ( ) <EOL> F26nt . close ( ) <EOL> R26nt . close ( ) <EOL> base_usage = defaultdict ( dict ) <EOL> for i in range ( <NUM_LIT> , <NUM_LIT> ) : <EOL> base_usage [ i ] [ "<STR_LIT>" ] = <NUM_LIT:0> <EOL> base_usage [ i ] [ "<STR_LIT>" ] = <NUM_LIT:0> <EOL> for seq in sequence_list : <EOL> if seq [ <NUM_LIT:1> ] == "<STR_LIT>" : base_usage [ len ( seq ) - <NUM_LIT:1> ] [ "<STR_LIT>" ] += <NUM_LIT:1> <EOL> if seq [ <NUM_LIT:10> ] == "<STR_LIT:A>" : base_usage [ len ( seq ) - <NUM_LIT:1> ] [ "<STR_LIT>" ] += <NUM_LIT:1> <EOL> print "<STR_LIT>" <EOL> print "<STR_LIT>" % tuple ( base_usage [ i ] [ "<STR_LIT>" ] for i in range ( <NUM_LIT> , <NUM_LIT> ) ) <EOL> print "<STR_LIT>" % tuple ( base_usage [ i ] [ "<STR_LIT>" ] for i in range ( <NUM_LIT> , <NUM_LIT> ) ) </s>
