Example #1
0
    def prepare_run(self, log, info):
        wd = info[Keys.WORKDIR]
        basename = os.path.splitext(os.path.split(info[Keys.MZXML])[1])[0]
        info[Keys.PEPXML] = os.path.join(wd, basename + ".pepXML")  #myrimatch default is pepXML NOT pep.xml

        # need to create a working copy to prevent replacement or generic definitions
        # with app specific definitions
        app_info = info.copy()
        app_info['ENZYME'], app_info['MYRIMATCH_MINTERMINICLEAVAGES'] = enzymestr_to_engine(info['ENZYME'],
                                                                                            'Myrimatch')
        app_info["STATIC_MODS"], app_info["VARIABLE_MODS"], _ = genmodstr_to_engine(info["STATIC_MODS"],
                                                                                 info["VARIABLE_MODS"], 'Myrimatch')
        if app_info['FRAGMASSUNIT'] == 'Da':
            app_info['FRAGMASSUNIT'] = 'daltons'

        #link DB to cwd
        app_info['DBASE'] = os.path.join(wd, os.path.basename(info['DBASE']))
        os.symlink(info['DBASE'], app_info['DBASE'])

        #tpl = os.path.join(wd, 'myrimatch.cfg')
        tpl = 'myrimatch.cfg'
        tplfile = os.path.join(wd, tpl)
        read_mod_write(app_info, get_tpl_of_class(self), tplfile)

        exe_path = app_info['MYRIMATCH_DIR']
        exe = app_info['MYRIMATCH_EXE']
        command = "{exe} -cpus {threads} -cfg {tpl} -workdir {workdir} -ProteinDatabase {dbase} {mzxml}".format(
            exe=os.path.join(exe_path, exe), threads=app_info['THREADS'], tpl=tpl,
            workdir=app_info[Keys.WORKDIR], dbase=app_info['DBASE'],
            mzxml=app_info[Keys.MZXML])
        # update original info object with new keys from working copy
        #info = DictUtils.merge(log, info, app_info, priority='left')        
        return info, command
Example #2
0
    def prepare_run(self, log, info):
        wd = info[Keys.WORKDIR]
        exe = info.get(Keys.EXECUTABLE, 'tandem')

        # need to create a working copy to prevent replacement with app specific definitions
        app_info = info.copy()

        app_info = self._define_score(app_info, log)
        app_info["STATIC_MODS"], app_info["VARIABLE_MODS"], app_info['TERMINAL_MODS'] = genmodstr_to_engine(info["STATIC_MODS"],
                                                                                 info["VARIABLE_MODS"], 'XTandem')
        app_info['ENZYME'], app_info['XTANDEM_SEMI_CLEAVAGE'] = enzymestr_to_engine(info['ENZYME'], 'XTandem')

        #files required and written
        app_info['XTANDEM_PARAMS'] = os.path.join(wd, 'xtandem.params')
        templates.read_mod_write(app_info, templates.get_tpl_of_class(self), app_info['XTANDEM_PARAMS'])
        app_info['XTANDEM_INPUT'] = os.path.join(wd, 'xtandem.input')
        app_info['XTANDEM_TAXONOMY'] = os.path.join(wd, 'xtandem.taxonomy')
        app_info['XTANDEM_RESULT'] = os.path.join(wd, 'xtandem.result')
        self._write_input_files(app_info)

        #integrated tandem2xml XTANDEM_RESULT conversion
        info[Keys.PEPXML] = os.path.join(wd, 'xtandem.pep.xml')

        command = '%s %s && Tandem2XML %s %s ' % (
        exe, app_info['XTANDEM_INPUT'], app_info['XTANDEM_RESULT'], info[Keys.PEPXML])
        return info, command
Example #3
0
    def _writemail(self, info):
        info['USERNAME'] = getpass.getuser()

        if info.get('RUNTPP2VIEWER', 'no') == 'no':
            info["LINKTEXT"] = "RUNTPP2VIEWER was 'no'. If you want to visualize the results"
        else:
            basepath = '/IMSB/ra/' + info['USERNAME'] + '/html/petunia/tpp2viewer3_' + info['EXPERIMENT_CODE']
            info["LINKTEXT"] = """To visualize the results use:
https://imsb-ra-tpp.ethz.ch/tpp/cgi-bin/PepXMLViewer.cgi?xmlFileName=%s
https://imsb-ra-tpp.ethz.ch/tpp/cgi-bin/protxml2html.pl?xmlfile=%s

In case the links do not work""" % (basepath + '.pep.xml', basepath + '.prot.xml')

        info['ENGINES_VERSIONS'] = ''
        if 'RUNTANDEM' in info and info['RUNTANDEM'] == 'True':
            info['ENGINES_VERSIONS'] += subprocess.check_output("tandem a | grep TANDEM",
                                                                shell=True)

        if 'RUNOMSSA' in info and info['RUNOMSSA'] == 'True':
            info['ENGINES_VERSIONS'] += subprocess.check_output("omssacl -version", shell=True).replace(
                "2.1.8", "2.1.9")

        if 'RUNMYRIMATCH' in info and info['RUNMYRIMATCH'] == 'True':
            info['ENGINES_VERSIONS'] += subprocess.check_output("myrimatch 2>&1 | grep MyriMatch",
                                                                shell=True)

        if 'RUNCOMET' in info and info['RUNCOMET'] == 'True':
            info['ENGINES_VERSIONS'] += subprocess.check_output("comet 2>&1 | grep version", shell=True)
        info['ENGINES_VERSIONS'] = info['ENGINES_VERSIONS'].strip()

        info['TPPVERSION'] = subprocess.check_output("InteractParser 2>&1 | grep TPP", shell=True).split("(")[1]

        templates.read_mod_write(info, templates.get_tpl_of_class(self), info['MAILFILE'])
    def prepare_run(self, log, info):
        wd = info[Keys.WORKDIR]
        # get iProb corresponding FDR for IDFilter
        info['IPROB'], info['FDR'] = get_iprob_for_fdr(info['FDR_CUTOFF'], info['FDR_TYPE'], mayuout=info.get('MAYUOUT'),
                                                      pepxml=info[Keys.PEPXML])

        # required because openbis requires prot.xml and openms protXML
        peplink = os.path.join(wd, 'iprophet.pepXML')
        os.symlink(info[Keys.PEPXML], peplink)
        info[Keys.PEPXML] = peplink
        info['MZNAME'] = os.path.splitext(os.path.basename(info[Keys.MZXML]))[0]

        tpl = os.path.join(wd, 'part1_pp_ff.toppas')
        templates.read_mod_write(info, templates.get_tpl_of_class(self), tpl)
        #add toppas file path, will be added in dropbox
        info["TOPPASFILES"] = tpl

        rawfeatxml = os.path.join(wd, 'TOPPAS_out/012-IDConflictResolver/*.featureXML')
        info['FEATUREXML'] = os.path.join(wd, os.path.splitext(os.path.basename(info[Keys.MZXML]))[0] + '.featureXML')

        command = 'ExecutePipeline -in %s -out_dir %s  | grep -v "^WARNING" && chmod -R g+w %s && ' \
                  'mv -v %s %s' % (
                      tpl, wd, wd,
                      rawfeatxml, info['FEATUREXML'])
        return info, command
Example #5
0
    def prepare_run(self, log, info):
        wd = info[Keys.WORKDIR]
        exe = info.get(Keys.EXECUTABLE, 'tandem')

        # need to create a working copy to prevent replacement with app specific definitions
        app_info = info.copy()

        app_info = self._define_score(app_info, log)
        app_info["STATIC_MODS"], app_info["VARIABLE_MODS"], app_info[
            'TERMINAL_MODS'] = genmodstr_to_engine(info["STATIC_MODS"],
                                                   info["VARIABLE_MODS"],
                                                   'XTandem')
        app_info['ENZYME'], app_info[
            'XTANDEM_SEMI_CLEAVAGE'] = enzymestr_to_engine(
                info['ENZYME'], 'XTandem')

        #files required and written
        app_info['XTANDEM_PARAMS'] = os.path.join(wd, 'xtandem.params')
        templates.read_mod_write(app_info, templates.get_tpl_of_class(self),
                                 app_info['XTANDEM_PARAMS'])
        app_info['XTANDEM_INPUT'] = os.path.join(wd, 'xtandem.input')
        app_info['XTANDEM_TAXONOMY'] = os.path.join(wd, 'xtandem.taxonomy')
        app_info['XTANDEM_RESULT'] = os.path.join(wd, 'xtandem.result')
        self._write_input_files(app_info)

        #integrated tandem2xml XTANDEM_RESULT conversion
        info[Keys.PEPXML] = os.path.join(wd, 'xtandem.pep.xml')

        command = '%s %s && Tandem2XML %s %s ' % (
            exe, app_info['XTANDEM_INPUT'], app_info['XTANDEM_RESULT'],
            info[Keys.PEPXML])
        return info, command
Example #6
0
    def prepare_run(self, log, info):
        wd = info[Keys.WORKDIR]
        basename = os.path.join(wd, os.path.splitext(os.path.split(info[Keys.MZXML])[1])[0])
        info[Keys.PEPXML] = basename + '.pep.xml'

        # need to create a working copy to prevent replacement or generic definitions
        # with app specific definitions
        app_info = info.copy()

        if info['PRECMASSUNIT'] == 'Da':
            app_info['PRECMASSUNIT'] = '0'
        elif info['PRECMASSUNIT'] == 'ppm':
            app_info['PRECMASSUNIT'] = '2'
        else:
            raise RuntimeError("Precmassunit %s unknown" % info['PRECMASSUNIT'])

        if info['FRAGMASSUNIT'] == 'ppm':
            raise RuntimeError("Comet does not support frag mass error unit PPM")

        if not 0.01 < float(app_info['FRAGMASSERR']) < 1.1:
            log.warn('Very high or low fragmasserror ' + app_info['FRAGMASSERR'])

        app_info["STATIC_MODS"], app_info["VARIABLE_MODS"], _ = genmodstr_to_engine(info["STATIC_MODS"],
                                                                                 info["VARIABLE_MODS"], 'Comet')
        app_info['ENZYME'], app_info['NUM_TERM_CLEAVAGES'] = enzymestr_to_engine(info['ENZYME'], 'Comet')

        tplfile = os.path.join(wd, "comet.params")
        template = get_tpl_of_class(self)
        read_mod_write(app_info,template, tplfile)

        exe_path = app_info['COMET_DIR']
        exe = app_info['COMET_EXE']

        command = "{exe} -N{basename} -P{tplfile} {mzxml}".format(exe=os.path.join(exe_path, exe), basename=basename, tplfile=tplfile, mzxml=info[Keys.MZXML])
        return info, command
Example #7
0
    def prepare_run(self, log, info):
        wd = info[Keys.WORKDIR]

        #add in blast and mzxml2mgf conversion
        omssadbase = os.path.join(wd, os.path.basename(info['DBASE']))
        os.symlink(info['DBASE'], omssadbase)
        mzxmlbase = os.path.basename(info[Keys.MZXML])
        mzxmllink = os.path.join(wd, mzxmlbase)
        mgffile = os.path.join(wd, os.path.splitext(mzxmlbase)[0] + '.mgf')
        os.symlink(info[Keys.MZXML], mzxmllink)

        basename = os.path.splitext(os.path.split(info[Keys.MZXML])[1])[0]
        result = os.path.join(wd, basename + '.pep.xml')
        iresult = os.path.join(wd, basename + '.withRT.pep.xml')
        info[Keys.PEPXML] = iresult

        # need to create a working copy to prevent replacement or generic definitions
        # with app specific definitions
        app_info = info.copy()
        app_info['DBASE'] = omssadbase

        if info['FRAGMASSUNIT'] == 'ppm':
            raise RuntimeError(
                "OMSSA does not support frag mass error unit PPM")

        app_info['USERMODXML'] = os.path.join(wd, 'usermod.xml')
        app_info["STATIC_MODS"], app_info[
            "VARIABLE_MODS"], tpl = genmodstr_to_engine(
                info["STATIC_MODS"], info["VARIABLE_MODS"], 'Omssa')
        if app_info['STATIC_MODS']:
            app_info['STATIC_MODS'] = "-mf " + app_info['STATIC_MODS']
        if app_info['VARIABLE_MODS']:
            app_info['VARIABLE_MODS'] = "-mv " + app_info['VARIABLE_MODS']

        open(app_info['USERMODXML'], 'w').write(tpl)
        app_info['ENZYME'], _ = enzymestr_to_engine(info['ENZYME'], 'Omssa')
        mod_template = templates.modify_template(
            app_info,
            templates.read_template(templates.get_tpl_of_class(self)))
        # necessary check for the precursor mass unig
        if app_info['PRECMASSUNIT'].lower() == "ppm":
            mod_template += ' -teppm'
            log.debug(
                'added [ -teppm] to modified template because the precursor mass is defined in ppm'
            )

        exe = app_info.get(Keys.EXECUTABLE, 'omssacl')

        #grep to prevent log overflow, InteractParser to add RT to pepXML
        #note: mod_template paths are quoted in the template file
        command = 'makeblastdb -dbtype prot -in "%s" && ' \
                  'MzXML2Search -mgf "%s" | grep -v scan && ' \
                  '"%s" %s -fm "%s" -op "%s" && ' \
                  'InteractParser "%s" "%s" -S' % (
                      omssadbase,
                      mzxmllink,
                      exe, mod_template, mgffile, result,
                      iresult, result)
        return info, command
Example #8
0
    def run(self, log, info):
        info = create_workdir(log, info)

        info['TEMPLATEFILE'] = os.path.join(info[Keys.WORKDIR], "template_out.tpl")
        templates.read_mod_write(info, templates.get_tpl_of_class(self), info['TEMPLATEFILE'])
        log.debug("Templatefile sucessfully written. Contents are [%s]" % open(info['TEMPLATEFILE']).read())

        return info
Example #9
0
    def prepare_run(self, log, info):
        wd = info[Keys.WORKDIR]
        basename = os.path.join(
            wd,
            os.path.splitext(os.path.split(info[Keys.MZXML])[1])[0])
        info[Keys.PEPXML] = basename + '.pep.xml'

        # need to create a working copy to prevent replacement or generic definitions
        # with app specific definitions
        app_info = info.copy()

        if info['PRECMASSUNIT'] == 'Da':
            app_info['PRECMASSUNIT'] = '0'
        elif info['PRECMASSUNIT'] == 'ppm':
            app_info['PRECMASSUNIT'] = '2'
        else:
            raise RuntimeError("Precmassunit %s unknown" %
                               info['PRECMASSUNIT'])

        if info['FRAGMASSUNIT'] == 'ppm':
            raise RuntimeError(
                "Comet does not support frag mass error unit PPM")

        # Note: FRAGMASSERR does not apply to Comet; instead use pre-defined
        #       FRAGBINTOL and FRAGBINOFF values
        frag_bin_tol, frag_bin_off, frag_ions_theor = self.get_fragment_ions_values(
            info.get('COMET_FRAGMENT_IONS', None))
        app_info.update({
            'FRAGBINTOL': frag_bin_tol,
            'FRAGBINOFF': frag_bin_off,
            'FRAGIONSTHEOR': frag_ions_theor,
        })

        app_info["STATIC_MODS"], app_info[
            "VARIABLE_MODS"], _ = genmodstr_to_engine(info["STATIC_MODS"],
                                                      info["VARIABLE_MODS"],
                                                      'Comet')
        app_info['ENZYME'], app_info[
            'NUM_TERM_CLEAVAGES'] = enzymestr_to_engine(
                info['ENZYME'], 'Comet')

        tplfile = os.path.join(wd, "comet.params")
        template = get_tpl_of_class(self)
        read_mod_write(app_info, template, tplfile)

        exe_path = app_info['COMET_DIR']
        exe = app_info['COMET_EXE']

        command = "{exe} -N{basename} -P{tplfile} {mzxml}".format(
            exe=os.path.join(exe_path, exe),
            basename=basename,
            tplfile=tplfile,
            mzxml=info[Keys.MZXML])
        return info, command
Example #10
0
    def run(self, log, info):
        info = create_workdir(log, info)

        info['TEMPLATEFILE'] = os.path.join(info[Keys.WORKDIR],
                                            "template_out.tpl")
        templates.read_mod_write(info, templates.get_tpl_of_class(self),
                                 info['TEMPLATEFILE'])
        log.debug("Templatefile sucessfully written. Contents are [%s]" %
                  open(info['TEMPLATEFILE']).read())

        return info
Example #11
0
    def prepare_run(self, log, info):
        wd = info[Keys.WORKDIR]

        #add in blast and mzxml2mgf conversion
        omssadbase = os.path.join(wd, os.path.basename(info['DBASE']))
        os.symlink(info['DBASE'], omssadbase)
        mzxmlbase = os.path.basename(info[Keys.MZXML])
        mzxmllink = os.path.join(wd, mzxmlbase)
        mgffile = os.path.join(wd, os.path.splitext(mzxmlbase)[0] + '.mgf')
        os.symlink(info[Keys.MZXML], mzxmllink)

        basename = os.path.splitext(os.path.split(info[Keys.MZXML])[1])[0]
        result = os.path.join(wd, basename+'.pep.xml')
        iresult = os.path.join(wd, basename+'.withRT.pep.xml')
        info[Keys.PEPXML] = iresult

        # need to create a working copy to prevent replacement or generic definitions
        # with app specific definitions
        app_info = info.copy()
        app_info['DBASE'] = omssadbase

        if info['FRAGMASSUNIT'] == 'ppm':
            raise RuntimeError("OMSSA does not support frag mass error unit PPM")

        app_info['USERMODXML'] = os.path.join(wd, 'usermod.xml')
        app_info["STATIC_MODS"], app_info["VARIABLE_MODS"], tpl = genmodstr_to_engine(info["STATIC_MODS"],
                                                                                   info["VARIABLE_MODS"], 'Omssa')
        if app_info['STATIC_MODS']:
            app_info['STATIC_MODS'] = "-mf " + app_info['STATIC_MODS']
        if app_info['VARIABLE_MODS']:
            app_info['VARIABLE_MODS'] = "-mv " + app_info['VARIABLE_MODS']

        open(app_info['USERMODXML'], 'w').write(tpl)
        app_info['ENZYME'], _ = enzymestr_to_engine(info['ENZYME'], 'Omssa')
        mod_template = templates.modify_template(app_info, templates.read_template(templates.get_tpl_of_class(self)))
        # necessary check for the precursor mass unig
        if app_info['PRECMASSUNIT'].lower() == "ppm":
            mod_template += ' -teppm'
            log.debug('added [ -teppm] to modified template because the precursor mass is defined in ppm')

        exe = app_info.get(Keys.EXECUTABLE, 'omssacl')

        #grep to prevent log overflow, InteractParser to add RT to pepXML
        #note: mod_template paths are quoted in the template file
        command = 'makeblastdb -dbtype prot -in "%s" && ' \
                  'MzXML2Search -mgf "%s" | grep -v scan && ' \
                  '"%s" %s -fm "%s" -op "%s" && ' \
                  'InteractParser "%s" "%s" -S' % (
                      omssadbase,
                      mzxmllink,
                      exe, mod_template, mgffile, result,
                      iresult, result)
        return info, command
Example #12
0
    def prepare_run(self, log, info):
        for f in info['DSSOUT']:
            if "dataset.properties" in f:
                dsprop = ConfigObj(f)

        info["SEQ"] = dsprop["SEQ"]
        info["IN__FILE__ALIGNMENT"] = os.path.join(info["ROSETTA_EXTRACTDIR"], dsprop["ALIGNMENT_FILE"])
        info["IN__FILE__FASTA"] = os.path.join(info["ROSETTA_EXTRACTDIR"], dsprop["FILE_STEM"] + ".fasta")
        info["FRAG3"] = os.path.join(info["ROSETTA_EXTRACTDIR"], dsprop["3MERS"])
        info["FRAG9"] = os.path.join(info["ROSETTA_EXTRACTDIR"], dsprop["9MERS"])
        info["LOOPS__FRAG_SIZES"] = "9 3 1"
        info["LOOPS__FRAG_FILES"] = info["FRAG9"] + " " + info["FRAG3"] + " none"
        info["IN__FILE__PSIPRED_SS2"] = os.path.join(info["ROSETTA_EXTRACTDIR"], dsprop["FILE_STEM"] + ".psipred_ss2")
        info['ROSETTA_OUT'] = os.path.join(info[Keys.WORKDIR], 'default.out')
        #needed because of rosetta && gzip
        info['ROSETTA_COMPRESSEDOUT'] = info['ROSETTA_OUT'] + '.gz'

        info["IN__FILE__TEMPLATE_PDB"] = ""
        for pdb in dsprop["TEMPLATES"].split():
            info["IN__FILE__TEMPLATE_PDB"] += os.path.join(info["ROSETTA_EXTRACTDIR"], pdb) + " "
        info["IN__FILE__TEMPLATE_PDB"] = info["IN__FILE__TEMPLATE_PDB"].strip()

        info["DATABASE"] = os.environ["ROSETTA3_DB"]
        info["ROSETTA_VERSION"] = subprocess.check_output("which %s | cut -d/ -f5" % info[Keys.EXECUTABLE],
                                                          shell=True).strip()
        info["INFRASTRUCTURE"] = "BRUTUS"

        #change the on/off flags only in the template, not the info  
        app_info = info.copy()
        app_info['RUN__SHUFFLE'] = "-run:shuffle" if info['RUN__SHUFFLE'] == "TRUE" else ""
        app_info['IN__FILE__FULLATOM'] = "-in:file:fullatom" if info['IN__FILE__FULLATOM'] == "TRUE" else ""
        app_info['IDEALIZE_AFTER_LOOP_CLOSE'] = "-idealize_after_loop_close" if info[
                                                                                    'IDEALIZE_AFTER_LOOP_CLOSE'] == "TRUE" else ""
        app_info['LOOPS__EXTENDED'] = "-loops:extended" if info['LOOPS__EXTENDED'] == "TRUE" else ""
        app_info['LOOPS__BUILD_INITIAL'] = "-loops:build_initial" if info['LOOPS__BUILD_INITIAL'] == "TRUE" else ""
        app_info['RELAX__FAST'] = "-relax:fast" if info['RELAX__FAST'] == "TRUE" else ""
        app_info['SILENT_DECOYTIME'] = "-silent_decoytime" if info['SILENT_DECOYTIME'] == "TRUE" else ""
        app_info['BGDT'] = "-bGDT" if info['BGDT'] == "TRUE" else ""
        app_info['EVALUATION__GDTMM'] = "-evaluation:gdtmm" if info['EVALUATION__GDTMM'] == "TRUE" else ""

        tpl = os.path.join(info[Keys.WORKDIR], "flags")
        templates.read_mod_write(app_info, templates.get_tpl_of_class(self), tpl)

        command = "%s @%s && gzip %s" % (app_info[Keys.EXECUTABLE], tpl, app_info['ROSETTA_OUT'])
        return info, command
Example #13
0
    def prepare_run(self, log, info):
        wd = info[Keys.WORKDIR]
        basename = os.path.join(wd, os.path.splitext(os.path.split(info[Keys.MZXML])[1])[0])
        info[Keys.PEPXML] = basename + '.pep.xml'

        # need to create a working copy to prevent replacement or generic definitions
        # with app specific definitions
        app_info = info.copy()

        if info['PRECMASSUNIT'] == 'Da':
            app_info['PRECMASSUNIT'] = '0'
        elif info['PRECMASSUNIT'] == 'ppm':
            app_info['PRECMASSUNIT'] = '2'
        else:
            raise RuntimeError("Precmassunit %s unknown" % info['PRECMASSUNIT'])

        if info['FRAGMASSUNIT'] == 'ppm':
            raise RuntimeError("Comet does not support frag mass error unit PPM")

        # Note: FRAGMASSERR does not apply to Comet; instead use pre-defined
        #       FRAGBINTOL and FRAGBINOFF values
        frag_bin_tol, frag_bin_off, frag_ions_theor = self.get_fragment_ions_values(
            info.get('COMET_FRAGMENT_IONS', None))
        app_info.update({
            'FRAGBINTOL': frag_bin_tol,
            'FRAGBINOFF': frag_bin_off,
            'FRAGIONSTHEOR': frag_ions_theor,
        })

        app_info["STATIC_MODS"], app_info["VARIABLE_MODS"], _ = genmodstr_to_engine(info["STATIC_MODS"],
                                                                                 info["VARIABLE_MODS"], 'Comet')
        app_info['ENZYME'], app_info['NUM_TERM_CLEAVAGES'] = enzymestr_to_engine(info['ENZYME'], 'Comet')

        tplfile = os.path.join(wd, "comet.params")
        template = get_tpl_of_class(self)
        read_mod_write(app_info,template, tplfile)

        exe_path = app_info['COMET_DIR']
        exe = app_info['COMET_EXE']

        command = "{exe} -N{basename} -P{tplfile} {mzxml}".format(exe=os.path.join(exe_path, exe), basename=basename, tplfile=tplfile, mzxml=info[Keys.MZXML])
        return info, command
    def prepare_run(self, log, info):
        wd = info[Keys.WORKDIR]

        #required because openbis requires prot.xml and openms protXML
        protlink = os.path.join(wd, 'protein.protXML')
        os.symlink(info['PROTXML'], protlink)
        info['PROTXML'] = protlink

        #copy info to not destroy original
        app_info = info.copy()
        app_info['FEATUREXMLLIST'] = ''

        if not isinstance(app_info['FEATUREXML'], list):
            raise RuntimeError(
                "Cannot perform LFQ with only one featurexml/sample!")

        for i in app_info['FEATUREXML']:
            app_info['FEATUREXMLLIST'] += '<LISTITEM value="' + i + '"/>'

        tpl = os.path.join(wd, 'part2_ma_fl.toppas')
        templates.read_mod_write(app_info, templates.get_tpl_of_class(self),
                                 tpl)
        #add toppas file path, will be added in dropbox
        info["TOPPASFILES"].append(tpl)

        rawprot = os.path.join(wd, 'TOPPAS_out/009-ProteinQuantifier/*.csv')
        rawpep = os.path.join(wd, 'TOPPAS_out/010-ProteinQuantifier/*.csv')
        rawconsensusxml = os.path.join(
            wd, 'TOPPAS_out/011-FeatureLinker*/*.consensusXML')
        info['PROTCSV'] = os.path.join(wd, 'proteins.csv')
        info['PEPCSV'] = os.path.join(wd, 'peptides.csv')
        info['CONSENSUSXML'] = os.path.join(wd, 'FeatureLinker.consensusXML')

        command = 'ExecutePipeline -in %s -out_dir %s && chmod -R g+w %s && ' \
                  'mv -v %s %s && ' \
                  'mv -v %s %s && ' \
                  'mv -v %s %s' % (
                      tpl, wd, wd,
                      rawprot, info['PROTCSV'],
                      rawpep, info['PEPCSV'],
                      rawconsensusxml, info['CONSENSUSXML'])
        return info, command
Example #15
0
    def _writemail(self, info):
        info['USERNAME'] = getpass.getuser()

        if info.get('RUNTPP2VIEWER', 'no') == 'no':
            info[
                "LINKTEXT"] = "RUNTPP2VIEWER was 'no'. If you want to visualize the results"
        else:
            # basepath = '/IMSB/ra/' + info['USERNAME'] + '/html/petunia/tpp2viewer3_' + info['EXPERIMENT_CODE']
            basepath = '/nfs/195.176.109.15/nas/fs2102/biol_ibt_usr_s1/' + info[
                'USERNAME'] + '/html/petunia/tpp2viewer3_' + info[
                    'EXPERIMENT_CODE']
            info["LINKTEXT"] = """To visualize the results use:
https://imsb-ra-tpp.ethz.ch/tpp/cgi-bin/PepXMLViewer.cgi?xmlFileName=%s
https://imsb-ra-tpp.ethz.ch/tpp/cgi-bin/protxml2html.pl?xmlfile=%s

In case the links do not work""" % (basepath + '.pep.xml',
                                    basepath + '.prot.xml')

        info['ENGINES_VERSIONS'] = ''
        if 'RUNTANDEM' in info and info['RUNTANDEM'] == 'True':
            info['ENGINES_VERSIONS'] += subprocess.check_output(
                "tandem a | grep TANDEM", shell=True)

        if 'RUNOMSSA' in info and info['RUNOMSSA'] == 'True':
            info['ENGINES_VERSIONS'] += subprocess.check_output(
                "omssacl -version", shell=True).replace("2.1.8", "2.1.9")

        if 'RUNMYRIMATCH' in info and info['RUNMYRIMATCH'] == 'True':
            info['ENGINES_VERSIONS'] += subprocess.check_output(
                "myrimatch 2>&1 | grep MyriMatch", shell=True)

        if 'RUNCOMET' in info and info['RUNCOMET'] == 'True':
            info['ENGINES_VERSIONS'] += subprocess.check_output(
                "comet 2>&1 | grep version", shell=True)
        info['ENGINES_VERSIONS'] = info['ENGINES_VERSIONS'].strip()

        info['TPPVERSION'] = subprocess.check_output(
            "InteractParser 2>&1 | grep TPP", shell=True).split("(")[1]

        templates.read_mod_write(info, templates.get_tpl_of_class(self),
                                 info['MAILFILE'])
Example #16
0
    def prepare_run(self, log, info):
        wd = info[Keys.WORKDIR]

        #required because openbis requires prot.xml and openms protXML
        protlink = os.path.join(wd, 'protein.protXML')
        os.symlink(info['PROTXML'], protlink)
        info['PROTXML'] = protlink

        #copy info to not destroy original
        app_info = info.copy()
        app_info['FEATUREXMLLIST'] = ''

        if not isinstance(app_info['FEATUREXML'],list):
            raise RuntimeError("Cannot perform LFQ with only one featurexml/sample!")

        for i in app_info['FEATUREXML']:
            app_info['FEATUREXMLLIST'] += '<LISTITEM value="' + i + '"/>'

        tpl = os.path.join(wd, 'part2_ma_fl.toppas')
        templates.read_mod_write(app_info, templates.get_tpl_of_class(self), tpl)
        #add toppas file path, will be added in dropbox
        info["TOPPASFILES"].append(tpl)

        rawprot = os.path.join(wd, 'TOPPAS_out/009-ProteinQuantifier/*.csv')
        rawpep = os.path.join(wd, 'TOPPAS_out/010-ProteinQuantifier/*.csv')
        rawconsensusxml = os.path.join(wd, 'TOPPAS_out/011-FeatureLinker*/*.consensusXML')
        info['PROTCSV'] = os.path.join(wd, 'proteins.csv')
        info['PEPCSV'] = os.path.join(wd, 'peptides.csv')
        info['CONSENSUSXML'] = os.path.join(wd, 'FeatureLinker.consensusXML')

        command = 'ExecutePipeline -in %s -out_dir %s && chmod -R g+w %s && ' \
                  'mv -v %s %s && ' \
                  'mv -v %s %s && ' \
                  'mv -v %s %s' % (
                      tpl, wd, wd,
                      rawprot, info['PROTCSV'],
                      rawpep, info['PEPCSV'],
                      rawconsensusxml, info['CONSENSUSXML'])
        return info, command
Example #17
0
    def prepare_run(self, log, info):
        for f in info['DSSOUT']:
            if "dataset.properties" in f:
                dsprop = ConfigObj(f)

        info["SEQ"] = dsprop["SEQ"]
        info["IN__FILE__ALIGNMENT"] = os.path.join(info["ROSETTA_EXTRACTDIR"],
                                                   dsprop["ALIGNMENT_FILE"])
        info["IN__FILE__FASTA"] = os.path.join(info["ROSETTA_EXTRACTDIR"],
                                               dsprop["FILE_STEM"] + ".fasta")
        info["FRAG3"] = os.path.join(info["ROSETTA_EXTRACTDIR"],
                                     dsprop["3MERS"])
        info["FRAG9"] = os.path.join(info["ROSETTA_EXTRACTDIR"],
                                     dsprop["9MERS"])
        info["LOOPS__FRAG_SIZES"] = "9 3 1"
        info["LOOPS__FRAG_FILES"] = info["FRAG9"] + " " + info[
            "FRAG3"] + " none"
        info["IN__FILE__PSIPRED_SS2"] = os.path.join(
            info["ROSETTA_EXTRACTDIR"], dsprop["FILE_STEM"] + ".psipred_ss2")
        info['ROSETTA_OUT'] = os.path.join(info[Keys.WORKDIR], 'default.out')
        #needed because of rosetta && gzip
        info['ROSETTA_COMPRESSEDOUT'] = info['ROSETTA_OUT'] + '.gz'

        info["IN__FILE__TEMPLATE_PDB"] = ""
        for pdb in dsprop["TEMPLATES"].split():
            info["IN__FILE__TEMPLATE_PDB"] += os.path.join(
                info["ROSETTA_EXTRACTDIR"], pdb) + " "
        info["IN__FILE__TEMPLATE_PDB"] = info["IN__FILE__TEMPLATE_PDB"].strip()

        info["DATABASE"] = os.environ["ROSETTA3_DB"]
        info["ROSETTA_VERSION"] = subprocess.check_output(
            "which %s | cut -d/ -f5" % info[Keys.EXECUTABLE],
            shell=True).strip()
        info["INFRASTRUCTURE"] = "BRUTUS"

        #change the on/off flags only in the template, not the info
        app_info = info.copy()
        app_info['RUN__SHUFFLE'] = "-run:shuffle" if info[
            'RUN__SHUFFLE'] == "TRUE" else ""
        app_info['IN__FILE__FULLATOM'] = "-in:file:fullatom" if info[
            'IN__FILE__FULLATOM'] == "TRUE" else ""
        app_info[
            'IDEALIZE_AFTER_LOOP_CLOSE'] = "-idealize_after_loop_close" if info[
                'IDEALIZE_AFTER_LOOP_CLOSE'] == "TRUE" else ""
        app_info['LOOPS__EXTENDED'] = "-loops:extended" if info[
            'LOOPS__EXTENDED'] == "TRUE" else ""
        app_info['LOOPS__BUILD_INITIAL'] = "-loops:build_initial" if info[
            'LOOPS__BUILD_INITIAL'] == "TRUE" else ""
        app_info['RELAX__FAST'] = "-relax:fast" if info[
            'RELAX__FAST'] == "TRUE" else ""
        app_info['SILENT_DECOYTIME'] = "-silent_decoytime" if info[
            'SILENT_DECOYTIME'] == "TRUE" else ""
        app_info['BGDT'] = "-bGDT" if info['BGDT'] == "TRUE" else ""
        app_info['EVALUATION__GDTMM'] = "-evaluation:gdtmm" if info[
            'EVALUATION__GDTMM'] == "TRUE" else ""

        tpl = os.path.join(info[Keys.WORKDIR], "flags")
        templates.read_mod_write(app_info, templates.get_tpl_of_class(self),
                                 tpl)

        command = "%s @%s && gzip %s" % (app_info[Keys.EXECUTABLE], tpl,
                                         app_info['ROSETTA_OUT'])
        return info, command