コード例 #1
0
ファイル: rangefinder.py プロジェクト: TristanOM/trappist
         try:
             print "converting,",
             record = load_genbank(genome_path)
         except IOError:
             print "failed to load Genbank file"
             break
         else:
             try:
                 genome_path = dir_in+rec_name+".fas"
                 write_fasta(genome_path, record)
             except Exception:
                 print "failed to write Fasta file"
                 break
     try:
         print "making a DB,",
         make_blastDB(dbfile_path, genome_path, 'nucl')
     except IOError:
         print "failed to make DB"
         break
 try:
     # blastx against each genome DB
     outfile = blast_out+rec_name+".txt"
     prefs = {'evalue': 0.001, 'outfmt_pref': 6}
     print "blasting,",
     if blast_mode == 'n':
         local_blastn_2file(infile, dbfile_path, outfile, prefs)
     elif blast_mode == 'tx':
         local_tblastx_2file(infile, dbfile_path, outfile, prefs)
     elif blast_mode == 'tn':
         local_tblastn_2file(infile, dbfile_path, outfile, prefs)
 except Exception:
コード例 #2
0
            feat_cnt = 0

            # cycle through selected features
            for feat in select:

                feat_cnt += 1
                rec = feat.extract(record)
                rec.description = genome['name'] + '_' + feat_type + '_' + str(
                    feat_cnt)

                # initialize or update blast DB
                if init_DB:
                    ref_records = [value[0] for value in symbolDB.values()]
                    write_fasta(db_file, ref_records)
                    try:
                        make_blastDB(db_path, db_file, 'nucl')
                    except Exception:
                        print "failed to make blast DB"
                        exit()
                    init_DB = False

                # first go: add all features as new symbols
                if new_DB:
                    sym_cnt += 1
                    symbol = 'N' + str(sym_cnt)
                    rec.id = symbol
                    symbolDB[symbol] = [rec]
                    g_vector.append(symbol)

                else:
                    # tblastn against the reference DB
コード例 #3
0
ファイル: rangefinder.py プロジェクト: gglobster/trappist
         try:
             print "converting,",
             record = load_genbank(genome_path)
         except IOError:
             print "failed to load Genbank file"
             break
         else:
             try:
                 genome_path = dir_in + rec_name + ".fas"
                 write_fasta(genome_path, record)
             except Exception:
                 print "failed to write Fasta file"
                 break
     try:
         print "making a DB,",
         make_blastDB(dbfile_path, genome_path, 'nucl')
     except IOError:
         print "failed to make DB"
         break
 try:
     # blastx against each genome DB
     outfile = blast_out + rec_name + ".txt"
     prefs = {'evalue': 0.001, 'outfmt_pref': 6}
     print "blasting,",
     if blast_mode == 'n':
         local_blastn_2file(infile, dbfile_path, outfile, prefs)
     elif blast_mode == 'tx':
         local_tblastx_2file(infile, dbfile_path, outfile, prefs)
     elif blast_mode == 'tn':
         local_tblastn_2file(infile, dbfile_path, outfile, prefs)
 except Exception:
コード例 #4
0
ファイル: vectorizer.py プロジェクト: TristanOM/trappist
                      if feat.type == feat_type]
            feat_cnt = 0

            # cycle through selected features
            for feat in select:

                feat_cnt +=1
                rec = feat.extract(record)
                rec.description = genome['name']+'_'+feat_type+'_'+str(feat_cnt)

                # initialize or update blast DB
                if init_DB:
                    ref_records = [value[0] for value in symbolDB.values()]
                    write_fasta(db_file, ref_records)
                    try:
                        make_blastDB(db_path, db_file, 'nucl')
                    except Exception:
                        print "failed to make blast DB"
                        exit()
                    init_DB = False

                # first go: add all features as new symbols
                if new_DB:
                    sym_cnt +=1
                    symbol = 'N'+str(sym_cnt)
                    rec.id = symbol
                    symbolDB[symbol] = [rec]
                    g_vector.append(symbol)

                else:
                    # tblastn against the reference DB