当前位置: 首页>>代码示例>>Python>>正文


Python PassingData.no_of_total_accessions_filtered方法代码示例

本文整理汇总了Python中pymodule.PassingData.no_of_total_accessions_filtered方法的典型用法代码示例。如果您正苦于以下问题:Python PassingData.no_of_total_accessions_filtered方法的具体用法?Python PassingData.no_of_total_accessions_filtered怎么用?Python PassingData.no_of_total_accessions_filtered使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pymodule.PassingData的用法示例。


在下文中一共展示了PassingData.no_of_total_accessions_filtered方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get_qccall_results

# 需要导入模块: from pymodule import PassingData [as 别名]
# 或者: from pymodule.PassingData import no_of_total_accessions_filtered [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_accessions_filtered方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。