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


Python FileHandlers.find_files方法代码示例

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


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

示例1: __init__

# 需要导入模块: from util import FileHandlers [as 别名]
# 或者: from util.FileHandlers import find_files [as 别名]
 def __init__(self, pdb_code, sequence_annotations, SurfRes=False,
              pocket=False, lpocket=False):
     self.filename = pdb_code
     self.sequence_annotations = sequence_annotations
     if SurfRes:
         file_handlers = FileHandlers()
         file_paths = file_handlers.search_directory()
         txt_files = file_handlers.find_files(file_paths, 'txt')
         for txt_file in txt_files:
             if (self.filename + '_SurfRes.txt') == \
                     file_handlers.get_file_name(txt_file):
                 self.surfres_file = txt_file
             else:
                 self.surfres_file = ''
     if pocket:
         file_handlers = FileHandlers()
         file_paths = file_handlers.search_directory()
         txt_files = file_handlers.find_files(file_paths, 'txt')
         for txt_file in txt_files:
             if (self.filename + '_pocketres.txt') == \
                     file_handlers.get_file_name(txt_file):
                 self.pocketres_file = txt_file
             else:
                 self.pocketres_file = ''
     if lpocket:
         file_handlers = FileHandlers()
         file_paths = file_handlers.search_directory()
         txt_files = file_handlers.find_files(file_paths, 'txt')
         for txt_file in txt_files:
             if (self.filename + '_lpocket.txt') == \
                     file_handlers.get_file_name(txt_file):
                 self.lpocket_file = txt_file
             else:
                 self.lpocket_file = ''
开发者ID:kata9238,项目名称:bioverse,代码行数:36,代码来源:highlight_targets.py

示例2: _get_filepath

# 需要导入模块: from util import FileHandlers [as 别名]
# 或者: from util.FileHandlers import find_files [as 别名]
	def _get_filepath(self, data_file=False, pdb_file=False):
		file_handlers = FileHandlers()
		file_paths = file_handlers.search_directory()
		if data_file == True:
			files = file_handlers.find_files(file_paths, 'txt')
			for path in files:
				if (self.filename + '_mutant_list') == file_handlers.get_file_name(path).split('.')[0]:
					return path
		elif pdb_file == True:
			files = file_handlers.find_files(file_paths, 'pdb')
			for path in files:
				if (self.filename + '_0001') == file_handlers.get_file_name(path).split('.')[0]:
					return path
		else:
			print "Specify file type"
开发者ID:cierrajanewalker,项目名称:design_pipeline,代码行数:17,代码来源:pdb.py

示例3: _get_pdb_file_path

# 需要导入模块: from util import FileHandlers [as 别名]
# 或者: from util.FileHandlers import find_files [as 别名]
	def _get_pdb_file_path(self):
		file_handlers = FileHandlers()
		file_paths = file_handlers.search_directory()
		pdb_files = file_handlers.find_files(file_paths, 'pdb')
		for pdb_file in pdb_files:
			if (self.filename + '_0001') == file_handlers.get_file_name(pdb_file).split('.')[0]:
				self.file_path = pdb_file
开发者ID:AndreaEdwards,项目名称:design_pipeline,代码行数:9,代码来源:seq.py

示例4: main

# 需要导入模块: from util import FileHandlers [as 别名]
# 或者: from util.FileHandlers import find_files [as 别名]
def main():
    file_handlers = FileHandlers()
    file_paths = file_handlers.search_directory()
    pep_files = file_handlers.find_files(file_paths, "pep")
    for pep_file in pep_files:
        file_name = file_handlers.get_file_name(pep_file)
        run_muscle(pep_file, file_name)
开发者ID:AndreaEdwards,项目名称:phylogenetics_analysis_tools,代码行数:9,代码来源:run_muscle.py

示例5: _get_downloaded_file_path

# 需要导入模块: from util import FileHandlers [as 别名]
# 或者: from util.FileHandlers import find_files [as 别名]
	def _get_downloaded_file_path(self, pdb_code):
		file_handlers = FileHandlers()
		file_paths = file_handlers.search_directory()
		ent_files = file_handlers.find_files(file_paths, 'ent')
		for ent_file in ent_files:
			if pdb_code == file_handlers.get_file_name(ent_file).split('.')[0].lstrip('pdb').upper():
				return ent_file
开发者ID:cierrajanewalker,项目名称:design_pipeline,代码行数:9,代码来源:pdb.py

示例6: __init__

# 需要导入模块: from util import FileHandlers [as 别名]
# 或者: from util.FileHandlers import find_files [as 别名]
class PickleFasta:
	def __init__(self):
		self.file_handlers = FileHandlers()

	def _get_fasta_files(self):
		file_paths = self.file_handlers.search_directory()
		fasta_files = self.file_handlers.find_files(file_paths, 'faa')
		print "There are %d .faa files in this directory" % len(fasta_files)
		return fasta_files

	def pickle_organism_fasta(self):
		fasta_files = self._get_fasta_files()
		fasta_dictionary = {}
		for fasta_file in fasta_files:
			file_name = self.file_handlers.get_file_name(fasta_file)
			name_list = file_name.split('.')
			Data = open(fasta_file)
			D = Data.readlines()
			Data.close()
			for d in D:
				if d.startswith('>'):
					d_list = d.split(' ')
					if name_list[0] in fasta_dictionary:
						fasta_dictionary[name_list[0]].append(d_list[0].lstrip('>'))
					else:
						fasta_dictionary[name_list[0]] = [d_list[0].lstrip('>')]
				else:
					pass
		return fasta_dictionary
开发者ID:AndreaEdwards,项目名称:phylogenetics_analysis_tools,代码行数:31,代码来源:fix_names.py

示例7: main

# 需要导入模块: from util import FileHandlers [as 别名]
# 或者: from util.FileHandlers import find_files [as 别名]
def main():
	file_handlers = FileHandlers()
	file_paths = file_handlers.search_directory()
	fasta_files = file_handlers.find_files(file_paths, 'fasta')
	for path in fasta_files:
		file_name, file_list, interval = find_indices(path)
		write_fasta_new_names(path, file_name, file_list, interval)
开发者ID:AndreaEdwards,项目名称:CAZy_phylogenetics,代码行数:9,代码来源:analysis_v4.py

示例8: main

# 需要导入模块: from util import FileHandlers [as 别名]
# 或者: from util.FileHandlers import find_files [as 别名]
def main():
	file_handlers = FileHandlers()
	file_paths = file_handlers.search_directory()
	fasta_files = file_handlers.find_files(file_paths, 'fasta')
	for path in fasta_files:
		file_name = file_handlers.get_file_name(path)
		get_dm_raxml(path, file_name, 4)
开发者ID:AndreaEdwards,项目名称:phylogenetics_analysis_tools,代码行数:9,代码来源:run_raxml_dm_calulator.py

示例9: _get_outfile

# 需要导入模块: from util import FileHandlers [as 别名]
# 或者: from util.FileHandlers import find_files [as 别名]
 def _get_outfile(self):
     file_handlers = FileHandlers()
     file_paths = file_handlers.search_directory()
     out_files = file_handlers.find_files(file_paths, 'out')
     if (self.pdb_code != '' and self.psiblast != ''):
         for out_file in out_files:
             if (self.pdb_code + '_mutants') == \
                     file_handlers.get_file_name(out_file).split('.')[0]:
                 self.ddG_results_filepath = out_file
             elif (self.psiblast + '_mutants') == \
                     file_handlers.get_file_name(out_file).split('.')[0]:
                 self.llikelihood_filepath = out_file
     elif (self.pdb_code != '' and self.psiblast == ''):
         for out_file in out_files:
             if (self.pdb_code + '_mutants') == \
                     file_handlers.get_file_name(out_file).split('.')[0]:
                 self.ddG_results_filepath = out_file
                 print "Fetching data from %s ....." % \
                     file_handlers.get_file_name(out_file)
     elif (self.pdb_code == '' and self.psiblast != ''):
         for out_file in out_files:
             if (self.psiblast + '_mutants') == \
                     file_handlers.get_file_name(out_file).split('.')[0]:
                 self.llikelihood_filepath = out_file
     else:
         print "You have not specified any results data to parse."
         exit(1)
开发者ID:kata9238,项目名称:bioverse,代码行数:29,代码来源:seq.py

示例10: _open_file

# 需要导入模块: from util import FileHandlers [as 别名]
# 或者: from util.FileHandlers import find_files [as 别名]
	def _open_file(self):
		#os.chdir("../src/database/pdbs")
		file_handlers = FileHandlers()
		file_paths = file_handlers.search_directory()
		pdb_files = file_handlers.find_files(file_paths, 'pdb')
		for pdb_file in pdb_files:
			if self.filename == file_handlers.get_file_name(pdb_file).split('.')[0]:
				Data = open(pdb_file)
				self.data = Data.readlines()
				Data.close
开发者ID:Hockstad,项目名称:design_pipeline,代码行数:12,代码来源:pdb.py

示例11: _get_output

# 需要导入模块: from util import FileHandlers [as 别名]
# 或者: from util.FileHandlers import find_files [as 别名]
	def _get_output(self):
		file_handlers = FileHandlers()
		file_paths = file_handlers.search_directory()
		out_files = file_handlers.find_files(file_paths, 'out')
		for out_file in out_files:
			TXT = open(out_file)
			data = TXT.readlines()
			TXT.close()
		os.remove(out_file)
		return data
开发者ID:cierrajanewalker,项目名称:design_pipeline,代码行数:12,代码来源:pdb.py

示例12: _get_pdb

# 需要导入模块: from util import FileHandlers [as 别名]
# 或者: from util.FileHandlers import find_files [as 别名]
	def _get_pdb(self):
		#os.chdir("./database/pdbs/pdb")
		file_handlers = FileHandlers()
		file_paths = file_handlers.search_directory()
		pdb_files = file_handlers.find_files(file_paths, 'pdb')
		for pdb_file in pdb_files:
			if self.filename == file_handlers.get_file_name(pdb_file).split('.')[0]:
				PDB = open(pdb_file)
				self.pdb = PDB.readlines()
				PDB.close()
开发者ID:cierrajanewalker,项目名称:design_pipeline,代码行数:12,代码来源:pdb.py

示例13: _get_data

# 需要导入模块: from util import FileHandlers [as 别名]
# 或者: from util.FileHandlers import find_files [as 别名]
	def _get_data(self, file_tag):
		file_handlers = FileHandlers()
		file_paths = file_handlers.search_directory()
		txt_files = file_handlers.find_files(file_paths, 'txt')
		for txt_file in txt_files:
			if self.filename == file_handlers.get_file_name(txt_file).split('_')[0]:
				if (file_tag.split('_')[1] + '.txt') == file_handlers.get_file_name(txt_file).split('_')[1]:
					TXT = open(txt_file)
					self.data = TXT.readlines()
					TXT.close()
开发者ID:cierrajanewalker,项目名称:design_pipeline,代码行数:12,代码来源:pdb.py

示例14: _get_file_path

# 需要导入模块: from util import FileHandlers [as 别名]
# 或者: from util.FileHandlers import find_files [as 别名]
	def _get_file_path(self):
		os.chdir("./database/pdbs/pdb")
		file_handlers = FileHandlers()
		file_paths = file_handlers.search_directory()
		pdb_files = file_handlers.find_files(file_paths, 'pdb')
		for pdb_file in pdb_files:
			if (self.filename + '_0001') == file_handlers.get_file_name(pdb_file).split('.')[0]:
				self.file_path = pdb_file
				self.out_file = file_handlers.get_file_name(pdb_file).split('.')[0] + '_pops.out'
				self.out_file_path = self.dir_path + '/' + self.out_file
开发者ID:cierrajanewalker,项目名称:design_pipeline,代码行数:12,代码来源:pdb.py

示例15: _get_data

# 需要导入模块: from util import FileHandlers [as 别名]
# 或者: from util.FileHandlers import find_files [as 别名]
	def _get_data(self, filename):
		file_handlers = FileHandlers()
		file_paths = file_handlers.search_directory()
		txt_files = file_handlers.find_files(file_paths, 'txt')
		for txt_file in txt_files:
			if filename == file_handlers.get_file_name(txt_file):
				TXT = open(txt_file)
				data = TXT.readlines()
				TXT.close()
		return data
开发者ID:AndreaEdwards,项目名称:design_pipeline,代码行数:12,代码来源:stats.py


注:本文中的util.FileHandlers.find_files方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。