Exemple #1
0
def sra__dump(
        uri,
        #               level=2,
        silent=1,
        baseFile=0):
    uri = pyext.base__file(uri, baseFile=baseFile)
    #     head,tail = pyext.splitPath(uri)
    CMD = 'fastq-dump --split-files {uri} 2>LOG'.format(**locals())
    res = pysh.shellexec(CMD, silent=silent)
    return res
#!/usr/bin/env python
# -*- coding: utf-8 -*-

NCORE = 10
import pymisca.ext as pyext
execfile(pyext.base__file('headers/header__import.py'))
figs = pyutil.collections.OrderedDict()

# execfile('/home/feng/meta/header_0903.py')
keyDF = pyutil.readBaseFile('headers/key_brachy.csv')
tks = pyutil.readBaseFile(
    'results/0130__makeTracks-Brachy/tracks.npy').tolist()
# execfile("/home/feng/envs/Fig_Brachy/loadRNA_Bd.py")
# figs = pyutil.collections.OrderedDict()

plt.rcParams['font.size'] = 14.
plt.rcParams['xtick.labelsize'] = 16.
plt.rcParams['axes.titlepad'] = 24.
figsize = [14, 10]
panel_kw = dict(
    figsize=figsize,
    show_axa=1,
    show_axc=0,
    showGrid=0,
    width_ratios=[1, 14, 0.],
    tickMax=10,
    #     title= '',
    #     height_ratios = [1,3,3,3,1],
)

NCORE = 1
#!/usr/bin/env python2
# -*- coding: utf-8 -*-

import pymisca.ext as pyext
execfile(pyext.base__file('headers/header__import.py'))
figs = pyutil.collections.OrderedDict()

# execfile('/home/feng/meta/header_0903.py')
keyDF = pyutil.readBaseFile('headers/key_brachy.csv')
tks = pyutil.readBaseFile(
    'results/0427B__makeTracks-Brachy/tracks.npy').tolist()
# execfile("/home/feng/envs/Fig_Brachy/loadRNA_Bd.py")
# figs = pyutil.collections.OrderedDict()

plt.rcParams['font.size'] = 14.
plt.rcParams['xtick.labelsize'] = 16.
plt.rcParams['axes.titlepad'] = 24.
figsize = [14, 10]
panel_kw = dict(
    figsize=figsize,
    show_axa=1,
    show_axc=0,
    showGrid=0,
    width_ratios=[1, 14, 0.],
    tickMax=10,
    #     title= '',
    #     height_ratios = [1,3,3,3,1],
)

NCORE = 1
Exemple #4
0
import pymisca.ext as pyext

pyext.base__check()

suc, res = pyext.job__script(
    pyext.base__file('BrachyPhoton/0131__dumpDataRNA__Brachy.py'),
    #     env=env,
)
assert suc, res

suc, res = pyext.job__script(
    pyext.base__file('BrachyPhoton/0130__makeTracks-Brachy.py'),
    #     env=env,
)
assert suc, res
#!/usr/bin/env python
# -*- coding: utf-8 -*-
NCORE=6
import pymisca.ext as pyext
execfile(pyext.base__file('headers/header__import.py'))
figs = pyutil.collections.OrderedDict()
# execfile('/home/feng/meta/header__script2figure.py')
# import synotil.chipShot
keyDF = pyutil.readBaseFile('headers/key_brachy.csv')
# gconf = pyutil.envSource('/home/feng/ref/config/config_Bd21-3.sh',silent=1);
# gconf = pyutil.util_obj(**gconf)
# peak2gene = pyutil.readData('/home/feng/envs/Fig_Brachy/peak2gene.tsv')


plt.rcParams['font.size'] = 20.
plt.rcParams['xtick.labelsize'] = 22.
plt.rcParams['ytick.labelsize'] = 22.
plt.rcParams['axes.titlepad'] = 24.
plt.rcParams['legend.fontsize'] = 22.

# bwCurr = bwMeta.query('runID=="182C"').query('bamFinal.str.contains("TAIR10")')
# bwCurr = bwMeta
# bwCurr.bname=bwCurr.bname.str.split('_').str.get(0)

# bwCurr['bnameShort']=bwCurr.bname.str.split('_').str.get(0)
# bwCurr = bwCurr.query('runID=="188CR"')




# #####
#!/usr/bin/env python
# -*- coding: utf-8 -*-
NCORE = 6
import pymisca.ext as pyext
execfile(pyext.base__file('headers/header__import.py'))
figs = pyutil.collections.OrderedDict()

keyDF = pyutil.readBaseFile('headers/key_brachy.csv')
GSIZE = pyext.base__file('ref/Brachypodium_Bd21_v3-1/genome.sizes')
peak2geneFile = 'results/0130__makePeakWindows__Brachy-ELF3/peak2geneFile.tsv'
peak2gene = pyutil.readBaseFile(peak2geneFile)

# keyDF = pyutil.readData('/home/feng/meta/key_brachy.csv')
# peak2gene = pyutil.readData('/home/feng/envs/Fig_Brachy/peak2gene.tsv')

plt.rcParams['font.size'] = 20.
plt.rcParams['xtick.labelsize'] = 22.
plt.rcParams['axes.titlepad'] = 24.

#####
rnaScore = pyutil.readBaseFile(
    'results/0205__interpAUC__Brachy/score__rnaseq__AUC.csv')
xlab = 'transcriptionally perturbed\n over day-night cycle'
query = 'score__rnaseq__AUC>1.0'
ind1 = rnaScore.query(query).index

chipClu = pyutil.readBaseFile(
    'results/0130__callDiffTarg__Brachy-ELF3/clu.csv')
chipClu.columns = ['clu']

chipDF = pyutil.readBaseFile(
#!/usr/bin/env python

import pymisca.ext as pyext
execfile(pyext.base__file('headers/header__import.py'))
figs = pyutil.collections.OrderedDict()
#                    './headers/header__import.py')
NBNAME="1024__chipTarg__ELF3"

# DIR = pyext.base__file('.')

keyDF = pyutil.readData( pyext.base__file('./headers/key_brachy.csv') )

# BED_FILE = bedFile = DIR + '/bedFile.bed'
# bed = sdio.extract_peak(bedFile)

# peak2gene = pyutil.readData('%s/peak2gene.tsv' % DIR)
# chipRel = pyutil.readData('%s/1018__chip-rel.pk'% DIR)
# peak2gene = pyutil.readData('%s/peak2gene.tsv' % DIR)
peak2gene = pyutil.readData(
        'results/0130__makePeakWindows__Brachy-ELF3/peak2geneFile.tsv',baseFile=1)
chipRel = pyutil.readData(
    'results/0130__chipSummary__Brachy-ELF3/bwAvg.pk',baseFile=1,
                         callback=scount.countMatrix)
peaks0 = peaks = peak2gene.merge(keyDF,right_index=True,left_on="feat_acc")



#### QC plot
sutil.qc_Sort(df=chipRel);
figs['qcPlot']  = plt.gcf()
Exemple #8
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
NCORE = 6
import pymisca.ext as pyext
execfile(pyext.base__file('headers/header__import.py'))
figs = pyutil.collections.OrderedDict()

gconf = pyutil.util_obj(**pyutil.envSource(
    pyext.base__file('ref/config/config_Bd21-3.sh'), silent=1))
keyDF = pyutil.readBaseFile('headers/key_brachy.csv')
anno = pyutil.readBaseFile(gconf.ANNOINFO)
dfc = pyutil.readBaseFile(gconf.ANNOINFO, comment=None)
dfc = dfc.sort_values('transcriptName')
dfc = dfc.query('~locusName.duplicated()').set_index('locusName')
dfc = dfc['Best-hit-arabi-name,arabi-symbol,arabi-defline'.split(',')]
gconf.defline = defline = dfc
# Best-hit-arabi-name      arabi-symbol    arabi-defline

# defline = pyutil.readData(gconf.DEFLINE,header = None)
# defline.index = defline.index.str.split('.',1).str.get(0)
# defline = defline[[2]].rename(columns = {2:'defline'})
# defline = defline.query('~index.duplicated()')
# gconf.defline = defline

gene2name = dfc = pyutil.readBaseFile(gconf.GENE2NAME,
                                      header=None,
                                      names=list(range(3)))

### patch
rid = ~dfc[2].isnull()
dfcc = dfc.loc[rid]
import pymisca.ext as pyext;
pyext.base__check()
# pyext.os.environ['BASE'] = '/home/feng/work'

suc,res = pyext.job__script(
    pyext.base__file('BrachyPhoton/0129__cluster__Brachy-RNA-all.py'),
#     env=env,
)
assert suc,res

suc,res = pyext.job__script(
    pyext.base__file('BrachyPhoton/0129__showCluster__Brachy-RNA-all.py'),
#     env=env,
)
assert suc,res

suc,res = pyext.job__script(
    pyext.base__file('BrachyPhoton/0128__heatmap__Brachy.py'),
#     env=env,
)
assert suc,res
Exemple #10
0
import pymisca.ext as pyext
pyext.base__check()
# matplotlib.use("Agg")
# pyext.os.environ['BASE'] = '/home/feng/work'

suc, res = pyext.job__script(
    pyext.base__file('BrachyPhoton/0130__lineplot__pfr.py'),
    #     env=env,
)
assert suc, res
Exemple #11
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
NCORE = 6
import pymisca.ext as pyext
execfile(pyext.base__file('headers/header__import.py'))
figs = pyutil.collections.OrderedDict()

gconf = pyutil.util_obj(**pyutil.envSource(
    pyext.base__file('ref/config/config_Ath_TAIR10.sh'), silent=1))
keyDF = pyutil.readBaseFile('headers/key_ath.csv')
if hasattr(keyDF, 'gconf'):
    anno = pyutil.readBaseFile(gconf.ANNOINFO)
    dfc = pyutil.readBaseFile(gconf.ANNOINFO, comment=None)
    dfc = dfc.sort_values('transcriptName')
    dfc = dfc.query('~locusName.duplicated()').set_index('locusName')
    dfc = dfc['Best-hit-arabi-name,arabi-symbol,arabi-defline'.split(',')]
    gconf.defline = defline = dfc
    # Best-hit-arabi-name      arabi-symbol    arabi-defline

    # defline = pyutil.readData(gconf.DEFLINE,header = None)
    # defline.index = defline.index.str.split('.',1).str.get(0)
    # defline = defline[[2]].rename(columns = {2:'defline'})
    # defline = defline.query('~index.duplicated()')
    # gconf.defline = defline

    gene2name = dfc = pyutil.readBaseFile(gconf.GENE2NAME,
                                          header=None,
                                          names=list(range(3)))

    ### patch
    rid = ~dfc[2].isnull()
Exemple #12
0
import pymisca.ext as pyext

pyext.base__check()

suc, res = pyext.job__script(
    pyext.base__file('BrachyPhoton/0130__makePeakWindows__Brachy-ELF3.py'),
    #     env=env,
)
assert suc

suc, res = pyext.job__script(
    pyext.base__file('BrachyPhoton/0130__chipSummary__Brachy-ELF3.py'))
assert suc

suc, res = pyext.job__script(
    pyext.base__file('BrachyPhoton/0130__callDiffTarg__Brachy-ELF3.py'))
assert suc
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import pymisca.ext as pyext
execfile(pyext.base__file('headers/header__import.py'))
figs = pyutil.collections.OrderedDict()

# npkFiles = \
# ['Mapped_data/188CR/S1/64-LD-ZT0-ELF3-OX-RERUN_S1_peaks.narrowPeak',
#  'Mapped_data/188CR/S2/64-SD-ZT0-ELF3-OX-RERUN_S2_peaks.narrowPeak',
#  'Mapped_data/188CR/S3/64-LL-ZT0-ELF3-OX-RERUN_S3_peaks.narrowPeak',
#  'Mapped_data/188CR/S4/64-LD-ZT4-ELF3-OX-RERUN_S4_peaks.narrowPeak',
#  'Mapped_data/188CR/S5/64-SD-ZT4-ELF3-OX-RERUN_S5_peaks.narrowPeak',
#  'Mapped_data/188CR/S7/64-LD-ZT20-ELF3OX-RERUN_S7_peaks.narrowPeak',
#  'Mapped_data/188CR/S8/64-SD-ZT20-ELF3OX-RERUN_S8_peaks.narrowPeak']
# npkFiles = map(pyext.base__file,npkFiles)

bwCurr = pyutil.readBaseFile('results/0201__dumpMeta__Brachy/bwCurr.csv')
npkFiles = bwCurr.npkFile.map(pyext.base__file)

# bwCurr = bwMeta.query("runID=='188CR'")
# bwCurr = bwCurr.query('bname.str.contains("ELF3",case=0)')
fnames = map(
    pyutil.functools.partial(pyutil.queryCopy,
                             inplace=False,
                             query='FC>2.0',
                             reader=sdio.extract_peak), npkFiles)
peakFile = ofname = sdio.bed__merge(
    pyutil.file__cat(fnames, ofname='combined__ELF3__peaks.narrowPeak'))
print(ofname, pyutil.lineCount(ofname))
windowFile = ofname = sdio.bed__makewindows(peakFile,