Exemplo n.º 1
0
    
    for i in range(len(groups_list)):
        group_hits = []
        kv.make_id_list_fasta(groups_list[i], 'core')
        results = blast_vs_db('tmp.fna', 'blast_databases/other')

        hits_collection = kv.get_collection('hits')
        if results:
            for j in range(len(results)):
                group_hits.append(results[j])
        hits_collection.insert_one({'group':(i+1), 'group_hits':group_hits})


if __name__ == '__main__':
    import sys
    kv.mongo_init('pacbio2')
    os.chdir('/Users/KBLaptop/computation/kvasir/data/output/pacbio2/')
    # kv.mongo_init(sys.argv[1])
    # os.chdir('output/{}/'.format(sys.argv[1]))
    make_blast_db('core')
    make_blast_db('other')
    hits_reset()
    hgt_blast(perc_identity='90')
    hgt_blast(perc_identity='95')
    hgt_blast(perc_identity='99')
    blast_to_db(perc_identity='90')
    blast_to_db(perc_identity='95')
    blast_to_db(perc_identity='99')
    
    other_blast()
Exemplo n.º 2
0
    for i in range(len(ssu_df['strain'])):
        print ssu_df['strain'][i], ssu_df['16S'][i]
        if not pd.isnull(ssu_df['16S'][i]):
            gene_record = {
                'species':ssu_df['strain'][i],
                'location':{
                    'contig':None,
                    'start':None,
                    'end':None,
                    'strand':None,
                },
                'annotation':'Small subunit ribosomal RNA',
                'dna_seq':ssu_df['16S'][i],
                'kvtag':None,
                'type':'16S'
                }

            print "adding 16S gene!"
            kv.get_collection('16S').remove({'species':ssu_df['strain'][i]})
            print kv.get_collection('16S').find_one({'species':ssu_df['strain'][i]})
            kv.get_collection('16S').insert_one(gene_record)
            print kv.get_collection('16S').find_one({'species':ssu_df['strain'][i]})

def get_list_from_tree(newick_file):
    pass


if __name__ == '__main__':
    os.chdir('/Users/KBLaptop/computation/kvasir/data/output/reorg/')
    kv.mongo_init('reorg')
Exemplo n.º 3
0
    fig = plt.figure()
    ypos = 1
    for pair in list_of_species_pairs:    
        if pair[0] == pairs[0][0]:
            ax = fig.add_axes([1,ypos,1,1])
            output_loc_hist(pair[0], pair[1], ax)

    plot_url = py.plot_mpl(fig)
    print plot_url

    # plt.xlabel("Position")
    # plt.ylabel("percent identity")
    # plt.savefig('/Users/KBLaptop/Desktop/try.pdf')

if __name__ == '__main__':
    kv.mongo_init('more_genomes')
    os.chdir('/Users/KBLaptop/computation/kvasir/data/output/more_genomes/')
    ls = kv.get_species_collections()
    print ls
    ls.remove('Arthrobacter_arilaitensis_Re117')
    pairs = []
    for pair in combinations(ls, 2):
        pairs.append((pair[0], pair[1]))
    plot_many(pairs)


    #     if os.path.isfile('{}_{}.pdf'.format(pair[0], pair[1])):
    #         continue
    #     try:
    #         output_loc_hist(pair[0], pair[1])
    #     except RuntimeError:
Exemplo n.º 4
0
#!/usr/bin/env python
# by Kevin Bonham, PhD (2015)
# for Dutton Lab, Harvard Center for Systems Biology, Cambridge MA
# Unless otherwise indicated, licensed under GNU Public License (GPLv3)

import sys
import KvDataStructures as kv

kv.mongo_init(sys.argv[1])
kv.reset_database(kv.db.name)