示例#1
0
	writer_vir.writerow(['partition'] + ['alignment','alignment length']*10)
	f_counts = open(inputdir+'partition_read_counts_by_sample.csv','w')
	writer_counts = csv.writer(f_counts)
	writer_counts.writerow(['partition']+Sample_ids)
	f_genus = open(inputdir+'partition_abundance_genus.csv','w')
	writer_genus = csv.writer(f_genus)
	Genus = defaultdict(int)
	PGenus = {}
	f_family = open(inputdir+'partition_abundance_family.csv','w')
	writer_family = csv.writer(f_family)
	Family = defaultdict(int)
	PFamily = {}
	FP = glob.glob(os.path.join(inputdir+'cluster_vectors/','*.cluster.npy'))
	Clusters = [fp[fp.rfind('/')+1:fp.index('.npy')] for fp in FP]
	for c in Clusters:
		hashobject.assembly_loc = hashobject.output_path+c+'_velvet/'
		try:
			asbly = hashobject.assembly_stats(c)
		except:
			asbly = {}
		try:
			algn = hashobject.alignment_stats(c)
			algn = sorted(algn.iteritems(),key=itemgetter(1),reverse=True)
			if len(algn) == 0:
				algn = [(None,0)]
		except:
			algn = [(None,0)]
		try:
			algn_v = hashobject.alignment_stats(c+'.viral')
			algn_v = sorted(algn_v.iteritems(),key=itemgetter(1),reverse=True)
			if len(algn_v) == 0: