當前位置: 首頁>>代碼示例>>Python>>正文


Python PassingData.no_of_total_snps_removed方法代碼示例

本文整理匯總了Python中pymodule.PassingData.no_of_total_snps_removed方法的典型用法代碼示例。如果您正苦於以下問題:Python PassingData.no_of_total_snps_removed方法的具體用法?Python PassingData.no_of_total_snps_removed怎麽用?Python PassingData.no_of_total_snps_removed使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在pymodule.PassingData的用法示例。


在下文中一共展示了PassingData.no_of_total_snps_removed方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: get_qccall_results

# 需要導入模塊: from pymodule import PassingData [as 別名]
# 或者: from pymodule.PassingData import no_of_total_snps_removed [as 別名]
	def get_qccall_results(self, input_dir):
		import os,sys,csv
		from variation.src.MpiQCCall import MpiQCCall
		from pymodule import PassingData
		"""
		var_name_ls = ['strain or snp', 'after_imputation'] + MpiQCCall.common_var_name_ls
		avg_var_name_pair_ls, partial_header_avg = MpiQCCall.generate_avg_variable_names(MpiQCCall.avg_var_name_ls)
		var_name_ls += partial_header_avg
		"""
		files = os.listdir(input_dir)
		passingdata_ls = []
		no_of_objects = len(files)
		var_name_ls = []
		for i in range(no_of_objects):
			sys.stderr.write("\t%d/%d: from %s ... \n"%(i+1, no_of_objects, files[i]))
			filename = os.path.join(input_dir, files[i])
			reader = csv.reader(open(filename))
			try:
				row = reader.next()
				if len(var_name_ls)==0:
					var_name_ls = row
			except:
				if self.debug:
					import traceback
					traceback.print_exc()
	  				sys.stderr.write('%s\n'%sys.exc_info())
	  			sys.stderr.write('\terror in reading this file. ignored.\n')
	  			del reader
				continue
			for row in reader:
				passingdata = PassingData()
				for i in range(len(var_name_ls)):
					var_name = var_name_ls[i]
					if var_name!='strain or snp':
						value = float(row[i])
					else:	#the first column is strain or snp, no float conversion
						value = row[i]
					setattr(passingdata, var_name, value)	#
				#two new variables record no of accessions/snps lost
				passingdata.no_of_total_accessions_filtered = passingdata.no_of_accessions_filtered_by_mismatch + passingdata.no_of_accessions_filtered_by_na
				passingdata.no_of_total_snps_filtered = passingdata.no_of_snps_filtered_by_mismatch +\
					passingdata.no_of_snps_filtered_by_na
				passingdata.no_of_total_snps_removed = passingdata.no_of_total_snps_filtered +\
					passingdata.no_of_monomorphic_snps_removed
				
				passingdata_ls.append(passingdata)
			del reader
		return passingdata_ls, var_name_ls
開發者ID:,項目名稱:,代碼行數:50,代碼來源:


注:本文中的pymodule.PassingData.no_of_total_snps_removed方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。