Пример #1
0
def doGolden(db, ac, DE):
    # ########################## db ref
    if db in['sp', 'sw', 'swissprot', 'tr', 'trembl']:
        db = 'uniprot'
    elif db in ['emb', 'dbj']:
        db = 'embl'
    elif db in ['gb']:
        db = 'genbank'
    elif db in ['gp']:
        db = 'genpept'
    elif db in ['ref']:
        db = 'refseq'
    elif db in ['rdpii']:
        db = 'rdpii'
    elif db[0:8] == 'embl_wgs':
        db = 'embl_wgs'
    elif db[0:8] == 'genbank_wgs':
        db = 'genbank_wgs'
    elif db in ['pir', 'pdb', 'tpg', 'tpe', 'tpd', 'prf']:
        return '', '', '', ''
    try:
        flatFile = Golden.access(db, ac)
    except IOError, err:
        print >>sys.stderr, err, db, ac
        sys.exit()
def doGolden(db, ac, file_format='fasta'):
    # ## db ref
    if db in ['sp', 'sw', 'swissprot', 'tr', 'trembl']:
        db = 'uniprot'
    elif db in ['emb', 'dbj']:
        db = 'embl'
    elif db in ['gb']:
        db = 'genbank'
    elif db in ['gp']:
        db = 'genpept'
    elif db in ['ref']:
        db = 'refseq'
    elif db in ['rdpii']:
        db = 'rdpii'
    elif db[0:8] == 'embl_wgs':
        db = 'embl_wgs'
    elif db[0:8] == 'genbank_wgs':
        db = 'genbank_wgs'
    elif db in ['pir', 'pdb', 'tpg', 'tpe', 'tpd', 'prf']:
        return ''

    try:
        flatFile = Golden.access(db, ac)
    except IOError, err:
        print >> sys.stderr, err, "%s:%s" % (db, ac)
        sys.exit()
def doGoldenMulti(allTaxo,l_input,DE):
    idx_res=0
    lst_input=l_input.split("\n")
    try:
        flatFile=Golden.access_new(l_input)
        while (flatFile!=None):
            db_acc=lst_input[idx_res]
            l_db_acc=db_acc.split(":")
            acc=l_db_acc[1]
            allTaxo[acc]['orgName'], allTaxo[acc]['taxId'], allTaxo[acc]['taxoLight'], allTaxo[acc]['DE'] =  parse(flatFile , DE ) #orgName, taxId, taxoLight, description
            flatFile=Golden.access_new(l_input)
            idx_res+=1
        return allTaxo
    except IOError, err:
        print >>sys.stderr, err, l_input
        sys.exit()
Пример #4
0
def doGolden( db,ac, DE ):
    #print "inside doGolden, GOLDENDATA=",GOLDENDATA
    ########################### db ref
    if db in[ 'sp', 'sw','swissprot','tr', 'trembl']:
        db = 'uniprot'
    elif db in ['emb', 'dbj']:
        db = 'embl'
    elif db in ['gb']:
        db = 'genbank'
    elif db in ['gp']:
        db = 'genpept'
    elif db in ['ref']:
        db = 'refseq'
    elif db in ['rdpii']:
        db = 'rdpii'
    elif db in ['pir','pdb','tpg', 'tpe', 'tpd', 'prf']:
        return '','','',''
    try:
        #print "Calling Golden on : ",db,ac
        #print "GOLDENDATA=",GOLDENDATA
        #print >>f_cards, db+":"+acc
        flatFile = Golden.access(db,ac)
    except IOError, err:
        print >>sys.stderr, err, db, ac
        sys.exit()
Пример #5
0
def doGoldenMulti(allTaxo, l_cards, DE, allTaxId, osVSoc_bdb):
    idx_res = 0
    lst_input = l_cards.split("\n")
    try:
        flatFile = Golden.access_new(l_cards)
        while (flatFile is not None):
            db_acc = lst_input[idx_res]
            l_db_acc = db_acc.split(":")
            acc = l_db_acc[1]
            if acc not in allTaxo:
                allTaxo[acc] = {'db': l_db_acc[0]}
                allTaxo[acc]['orgName'], allTaxo[acc]['taxId'], allTaxo[acc]['taxoLight'], allTaxo[acc]['DE'] = parse(flatFile, DE)  # orgName, taxId, taxoLight, description
                allTaxo, allTaxId = extractTaxoFrom_osVSocBDB_multi(acc, allTaxo, allTaxId, osVSoc_bdb)

            flatFile = Golden.access_new(l_cards)
            idx_res += 1
        return allTaxo
    except IOError, err:
        print >>sys.stderr, err, l_cards
        sys.exit()
Пример #6
0
def doGoldenMulti(allTaxo, l_cards, DE, allTaxId, osVSoc_bdb):
    idx_res = 0
    lst_input = l_cards.split("\n")
    try:
        flatFile = Golden.access_new(l_cards)
        while (flatFile is not None):
            db_acc = lst_input[idx_res]
            l_db_acc = db_acc.split(":")
            acc = l_db_acc[1]
            if acc not in allTaxo:
                allTaxo[acc] = {'db': l_db_acc[0]}
                allTaxo[acc]['orgName'], allTaxo[acc]['taxId'], allTaxo[
                    acc]['taxoLight'], allTaxo[acc]['DE'] = parse(
                        flatFile, DE)  # orgName, taxId, taxoLight, description
                allTaxo, allTaxId = extractTaxoFrom_osVSocBDB_multi(
                    acc, allTaxo, allTaxId, osVSoc_bdb)
            flatFile = Golden.access_new(l_cards)
            idx_res += 1

        return allTaxo
    except IOError, err:
        print >> sys.stderr, err, l_cards
        sys.exit()
Пример #7
0
import Binary

ak = int(input("最小值:"))
bk = int(input("最大值:"))

L = [1e-2, 1e-3, 1e-4, 1e-5, 1e-6, 1e-7, 1e-8]
B = []
B_Value = []
G = []
G_Value = []
F = []
F_Value = []

for i in L:
    b_value, b = Binary.BinarySearch(ak, bk, i)
    g_value, g = Golden.GoldenSearch(ak, bk, i)
    f_value, f = Fibonacci.FibonacciSearch(ak, bk, i)

    B.append(b)
    B_Value.append(b_value)
    G.append(g)
    G_Value.append(g_value)
    F.append(f)
    F_Value.append(f_value)

plt.figure(figsize=(12, 8), dpi=80)
plt.figure(1)
ax1 = plt.subplot(321)
plt.plot(L, B, "or")  #color='#FF0000'
ax2 = plt.subplot(322)
plt.plot(L, B_Value, "oy")