Example #1
0
    def run(self, log, info):
        info['WORKFLOW'] = dropbox.extendWorkflowID(info['WORKFLOW'])
        stagebox = dropbox.make_stagebox(log, info)

        dropbox.keys_to_dropbox(log, info, ['ROSETTA_COMPRESSEDOUT'], stagebox)

        dsattr = {}
        dsattr['SPACE'] = info['SPACE']
        dsattr['PROJECT'] = info['PROJECT']
        dsattr['EXPERIMENT'] = info['OUTEXPERIMENT']
        dsattr['DATASET_TYPE'] = 'ROSETTA_OUTFILE'

        path = os.path.join(stagebox, 'dataset.attributes')
        IniInfoHandler().write(dsattr, path)

        dsprop = {}
        for key in ['SEQ', 'COMMENT', 'ROSETTA_VERSION', 'RUN__PROTOCOL', 'RUN__SHUFFLE', 'INFRASTRUCTURE', 'N_MODELS',
                    'DATABASE', 'IN__FILE__ALIGNMENT', 'CM__ALN_FORMAT', 'FRAG3', 'FRAG9', 'IN__FILE__FASTA',
                    'IN__FILE__FULLATOM',
                    'IN__FILE__PSIPRED_SS2', 'IN__DETECT_DISULF', 'IN__FILE__TEMPLATE_PDB', 'LOOPS__FRAG_SIZES',
                    'LOOPS__FRAG_FILES',
                    'IDEALIZE_AFTER_LOOP_CLOSE', 'LOOPS__EXTENDED', 'LOOPS__BUILD_INITIAL', 'LOOPS__REMODEL',
                    'LOOPS__RELAX',
                    'RANDOM_GROW_LOOPS_BY', 'SELECT_BEST_LOOP_FROM', 'RELAX__FAST', 'RELAX__DEFAULT_REPEATS',
                    'SILENT_DECOYTIME',
                    'FAIL_ON_BAD_HBOND', 'BGDT', 'EVALUATION__GDTMM', 'OUT__FILE__SILENT_STRUCT_TYPE']:
            dsprop[key] = info[key]

        path = os.path.join(stagebox, 'dataset.properties')
        IniInfoHandler().write(dsprop, path)

        dropbox.move_stage_to_dropbox(log, stagebox, info['DROPBOX'], keepCopy=False)

        return info
Example #2
0
    def run(self, log, info):
        info["WORKFLOW"] = dropbox.extendWorkflowID(info.get("WORKFLOW", "wff"))
        stagebox = dropbox.make_stagebox(log, info)

        dropbox.keys_to_dropbox(log, info, ["DUMP_MZXML"], stagebox)

        dsattr = {}
        dsattr["DATASET_TYPE"] = "PLAIN"

        path = os.path.join(stagebox, "dataset.attributes")
        IniInfoHandler().write(dsattr, path)

        dropbox.move_stage_to_dropbox(log, stagebox, info["DROPBOX"], keepCopy=False)

        return info
Example #3
0
    def run(self, log, info):
        info['WORKFLOW'] = dropbox.extendWorkflowID(info['WORKFLOW'])
        info['DROPBOXSTAGE'] = dropbox.make_stagebox(log, info)

        #copy files
        keys = ['PEPCSV', 'PROTCSV', 'CONSENSUSXML']
        dropbox.keys_to_dropbox(log, info, keys, info['DROPBOXSTAGE'])

        #compress TOPPAS files
        archive = os.path.join(info['DROPBOXSTAGE'], 'toppasfiles.zip')
        subprocess.check_call('zip -v ' + archive + '  ' +
                              " ".join(info['TOPPASFILES']),
                              shell=True)

        #compress XML files
        archive = os.path.join(info['DROPBOXSTAGE'], 'featurexmls.zip')
        subprocess.check_call('zip -jv ' + archive + '  ' +
                              " ".join(info['FEATUREXML']),
                              shell=True)

        #protxml special naming
        filename = os.path.basename(info['DROPBOXSTAGE']) + '.prot.xml'
        filepath = os.path.join(info['DROPBOXSTAGE'], filename)
        shutil.copy(info['PROTXML'], filepath)

        #properties file
        expinfo = info.copy()
        expinfo['PARENT-DATA-SET-CODES'] = info[Keys.DATASET_CODE]
        expinfo['BASE_EXPERIMENT'] = info['EXPERIMENT']
        expinfo['QUANTIFICATION_TYPE'] = 'LABEL-FREE'
        expinfo['PEAKPICKER'] = 'YES'
        expinfo['MAPALIGNER'] = 'YES'

        proppath = os.path.join(info['DROPBOXSTAGE'],
                                'quantification.properties')
        IniInfoHandler().write(expinfo, proppath)

        #create witolds LFQ report mail
        reportcmd = 'mailLFQ.sh %s %s %s %s 2>&1' % (
            proppath, expinfo['PEPCSV'], expinfo['PROTCSV'], getpass.getuser())
        subprocess.check_call(reportcmd, shell=True)
        if os.path.exists("analyseLFQ.pdf"):
            shutil.copy('analyseLFQ.pdf', info['DROPBOXSTAGE'])

        dropbox.move_stage_to_dropbox(log, info['DROPBOXSTAGE'],
                                      info['DROPBOX'])

        return info
Example #4
0
    def run(self, log, info):
        info['WORKFLOW'] = dropbox.extendWorkflowID(info['WORKFLOW'])
        info['DROPBOXSTAGE'] = stagebox = dropbox.make_stagebox(log, info)

        info['PEPIDX'] = info['SPLIB'].replace(".splib", ".pepidx")
        dropbox.keys_to_dropbox(log, info, ['SPLIB', 'PEPIDX', 'TSV', 'TRAML'],
                                stagebox)

        dsattr = {}
        dsattr['SPACE'] = 'PERSONAL_DB'
        dsattr['PROJECT'] = 'TRAML'
        dsattr['EXPERIMENT'] = getpass.getuser().upper()
        dsattr['EXPERIMENT_TYPE'] = "PLAIN"
        dsattr['DATASET_TYPE'] = 'TRAML_DB'
        dsattr['PARENT_DATASETS'] = os.path.basename(
            os.path.dirname(info[Keys.PEPXML]))

        path = os.path.join(stagebox, 'dataset.attributes')
        IniInfoHandler().write(dsattr, path)

        dsprop = {}
        dsprop['VERSION'] = time.strftime("%Y%m%d%H%M%S")
        dsprop['NAME'] = info.get('COMMENT', "unnamed")
        dsprop['DESCRIPTION'] = info.get('DESCRIPTION', "undescribed")
        dsprop['WORKFLOW'] = info['WORKFLOW']
        dsprop['HASSPLIB'] = "true"

        for key in [
                "FDR", "MS_TYPE", "RUNRT", "RTKIT", "TSV_MASS_LIMITS",
                "TSV_ION_LIMITS", "TSV_PRECISION", "TSV_CHARGE",
                "TSV_REMOVE_DUPLICATES", "TSV_EXACT", "TSV_GAIN", "TSV_SERIES",
                "CONSENSUS_TYPE"
        ]:
            dsprop[key] = info[key]

        #cannot use IniInfoHandlerHere because it writes NAME
        config = ConfigObj(dsprop)
        config.filename = os.path.join(stagebox, 'dataset.properties')
        config.write()

        dropbox.move_stage_to_dropbox(log,
                                      stagebox,
                                      info['DROPBOX'],
                                      keepCopy=False)

        return info
Example #5
0
    def run(self, log, info):
        info['WORKFLOW'] = dropbox.extendWorkflowID(info.get(
            'WORKFLOW', "wff"))
        stagebox = dropbox.make_stagebox(log, info)

        dropbox.keys_to_dropbox(log, info, ['DUMP_MZXML'], stagebox)

        dsattr = {}
        dsattr['DATASET_TYPE'] = 'PLAIN'

        path = os.path.join(stagebox, 'dataset.attributes')
        IniInfoHandler().write(dsattr, path)

        dropbox.move_stage_to_dropbox(log,
                                      stagebox,
                                      info['DROPBOX'],
                                      keepCopy=False)

        return info
Example #6
0
    def run(self, log, info):
        info['WORKFLOW'] = dropbox.extendWorkflowID(info['WORKFLOW'])
        info['DROPBOXSTAGE'] = dropbox.make_stagebox(log, info)

        #copy files
        keys = ['PEPCSV', 'PROTCSV', 'CONSENSUSXML']
        dropbox.keys_to_dropbox(log, info, keys, info['DROPBOXSTAGE'])

        #compress TOPPAS files
        archive = os.path.join(info['DROPBOXSTAGE'], 'toppasfiles.zip')
        subprocess.check_call('zip -v ' + archive + '  ' + " ".join(info['TOPPASFILES']), shell=True)

        #compress XML files        
        archive = os.path.join(info['DROPBOXSTAGE'], 'featurexmls.zip')
        subprocess.check_call('zip -jv ' + archive + '  ' + " ".join(info['FEATUREXML']), shell=True)

        #protxml special naming
        filename = os.path.basename(info['DROPBOXSTAGE']) + '.prot.xml'
        filepath = os.path.join(info['DROPBOXSTAGE'], filename)
        shutil.copy(info['PROTXML'], filepath)

        #properties file
        expinfo = info.copy()
        expinfo['PARENT-DATA-SET-CODES'] = info[Keys.DATASET_CODE]
        expinfo['BASE_EXPERIMENT'] = info['EXPERIMENT']
        expinfo['QUANTIFICATION_TYPE'] = 'LABEL-FREE'
        expinfo['PEAKPICKER'] = 'YES'
        expinfo['MAPALIGNER'] = 'YES'

        proppath = os.path.join(info['DROPBOXSTAGE'], 'quantification.properties')
        IniInfoHandler().write(expinfo, proppath)

        #create witolds LFQ report mail
        reportcmd = 'mailLFQ.sh %s %s %s %s 2>&1' % (proppath, expinfo['PEPCSV'], expinfo['PROTCSV'], getpass.getuser())
        try:
            subprocess.call(reportcmd, shell=True)
            shutil.copy('analyseLFQ.pdf', info['DROPBOXSTAGE'])
        except:
            log.warn("LFQ report command [%s] failed, skipping" % reportcmd)

        dropbox.move_stage_to_dropbox(log, info['DROPBOXSTAGE'], info['DROPBOX'])

        return info
Example #7
0
    def run(self, log, info):
        info['WORKFLOW'] = dropbox.extendWorkflowID(info['WORKFLOW'])
        stagebox = dropbox.make_stagebox(log, info)

        dropbox.keys_to_dropbox(log, info, ['ROSETTA_COMPRESSEDOUT'], stagebox)

        dsattr = {}
        dsattr['SPACE'] = info['SPACE']
        dsattr['PROJECT'] = info['PROJECT']
        dsattr['EXPERIMENT'] = info['OUTEXPERIMENT']
        dsattr['DATASET_TYPE'] = 'ROSETTA_OUTFILE'

        path = os.path.join(stagebox, 'dataset.attributes')
        IniInfoHandler().write(dsattr, path)

        dsprop = {}
        for key in [
                'SEQ', 'COMMENT', 'ROSETTA_VERSION', 'RUN__PROTOCOL',
                'RUN__SHUFFLE', 'INFRASTRUCTURE', 'N_MODELS', 'DATABASE',
                'IN__FILE__ALIGNMENT', 'CM__ALN_FORMAT', 'FRAG3', 'FRAG9',
                'IN__FILE__FASTA', 'IN__FILE__FULLATOM',
                'IN__FILE__PSIPRED_SS2', 'IN__DETECT_DISULF',
                'IN__FILE__TEMPLATE_PDB', 'LOOPS__FRAG_SIZES',
                'LOOPS__FRAG_FILES', 'IDEALIZE_AFTER_LOOP_CLOSE',
                'LOOPS__EXTENDED', 'LOOPS__BUILD_INITIAL', 'LOOPS__REMODEL',
                'LOOPS__RELAX', 'RANDOM_GROW_LOOPS_BY',
                'SELECT_BEST_LOOP_FROM', 'RELAX__FAST',
                'RELAX__DEFAULT_REPEATS', 'SILENT_DECOYTIME',
                'FAIL_ON_BAD_HBOND', 'BGDT', 'EVALUATION__GDTMM',
                'OUT__FILE__SILENT_STRUCT_TYPE'
        ]:
            dsprop[key] = info[key]

        path = os.path.join(stagebox, 'dataset.properties')
        IniInfoHandler().write(dsprop, path)

        dropbox.move_stage_to_dropbox(log,
                                      stagebox,
                                      info['DROPBOX'],
                                      keepCopy=False)

        return info
Example #8
0
    def run(self, log, info):
        info['WORKFLOW'] = dropbox.extendWorkflowID(info['WORKFLOW'])
        stagebox = dropbox.make_stagebox(log, info)

        dropbox.keys_to_dropbox(log, info, ['APMS_OUT'], stagebox)

        dsattr = {}
        dsattr['DATASET_TYPE'] = 'APMS_RESULT'
        dsattr['SPACE'] = info['SPACE']
        dsattr['PROJECT'] = info['PROJECT']
        dsattr['EXPERIMENT'] = info['OUTEXPERIMENT']

        for key in ["COMMENT"]:
            dsattr[key] = info[key]

        path = os.path.join(stagebox, 'dataset.attributes')
        IniInfoHandler().write(dsattr, path)

        dropbox.move_stage_to_dropbox(log, stagebox, info['DROPBOX'], keepCopy=False)

        return info
Example #9
0
    def run(self, log, info):
        info['WORKFLOW'] = dropbox.extendWorkflowID(info['WORKFLOW'])
        info['DROPBOXSTAGE'] = dropbox.make_stagebox(log, info)

        keys = [Keys.PEPXML, 'PEPCSV']
        dropbox.keys_to_dropbox(log, info, keys, info['DROPBOXSTAGE'])

        #protxml special naming
        filename = os.path.basename(info['DROPBOXSTAGE']) + '.prot.xml'
        filepath = os.path.join(info['DROPBOXSTAGE'], filename)
        shutil.copy(info['PROTXML'], filepath)

        #search.properties requires some specific fields
        info['DBASENAME'] = os.path.splitext(os.path.split(info['DBASE'])[1])[0]
        info['PARENT-DATA-SET-CODES'] = info[Keys.DATASET_CODE]

        path = os.path.join(info['DROPBOXSTAGE'], 'search.properties')
        IniInfoHandler().write(info, path)

        info['DROPBOXSTAGE'] = dropbox.move_stage_to_dropbox(log, info['DROPBOXSTAGE'], info['DROPBOX'], keepCopy=True)

        return info
Example #10
0
    def run(self, log, info):

        info['WORKFLOW'] = dropbox.extendWorkflowID(info['WORKFLOW'])
        info['DROPBOXSTAGE'] = dropbox.make_stagebox(log, info)
        info['EXPERIMENT_CODE'] = dropbox.get_experiment_code(info)

        keys = [Keys.PEPXML, 'PEPCSV', 'MAYUOUT']
        dropbox.keys_to_dropbox(log, info, keys, info['DROPBOXSTAGE'])

        # protxml special naming
        filename = os.path.basename(info['DROPBOXSTAGE']) + '.prot.xml'
        filepath = os.path.join(info['DROPBOXSTAGE'], filename)
        shutil.copy(info['PROTXML'], filepath)

        #search.properties requires some specific fields
        sinfo = info.copy()
        sinfo['FDR'] = info['FDR']
        sinfo['DBASENAME'] = os.path.splitext(os.path.split(
            info['DBASE'])[1])[0]
        sinfo['PARENT-DATA-SET-CODES'] = info[Keys.DATASET_CODE]

        # set values to NONE if they were e.g. "" before
        for key in ['STATIC_MODS', 'VARIABLE_MODS']:
            if info.get(key, "") == "":
                sinfo[key] = 'NONE'
        #lowercase required
        sinfo['experiment-code'] = info['EXPERIMENT_CODE']

        path = os.path.join(info['DROPBOXSTAGE'], 'search.properties')
        IniInfoHandler().write(sinfo, path)

        #write mail to dropbox but do not send yet (after viewer only)
        info['MAILFILE'] = os.path.join(info['DROPBOXSTAGE'], 'mailtext.txt')
        self._writemail(info.copy())

        info['DROPBOXSTAGE'] = dropbox.move_stage_to_dropbox(
            log, info['DROPBOXSTAGE'], info['DROPBOX'], keepCopy=True)
        return info
Example #11
0
    def run(self, log, info):
        info['WORKFLOW'] = dropbox.extendWorkflowID(info['WORKFLOW'])
        info['DROPBOXSTAGE'] = stagebox = dropbox.make_stagebox(log, info)

        info['PEPIDX'] = info['SPLIB'].replace(".splib", ".pepidx")
        dropbox.keys_to_dropbox(log, info, ['SPLIB', 'PEPIDX', 'TSV', 'TRAML'], stagebox)

        dsattr = {}
        dsattr['SPACE'] = 'PERSONAL_DB'
        dsattr['PROJECT'] = 'TRAML'
        dsattr['EXPERIMENT'] = getpass.getuser().upper()
        dsattr['EXPERIMENT_TYPE'] = "PLAIN"
        dsattr['DATASET_TYPE'] = 'TRAML_DB'
        dsattr['PARENT_DATASETS'] = os.path.basename(os.path.dirname(info[Keys.PEPXML]))

        path = os.path.join(stagebox, 'dataset.attributes')
        IniInfoHandler().write(dsattr, path)

        dsprop = {}
        dsprop['VERSION'] = time.strftime("%Y%m%d%H%M%S")
        dsprop['NAME'] = info.get('COMMENT', "unnamed")
        dsprop['DESCRIPTION'] = info.get('DESCRIPTION', "undescribed")
        dsprop['WORKFLOW'] = info['WORKFLOW']
        dsprop['HASSPLIB'] = "true"

        for key in ["FDR", "MS_TYPE", "RUNRT", "RTKIT",
                    "TSV_MASS_LIMITS", "TSV_ION_LIMITS", "TSV_PRECISION", "TSV_CHARGE", "TSV_REMOVE_DUPLICATES",
                    "TSV_EXACT", "TSV_GAIN", "TSV_SERIES", "CONSENSUS_TYPE"]:
            dsprop[key] = info[key]

        #cannot use IniInfoHandlerHere because it writes NAME
        config = ConfigObj(dsprop)
        config.filename = os.path.join(stagebox, 'dataset.properties')
        config.write()

        dropbox.move_stage_to_dropbox(log, stagebox, info['DROPBOX'], keepCopy=False)

        return info
Example #12
0
    def run(self, log, info):
        info['WORKFLOW'] = dropbox.extendWorkflowID(info['WORKFLOW'])
        info['DROPBOXSTAGE'] = dropbox.make_stagebox(log, info)

        keys = [Keys.PEPXML, 'PEPCSV']
        dropbox.keys_to_dropbox(log, info, keys, info['DROPBOXSTAGE'])

        #protxml special naming
        filename = os.path.basename(info['DROPBOXSTAGE']) + '.prot.xml'
        filepath = os.path.join(info['DROPBOXSTAGE'], filename)
        shutil.copy(info['PROTXML'], filepath)

        #search.properties requires some specific fields
        info['DBASENAME'] = os.path.splitext(os.path.split(
            info['DBASE'])[1])[0]
        info['PARENT-DATA-SET-CODES'] = info[Keys.DATASET_CODE]

        path = os.path.join(info['DROPBOXSTAGE'], 'search.properties')
        IniInfoHandler().write(info, path)

        info['DROPBOXSTAGE'] = dropbox.move_stage_to_dropbox(
            log, info['DROPBOXSTAGE'], info['DROPBOX'], keepCopy=True)

        return info
Example #13
0
    def run(self, log, info):

        info['WORKFLOW'] = dropbox.extendWorkflowID(info['WORKFLOW'])
        info['DROPBOXSTAGE'] = dropbox.make_stagebox(log, info)
        info['EXPERIMENT_CODE'] = dropbox.get_experiment_code(info)

        keys = [Keys.PEPXML, 'PEPCSV', 'MAYUOUT']
        dropbox.keys_to_dropbox(log, info, keys, info['DROPBOXSTAGE'])

        # protxml special naming
        filename = os.path.basename(info['DROPBOXSTAGE']) + '.prot.xml'
        filepath = os.path.join(info['DROPBOXSTAGE'], filename)
        shutil.copy(info['PROTXML'], filepath)

        #search.properties requires some specific fields
        sinfo = info.copy()
        sinfo['FDR'] = info['FDR']
        sinfo['DBASENAME'] = os.path.splitext(os.path.split(info['DBASE'])[1])[0]
        sinfo['PARENT-DATA-SET-CODES'] = info[Keys.DATASET_CODE]

        # set values to NONE if they were e.g. "" before
        for key in ['STATIC_MODS', 'VARIABLE_MODS']:
            if info.get(key, "") == "":
                sinfo[key] = 'NONE'
        #lowercase required
        sinfo['experiment-code'] = info['EXPERIMENT_CODE']

        path = os.path.join(info['DROPBOXSTAGE'], 'search.properties')
        IniInfoHandler().write(sinfo, path)

        #write mail to dropbox but do not send yet (after viewer only)
        info['MAILFILE'] = os.path.join(info['DROPBOXSTAGE'], 'mailtext.txt')
        self._writemail(info.copy())

        info['DROPBOXSTAGE'] = dropbox.move_stage_to_dropbox(log, info['DROPBOXSTAGE'], info['DROPBOX'], keepCopy=True)
        return info
Example #14
0
    def run(self, log, info):
        info['WORKFLOW'] = dropbox.extendWorkflowID(info['WORKFLOW'])
        stagebox = dropbox.make_stagebox(log, info)

        dropbox.keys_to_dropbox(log, info, ['APMS_OUT'], stagebox)

        dsattr = {}
        dsattr['DATASET_TYPE'] = 'APMS_RESULT'
        dsattr['SPACE'] = info['SPACE']
        dsattr['PROJECT'] = info['PROJECT']
        dsattr['EXPERIMENT'] = info['OUTEXPERIMENT']

        for key in ["COMMENT"]:
            dsattr[key] = info[key]

        path = os.path.join(stagebox, 'dataset.attributes')
        IniInfoHandler().write(dsattr, path)

        dropbox.move_stage_to_dropbox(log,
                                      stagebox,
                                      info['DROPBOX'],
                                      keepCopy=False)

        return info
Example #15
0
    def run(self, log, info):

        info['WORKFLOW'] = dropbox.extendWorkflowID(info['WORKFLOW'])
        info['WORKFLOW'] += " msproteomicstools@" + subprocess.check_output(
            "git --git-dir=/cluster/apps/imsbtools/stable/msproteomicstools/master/.git rev-parse --short HEAD", shell=True).strip()
        info['WORKFLOW'] += " openms@" + subprocess.check_output(
            "git --git-dir=/cluster/apps/openms/2.0.0-memory/OpenMS/.git rev-parse --short HEAD", shell=True).strip()

        info['DROPBOXSTAGE'] = stagebox = dropbox.make_stagebox(log, info)
        expcode = dropbox.get_experiment_code(info)

        #copy and compress align.csv, but not the matrix REQUEST: expcode in name
        tgt = os.path.join(stagebox, expcode + '_' + os.path.basename(info['ALIGNMENT_TSV']))
        shutil.copy(info['ALIGNMENT_TSV'], tgt)
        subprocess.check_call('gzip ' + stagebox + '/* 2>&1', shell=True)

        tgt = os.path.join(stagebox, expcode + '_' + os.path.basename(info['ALIGNMENT_MATRIX']))
        shutil.copy(info['ALIGNMENT_MATRIX'], tgt)
        dropbox.keys_to_dropbox(log, info, ['ALIGNER_STDOUT'], stagebox)

        #compress all mprophet files into one zip
        archive = os.path.join(stagebox, 'pyprophet_stats.zip')
        if not 'MPROPHET_STATS' in info:
            info['MPROPHET_STATS'] = []
        if not isinstance(info['MPROPHET_STATS'], list):
            info['MPROPHET_STATS'] = [info['MPROPHET_STATS']]
        for entry in info['MPROPHET_STATS']:
            subprocess.check_call('zip -j ' + archive + ' ' + entry + " 2>&1", shell=True)

        #PATCH: reimport old classifier if existing was used
        if 'MPR_LDA_PATH' in info and info['MPR_LDA_PATH'] != "":
            subprocess.check_call('zip -j ' + archive + ' ' + info['MPR_LDA_PATH'] + " 2>&1", shell=True)

        if 'MPR_WT_PATH' in info and info['MPR_WT_PATH'] != "":
            subprocess.check_call('zip -j ' + archive + ' ' + info['MPR_WT_PATH'] + " 2>&1", shell=True)

        #SPACE PROJECT given
        dsinfo = {}
        dsinfo['SPACE'] = info['SPACE']
        dsinfo['PROJECT'] = info['PROJECT']
        dsinfo['PARENT_DATASETS'] = info[Keys.DATASET_CODE]
        if info.get("DB_SOURCE", "") == "PersonalDB":
            if isinstance(dsinfo['PARENT_DATASETS'], list):
                dsinfo['PARENT_DATASETS'].append(info["DBASE"])
            else:
                dsinfo['PARENT_DATASETS'] = [dsinfo['PARENT_DATASETS'], info['DBASE']]

        dsinfo['DATASET_TYPE'] = 'SWATH_RESULT'
        dsinfo['EXPERIMENT_TYPE'] = 'SWATH_SEARCH'
        dsinfo['EXPERIMENT'] = expcode
        path = os.path.join(stagebox, 'dataset.attributes')
        IniInfoHandler().write(dsinfo, path)

        expinfo = {}
        expinfo['PARENT-DATA-SET-CODES'] = dsinfo['PARENT_DATASETS']
        expinfo['ALIGNER_DSCORE_CUTOFF'] = info['MPR_DSCORE_CUTOFF']
        for key in ['WORKFLOW', 'COMMENT',
                    'TRAML', 'EXTRACTION_WINDOW', 'WINDOW_UNIT', 'RT_EXTRACTION_WINDOW',
                    'MIN_UPPER_EDGE_DIST', 'IRTTRAML', 'MIN_RSQ', 'MIN_COVERAGE',
                    'MPR_NUM_XVAL','MPR_LDA_PATH', 'MPR_WT_PATH', 'MPR_FRACT', 'MPR_SSL_IF', 'MPR_SSL_IL', 'MPR_SSL_TF',
                    'MPR_SSL_TL', 'MPR_SSL_NI', 'MPR_MAINVAR', 'MPR_VARS',
                    'ALIGNER_FRACSELECTED', 'ALIGNER_MAX_RT_DIFF', 'ALIGNER_METHOD', 'ALIGNER_FDR',
                    'ALIGNER_MAX_FDRQUAL', 'ALIGNER_TARGETFDR', 'ALIGNER_REALIGN_METHOD', 'DO_CHROMML_REQUANT',
                    'ALGNER_MST_USERTCORR','ALIGNER_MST_STDEVMULT',
                    'ISOTOPIC_GROUPING', 'REQUANT_METHOD',
        ]:
            if info.get(key, "") != "":
                expinfo[key] = info[key]
        path = os.path.join(stagebox, 'experiment.properties')
        IniInfoHandler().write(expinfo, path)

        #put a copy of the whole ini into the dropbox. copy() to prevent OUTPUT being removed from main ini
        IniInfoHandler().write(info.copy(), os.path.join(stagebox, 'input.ini'))

        mailtext = ""
        if info.get("RUNSWATH2VIEWER","") == "true":
            try:
                destdir = "/IMSB/ra/%s/html/tapir/%s" % (getpass.getuser(), dsinfo['EXPERIMENT'])
                makedirs_clean(destdir)
                shutil.copy(info['ALIGNMENT_TSV'],destdir)
                for chrom in info['CHROM_MZML']:
                    shutil.copy(chrom,destdir)
                subprocess.call("gunzip -v %s/*.gz 2>&1" % destdir, shell=True)
                mailtext = "\n\nswath2viewer was enabled. To visualize results use e.g.\n" \
                           "user@crick# /opt/imsb/georger/py26/bin/python " \
                           "/opt/imsb/georger/msproteomicstools/gui/TAPIR.py --in %s/*" % destdir
            except Exception, e:
                log.warn("swath2viewer failed! " + e.message)
Example #16
0
    def run(self, log, info):

        info['WORKFLOW'] = dropbox.extendWorkflowID(info['WORKFLOW'])
        info['WORKFLOW'] += " msproteomicstools@" + subprocess.check_output(
            "git --git-dir=/cluster/apps/imsbtools/stable/msproteomicstools/master/.git rev-parse --short HEAD",
            shell=True).strip()
        info['WORKFLOW'] += " openms@" + subprocess.check_output(
            "git --git-dir=/cluster/apps/openms/2.0.0-memory/OpenMS/.git rev-parse --short HEAD",
            shell=True).strip()

        info['DROPBOXSTAGE'] = stagebox = dropbox.make_stagebox(log, info)
        expcode = dropbox.get_experiment_code(info)

        #copy and compress align.csv, but not the matrix REQUEST: expcode in name
        tgt = os.path.join(
            stagebox, expcode + '_' + os.path.basename(info['ALIGNMENT_TSV']))
        shutil.copy(info['ALIGNMENT_TSV'], tgt)
        subprocess.check_call('gzip ' + stagebox + '/* 2>&1', shell=True)

        tgt = os.path.join(
            stagebox,
            expcode + '_' + os.path.basename(info['ALIGNMENT_MATRIX']))
        shutil.copy(info['ALIGNMENT_MATRIX'], tgt)
        dropbox.keys_to_dropbox(log, info, ['ALIGNER_STDOUT'], stagebox)

        #compress all mprophet files into one zip
        archive = os.path.join(stagebox, 'pyprophet_stats.zip')
        if not 'MPROPHET_STATS' in info:
            info['MPROPHET_STATS'] = []
        if not isinstance(info['MPROPHET_STATS'], list):
            info['MPROPHET_STATS'] = [info['MPROPHET_STATS']]
        for entry in info['MPROPHET_STATS']:
            subprocess.check_call('zip -j ' + archive + ' ' + entry + " 2>&1",
                                  shell=True)

        #PATCH: reimport old classifier if existing was used
        for key in ("MPR_LDA_PATH", "MPR_WT_PATH"):
            path = info.get(key, "")
            if path:
                if not os.path.exists(path):
                    raise Exception(
                        "can not add %s to archive, file does not exist" %
                        path)
                subprocess.check_call('zip -j ' + archive + ' ' + path +
                                      " 2>&1",
                                      shell=True)
        #if 'MPR_LDA_PATH' in info and info['MPR_LDA_PATH'] != "":
        #subprocess.check_call('zip -j ' + archive + ' ' + info['MPR_LDA_PATH'] + " 2>&1", shell=True)

        #if 'MPR_WT_PATH' in info and info['MPR_WT_PATH'] != "":
        #if not os.path.exists(info['MPR_WT_PATH']):
        #raise Exception("%s does not exist" % info['MPR_WT_PATH'])
        #subprocess.check_call('zip -j ' + archive + ' ' + info['MPR_WT_PATH'] + " 2>&1", shell=True)

        #SPACE PROJECT given
        dsinfo = {}
        dsinfo['SPACE'] = info['SPACE']
        dsinfo['PROJECT'] = info['PROJECT']
        dsinfo['PARENT_DATASETS'] = info[Keys.DATASET_CODE]
        if info.get("DB_SOURCE", "") == "PersonalDB":
            if isinstance(dsinfo['PARENT_DATASETS'], list):
                dsinfo['PARENT_DATASETS'].append(info["DBASE"])
            else:
                dsinfo['PARENT_DATASETS'] = [
                    dsinfo['PARENT_DATASETS'], info['DBASE']
                ]

        dsinfo['DATASET_TYPE'] = 'SWATH_RESULT'
        dsinfo['EXPERIMENT_TYPE'] = 'SWATH_SEARCH'
        dsinfo['EXPERIMENT'] = expcode
        path = os.path.join(stagebox, 'dataset.attributes')
        IniInfoHandler().write(dsinfo, path)

        expinfo = {}
        expinfo['PARENT-DATA-SET-CODES'] = dsinfo['PARENT_DATASETS']
        expinfo['ALIGNER_DSCORE_CUTOFF'] = info['MPR_DSCORE_CUTOFF']
        for key in [
                'WORKFLOW',
                'COMMENT',
                'TRAML',
                'EXTRACTION_WINDOW',
                'WINDOW_UNIT',
                'RT_EXTRACTION_WINDOW',
                'MIN_UPPER_EDGE_DIST',
                'IRTTRAML',
                'MIN_RSQ',
                'MIN_COVERAGE',
                'MPR_NUM_XVAL',
                'MPR_LDA_PATH',
                'MPR_WT_PATH',
                'MPR_FRACT',
                'MPR_SSL_IF',
                'MPR_SSL_IL',
                'MPR_SSL_TF',
                'MPR_SSL_TL',
                'MPR_SSL_NI',
                'MPR_MAINVAR',
                'MPR_VARS',
                'ALIGNER_FRACSELECTED',
                'ALIGNER_MAX_RT_DIFF',
                'ALIGNER_METHOD',
                'ALIGNER_FDR',
                'ALIGNER_MAX_FDRQUAL',
                'ALIGNER_TARGETFDR',
                'ALIGNER_REALIGN_METHOD',
                'DO_CHROMML_REQUANT',
                'ALGNER_MST_USERTCORR',
                'ALIGNER_MST_STDEVMULT',
                'ISOTOPIC_GROUPING',
                'REQUANT_METHOD',
        ]:
            if info.get(key, "") != "":
                expinfo[key] = info[key]
        path = os.path.join(stagebox, 'experiment.properties')
        IniInfoHandler().write(expinfo, path)

        #put a copy of the whole ini into the dropbox. copy() to prevent OUTPUT being removed from main ini
        IniInfoHandler().write(info.copy(),
                               os.path.join(stagebox, 'input.ini'))

        mailtext = ""
        if info.get("RUNSWATH2VIEWER", "") == "true":
            try:
                #destdir = "/IMSB/ra/%s/html/tapir/%s" % (getpass.getuser(), dsinfo['EXPERIMENT'])
                destdir = "/nfs/195.176.109.15/nas/fs2102/biol_ibt_usr_s1/%s/tapir/%s" % (
                    getpass.getuser(), dsinfo['EXPERIMENT'])

                makedirs_clean(destdir)
                shutil.copy(info['ALIGNMENT_TSV'], destdir)
                for chrom in info['CHROM_MZML']:
                    shutil.copy(chrom, destdir)
                subprocess.call("gunzip -v %s/*.gz 2>&1" % destdir, shell=True)
                mailtext = "\n\nswath2viewer was enabled. To visualize results use e.g.\n" \
                           "user@crick# /opt/imsb/georger/py26/bin/python " \
                           "/opt/imsb/georger/msproteomicstools/gui/TAPIR.py --in %s/*" % destdir
            except Exception, e:
                log.warn("swath2viewer failed! " + e.message)