예제 #1
0
파일: SGD.py 프로젝트: adamlabadorf/TAMO
def swp2swp(swp):
    'Converts, when possible, from P014543 to ADR1_YEAST'
    'Only works for yeast right now'
    global _swp2swp
    if not _swp2swp:
        lines = Fasta.keys(_SWPFASTA,key_func=lambda x:x)
        for line in lines:
            toks = line.split()
            text_name  = toks[1]
            numeric_name = toks[2]
            if text_name[0:2] == 'SW' and numeric_name[0] == 'P':
                _swp2swp[text_name[3:]]  = numeric_name
                _swp2swp[numeric_name]   = text_name[3:]
    if _swp2swp.has_key(swp):
        return _swp2swp[swp]
예제 #2
0
파일: SGD.py 프로젝트: malhamdoosh/abseqPy
def swp2swp(swp):
    'Converts, when possible, from P014543 to ADR1_YEAST'
    'Only works for yeast right now'
    global _swp2swp
    if not _swp2swp:
        lines = Fasta.keys(_SWPFASTA, key_func=lambda x: x)
        for line in lines:
            toks = line.split()
            text_name = toks[1]
            numeric_name = toks[2]
            if text_name[0:2] == 'SW' and numeric_name[0] == 'P':
                _swp2swp[text_name[3:]] = numeric_name
                _swp2swp[numeric_name] = text_name[3:]
    if _swp2swp.has_key(swp):
        return _swp2swp[swp]
예제 #3
0
def main():
    short_opts = 'f:'
    long_opts = ['genome=', 'range=', 'top=', 'pcnt=', 'bgfile=']
    try:
        opts, args = getopt.getopt(sys.argv[1:], short_opts, long_opts)
    except getopt.GetoptError:
        print getopt.GetoptError.__dict__
        usage()
    if not opts: usage()

    fastafile = ''
    top_count = 10
    top_pcnt = None
    genome = 'YEAST'
    w_start = 8
    w_stop = 15
    bgfile = MDSCAN_DIR + 'yeast_int.bg'
    for opt, value in opts:
        if opt == '-f': fastafile = value
        if opt == '--genome': genome = value
        if opt == '--top': top_count = int(value)
        if opt == '--pcnt': top_pcnt = float(value)
        if opt == '--range':
            w_start, w_stop = [int(x) for x in value.split(',')]

    print "#" + ' '.join(sys.argv)
    probeids = Fasta.keys(fastafile)
    Genome = MotifMetrics.ProbeSet(genome)

    probeids = Genome.filter(probeids)

    if top_pcnt:
        top_count = max(top_count, int(top_pcnt / 100.0 * len(probeids)))

    theMeta = metaMDscan(fastafile, w_start, w_stop, top_count)

    for m in theMeta.motifs:
        m.pvalue = Genome.p_value(m, probeids, 'v')
        m.church = Genome.church(m, probeids, 'v')
        sys.stdout.flush()

    theMeta.motifs.sort(lambda x, y: cmp(x.pvalue, y.pvalue))
    print_motifs(theMeta.motifs)
예제 #4
0
파일: MDscan.py 프로젝트: adamlabadorf/TAMO
def main():
    short_opts = 'f:'
    long_opts  = ['genome=', 'range=', 'top=', 'pcnt=', 'bgfile=']
    try:   opts, args = getopt.getopt(sys.argv[1:], short_opts, long_opts)
    except getopt.GetoptError:
        print getopt.GetoptError.__dict__
        usage()
    if not opts: usage()

    fastafile = ''
    top_count = 10
    top_pcnt  = None
    genome    = 'YEAST'
    w_start   = 8
    w_stop    = 15
    bgfile    = MDSCAN_DIR + 'yeast_int.bg'
    for opt,value in opts:
        if opt == '-f':         fastafile = value
        if opt == '--genome':   genome    = value
        if opt == '--top':      top_count = int(value)
        if opt == '--pcnt':     top_pcnt  = float(value)
        if opt == '--range':    w_start,w_stop= [int(x) for x in value.split(',')]

    print "#" + ' '.join(sys.argv)
    probeids = Fasta.keys(fastafile)
    Genome = MotifMetrics.ProbeSet(genome)

    probeids = Genome.filter(probeids)

    if top_pcnt: top_count = max(top_count,int(top_pcnt/100.0 * len(probeids)))

    theMeta = metaMDscan(fastafile,w_start,w_stop,top_count)

    for m in theMeta.motifs:
        m.pvalue = Genome.p_value(m,probeids,'v')
        m.church = Genome.church(m,probeids,'v')
        sys.stdout.flush()

    theMeta.motifs.sort(lambda x,y: cmp(x.pvalue,y.pvalue))
    print_motifs(theMeta.motifs)