Exemplo n.º 1
0
parser.add_argument('--depth',
                    type=int,
                    default=-1,
                    help='max paths depth (default len of baseline)')
parser.add_argument('--tails',
                    type=int,
                    default=5,
                    help='length of tails (default 5)')
parser.add_argument('--names_list',
                    type=str,
                    default='all',
                    help='names list txt file')

args = parser.parse_args()

graph = GenomeGraph()
graph.read_graph(args.input_file)

subgraph, aim_chain = graph.generate_subgraph(args.start,
                                              args.end,
                                              reference=args.reference,
                                              window=args.window,
                                              tails=args.tails,
                                              depth=args.depth)
f_out = open(args.outfile + '.sif', '+a')
f_freq = open(args.outfile + '_freq.sif', '+a')

in_aim = 0
is_ref = 0
for stamm in subgraph:
    print(stamm)
Exemplo n.º 2
0
for line in f:
    code = line.split(' ')[-1][:-3]
    name = ''.join(line.split(' ')[:-1])
    codes[code] = name

org = args.out_dir

files = os.listdir(org + '/')
if '.dump' not in ' '.join(files):
	print(org, end=' ')
	print('dumping...')
	
	
	try:
		g = GenomeGraph()
		g.read_graph(org + '/' + org + '.sif')
		dump_file = open(org + '/' + org + '.dump', 'wb')
		dump(g, dump_file)
	except:
		pass

	try:
		g = GenomeGraph()
		g.read_graph(org + '/' + org + '_pars.sif')
		dump_file = open(org + '/' + org + '_pars.dump', 'wb')
		dump(g, dump_file)
	except:
		pass

	skip = os.path.isfile(org + '/' + org + '.db')
Exemplo n.º 3
0
                    if check_conservativity(
                            graph,
                            c[i + 1],
                            c[i + j - 1],
                            c,
                            c[i],
                            c[i + j],
                            depth=depth,
                            filter=filter) >= non_conservativity:
                        hits.append((graph.genes_decode[c[i]],
                                     graph.genes_decode[c[i + j]]))

            print('Hits:')
            print(hits)
            hits_sum += len(hits)
        print('--------------------')

    print('SUM: ' + str(hits_sum))


print('Input file: ' + args.input_file)
g = GenomeGraph()
g.read_graph(args.input_file, generate_freq=True)
find_smile_template(g,
                    allowed_deviating=args.ad,
                    non_conservativity=args.nc,
                    depth=args.d,
                    max_insertion_len=args.il,
                    filter=args.ip)
Exemplo n.º 4
0
    if args.dbpar != 'no':
        #pars table
        connect = sqlite3.connect(data_path + org + '/' + org + '_pars.db')
        c = connect.cursor()
        
        genome_codes = [q for q in c.execute('select genome_id,genome_code from genomes_table')]

        for code in genome_codes:
            for ref_code in codes:
                if ref_code in code[1]:
                    c.execute('update genomes_table set genome_name="' + codes[ref_code] + '" where genome_id=' + str(code[0]))

        connect.commit()
        connect.close()


    print('dumping...')
    g = GenomeGraph()
    g.read_graph('data/' + name + '/' + name + '.sif')
    dump_file = open('data/' + name + '/' + name + '.dump', 'wb')
    dump(g, dump_file)

    if args.dbpar != 'no':
    
        g = GenomeGraph()
        g.read_graph('data/' + name + '/' + name + '_pars.sif')
        dump_file = open('data/' + name + '/' + name + '_pars.dump', 'wb')
        dump(g, dump_file)    

Exemplo n.º 5
0
parser = argparse.ArgumentParser(prog='start.sh')
parser.add_argument('-i', '--input_file', default='no', type=str, help='input_file (Orthofinder file)')
parser.add_argument('-o', '--output_dir', default='STDOUT', type=str, help='Output directory')
parser.add_argument('--reference', type=str, default='auto', help='name of reference genome')
parser.add_argument('--window', type=int, default=20, help='Size of window (default is 20)')
parser.add_argument('--iterations', type=int, default=500, help='number of iterations in stat computing (default is 500)')
parser.add_argument('--genomes_list', type=str, default='all', help='genomes list txt file')
parser.add_argument('--min_depth', type=int, default=0, help='min length of deviating path (default is 0)')
parser.add_argument('--max_depth', type=int, default=200, help='max length of deviating path (default is 200)')
parser.add_argument('--save_db', type=str, default=None, help='db path')

args = parser.parse_args()


try:
    os.stat(args.output_dir)

except FileNotFoundError:
    os.mkdir(args.output_dir)

f_params = open(args.output_dir + '/params.txt', 'a+')
f_params.write('reference: ' + args.reference + '\n')
f_params.write('window: ' + str(args.window) + '\n')
f_params.write('iterations: ' + str(args.iterations) + '\n')

graph = GenomeGraph()

graph.read_graph(args.input_file, names_list=args.genomes_list)
graph.compute_subgraph_complexity(args.output_dir, args.reference, window=args.window, iterations=args.iterations, min_depth=args.min_depth, max_depth=args.max_depth, save_db=args.save_db)