def get_all_reads(filename): stream = subprocess.Popen(["DBshow", filename], stdout=subprocess.PIPE, bufsize=1) reads = parse_read(stream.stdout) # generator return reads
#for node in in_graph.nodes(): # print node #for edge in in_graph.edges(): # print len(in_graph.edge[edge[0]][edge[1]]) reads = sorted( list(set([int(x.split("_")[0].lstrip("B")) for x in in_graph.nodes()]))) dbshow_reads = ' '.join([str(x + 1) for x in reads]) DBshow_cmd = "DBshow " + filedir + '/' + filename + ' ' + dbshow_reads stream = subprocess.Popen(DBshow_cmd.split(), stdout=subprocess.PIPE, bufsize=1) reads_queried = parse_read(stream.stdout) read_dict = {} for read_id, read in itertools.izip(reads, reads_queried): rdlen = len(read[1]) # print read read_dict[read_id] = read # to simulate reads # read_dict = {} # for vertex in in_graph.nodes(): # read_dict[int(vertex.split('_')[0])] = ['A','A'*50000] complement = { 'A': 'T', 'C': 'G',
def get_reads(filename, readlist): stream = subprocess.Popen(["DBshow", filename] + map(str, readlist), stdout=subprocess.PIPE, bufsize=1) reads = parse_read(stream.stdout) # generator return reads
import itertools NCTCname = sys.argv[1] filename = '/data/pacbio_assembly/pb_data/NCTC/'+NCTCname+'/'+NCTCname graphml_path = sys.argv[2] in_graph = nx.read_graphml(graphml_path) reads = sorted(list(set([int(x.split("_")[0].lstrip("B")) for x in in_graph.nodes()]))) dbshow_reads = ' '.join([str(x+1) for x in reads]) DBshow_cmd = "DBshow "+filename+' '+dbshow_reads stream = subprocess.Popen(DBshow_cmd.split(), stdout=subprocess.PIPE,bufsize=1) reads_queried = parse_read(stream.stdout) read_dict = {} for read_id,read in itertools.izip(reads,reads_queried): rdlen = len(read[1]) # print read read_dict[read_id] = read complement = {'A':'T','C': 'G','T':'A', 'G':'C','a':'t','t':'a','c':'g','g':'c'} def reverse_complement(string): return "".join(map(lambda x:complement[x],reversed(string))) def get_string(path): #print path ret_str = '' for itm in path:
#!/usr/bin/env python import sys import os import subprocess from parse_read import * filename = sys.argv[1] readarg = sys.argv[2] stream = subprocess.Popen(["DBshow", filename, readarg], stdout=subprocess.PIPE, bufsize=1) reads = parse_read(stream.stdout) # generator for read in reads: print read #print result
#!/usr/bin/env python import sys import os import subprocess from parse_read import * filename = sys.argv[1] readarg = sys.argv[2] stream = subprocess.Popen(["DBshow", filename ,readarg], stdout=subprocess.PIPE,bufsize=1) reads = parse_read(stream.stdout) # generator for read in reads: print read #print result
def get_all_reads(filename): stream = subprocess.Popen(["DBshow", filename], stdout=subprocess.PIPE,bufsize=1) reads = parse_read(stream.stdout) # generator return reads
def get_reads(filename, readlist): stream = subprocess.Popen(["DBshow", filename] + map(str,readlist), stdout=subprocess.PIPE,bufsize=1) reads = parse_read(stream.stdout) # generator return reads