scripts/emerge/precompute_emerge.py
def run(args):
    """
    * create FASTA file
    * predict secondary structure
    * make SEED
    * launch rfsearch
    """
    for rna in parse_input_file(args.inputfile):
        folder = '%s_%s' % (rna['row_id'], rna['name'])
        rna_dir = os.path.join(args.destination, folder)
        if not os.path.exists(rna_dir):
            os.mkdir(rna_dir)
        else:
            overlap = os.path.join(rna_dir, 'overlap')
            if os.path.exists(overlap):
                continue
        os.chdir(rna_dir)
        with open('input.fasta', 'w') as fasta:
            fasta.write('>%s\n%s\n' % (rna['name'], rna['sequence']))
        cmd = ('module load mpi/openmpi-x86_64 && '
               'bsub -o {0}/lsf_output.txt -e {0}/lsf_error.txt -g /emerge '
                     '"cd {0} && '
                     'rm -f DESC && '
                     'predict_ss.pl -infile input.fasta -outfile SEED -r && '
                     'rfsearch.pl -nodesc -t 30 -cnompi -relax && '
                     'rfmake.pl -t 50 -a -forcethr && '
                     'mkdir rscape && R-scape --outdir rscape --cyk align && '
                     'cd .. && '
                     'rqc-overlap.pl {1}"').format(rna_dir, folder)
        print cmd
        if not args.test:
            os.system(cmd)

    * create FASTA file
    * predict secondary structure
    * make SEED
    * launch rfsearch
    
create FASTA file
predict secondary structure
make SEED
launch rfsearch
create FASTA file predict secondary structure make SEED launch rfsearch
def run(args):
    for rna in parse_input_file(args.inputfile):
        folder = '%s_%s' % (rna['row_id'], rna['name'])
        rna_dir = os.path.join(args.destination, folder)
        if not os.path.exists(rna_dir):
            os.mkdir(rna_dir)
        else:
            overlap = os.path.join(rna_dir, 'overlap')
            if os.path.exists(overlap):
                continue
        os.chdir(rna_dir)
        with open('input.fasta', 'w') as fasta:
            fasta.write('>%s\n%s\n' % (rna['name'], rna['sequence']))
        cmd = ('module load mpi/openmpi-x86_64 && '
               'bsub -o {0}/lsf_output.txt -e {0}/lsf_error.txt -g /emerge '
                     '"cd {0} && '
                     'rm -f DESC && '
                     'predict_ss.pl -infile input.fasta -outfile SEED -r && '
                     'rfsearch.pl -nodesc -t 30 -cnompi -relax && '
                     'rfmake.pl -t 50 -a -forcethr && '
                     'mkdir rscape && R-scape --outdir rscape --cyk align && '
                     'cd .. && '
                     'rqc-overlap.pl {1}"').format(rna_dir, folder)
        print cmd
        if not args.test:
            os.system(cmd)
def run ( args ) : for rna in parse_input_file ( args . inputfile ) : folder = '%s_%s' % ( rna [ 'row_id' ] , rna [ 'name' ] ) rna_dir = os . path . join ( args . destination , folder ) if not os . path . exists ( rna_dir ) : os . mkdir ( rna_dir ) else : overlap = os . path . join ( rna_dir , 'overlap' ) if os . path . exists ( overlap ) : continue os . chdir ( rna_dir ) with open ( 'input.fasta' , 'w' ) as fasta : fasta . write ( '>%s\n%s\n' % ( rna [ 'name' ] , rna [ 'sequence' ] ) ) cmd = ( 'module load mpi/openmpi-x86_64 && ' 'bsub -o {0}/lsf_output.txt -e {0}/lsf_error.txt -g /emerge ' '"cd {0} && ' 'rm -f DESC && ' 'predict_ss.pl -infile input.fasta -outfile SEED -r && ' 'rfsearch.pl -nodesc -t 30 -cnompi -relax && ' 'rfmake.pl -t 50 -a -forcethr && ' 'mkdir rscape && R-scape --outdir rscape --cyk align && ' 'cd .. && ' 'rqc-overlap.pl {1}"' ) . format ( rna_dir , folder ) print cmd if not args . test : os . system ( cmd )
create FASTA file
 predict secondary structure
 make SEED
 launch rfsearch
create FASTA file predict secondary structure make SEED launch rfsearch
"""
    * create FASTA file
    * predict secondary structure
    * make SEED
    * launch rfsearch
    """
args