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


Python FileHandlers.get_file_name方法代码示例

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


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

示例1: __init__

# 需要导入模块: from util import FileHandlers [as 别名]
# 或者: from util.FileHandlers import get_file_name [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_outfile

# 需要导入模块: from util import FileHandlers [as 别名]
# 或者: from util.FileHandlers import get_file_name [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

示例3: _get_file_path

# 需要导入模块: from util import FileHandlers [as 别名]
# 或者: from util.FileHandlers import get_file_name [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

示例4: _get_data

# 需要导入模块: from util import FileHandlers [as 别名]
# 或者: from util.FileHandlers import get_file_name [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

示例5: _get_filename

# 需要导入模块: from util import FileHandlers [as 别名]
# 或者: from util.FileHandlers import get_file_name [as 别名]
 def _get_filename(self):
     file_handlers = FileHandlers()
     file_paths = file_handlers.search_directory()
     pdb_files = file_handlers.find_files(file_paths, "pdb")
     if self.tag == "":
         for pdb_file in pdb_files:
             if self.filename == file_handlers.get_file_name(pdb_file).split(".")[0]:
                 return file_handlers.get_file_name(pdb_file).split(".")[0]
     else:
         for pdb_file in pdb_files:
             if (self.filename + self.tag) == file_handlers.get_file_name(pdb_file).split(".")[0]:
                 return file_handlers.get_file_name(pdb_file).split(".")[0]
开发者ID:kata9238,项目名称:bioverse,代码行数:14,代码来源:jmol_spt_writer.py

示例6: _get_filepath

# 需要导入模块: from util import FileHandlers [as 别名]
# 或者: from util.FileHandlers import get_file_name [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

示例7: _get_downloaded_file_path

# 需要导入模块: from util import FileHandlers [as 别名]
# 或者: from util.FileHandlers import get_file_name [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

示例8: main

# 需要导入模块: from util import FileHandlers [as 别名]
# 或者: from util.FileHandlers import get_file_name [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: build_SASA_dict

# 需要导入模块: from util import FileHandlers [as 别名]
# 或者: from util.FileHandlers import get_file_name [as 别名]
def build_SASA_dict(out_files):
	SASA_dict = {}
	for path in out_files:
		file_handlers = FileHandlers()
		file_name = file_handlers.get_file_name(path)
		SASA_dict[file_name] = {}
		for line in open(path):
			file_handlers2 = FileHandlers()
			fields = line.split('\t')
			cleaned = file_handlers2.clean(fields)
			if len(cleaned) == 9: #and int(cleaned[2]) >= 1:
				(position, 
				aa, 
				tot_SA, 
				SASA, 
				frac_SASA, 
				phob, 
				phil) = (cleaned[2],
						cleaned[0],
						cleaned[8],
						cleaned[5],
						cleaned[6],
						cleaned[3],
						cleaned[4])
				SASA_dict[file_name][position] = [aa, 
													tot_SA, 
													SASA, 
													frac_SASA, 
													phob, 
													phil]
	return SASA_dict
开发者ID:Hockstad,项目名称:design_pipeline,代码行数:33,代码来源:find_surface_res.py

示例10: __init__

# 需要导入模块: from util import FileHandlers [as 别名]
# 或者: from util.FileHandlers import get_file_name [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

示例11: main

# 需要导入模块: from util import FileHandlers [as 别名]
# 或者: from util.FileHandlers import get_file_name [as 别名]
def main():
	## THIS WORKED, DON'T ERASE
	## Save organism data to pickled dictionary
	#pickle_fasta = PickleFasta()
	#fasta_dictionary = pickle_fasta.pickle_organism_fasta()
	#print "There are %d entries in the fasta_dictionary" % len(fasta_dictionary)
	#pickle.dump(fasta_dictionary, open('organism_dictionary.pkl', 'wb'))
	
	file_handlers = FileHandlers()
	dm_files = get_dm_files()

	# Load the dictionary back from the pickle file
	print "Loading fasta_dictionary..."
	open_fasta = open('organism_dictionary.pkl', 'rb')
	fasta_dictionary = pickle.load(open_fasta)
	open_fasta.close()
	print "Length of fasta dictionary: ", len(fasta_dictionary)

	## THIS WORKED, DON'T ERASE
	## Build mapping dictionary and pickle
	dm_processing = dmDictionary()
	dm_processing.init_mapping_dictionary(fasta_dictionary)
	for path in dm_files:
		file_name = file_handlers.get_file_name(path)
		print "Opening %s..." % file_name
		dm_dictionary = dm_processing.individual_dm_dictionary(path, file_name)
		print "Length of dm_dictionary for %s is %d" % (file_name, len(dm_dictionary))
		mapping_dictionary = dm_processing.build_mapping_dictionary(fasta_dictionary, dm_dictionary)
	
	open_mapping = open('mapping_dictionary.pkl', 'wb')
	pickle.dump(mapping_dictionary, open_mapping)
	open_mapping.close()
	print mapping_dictionary
开发者ID:AndreaEdwards,项目名称:phylogenetics_analysis_tools,代码行数:35,代码来源:fix_names.py

示例12: _get_pdb_file_path

# 需要导入模块: from util import FileHandlers [as 别名]
# 或者: from util.FileHandlers import get_file_name [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

示例13: main

# 需要导入模块: from util import FileHandlers [as 别名]
# 或者: from util.FileHandlers import get_file_name [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

示例14: _get_pdb

# 需要导入模块: from util import FileHandlers [as 别名]
# 或者: from util.FileHandlers import get_file_name [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

示例15: _open_file

# 需要导入模块: from util import FileHandlers [as 别名]
# 或者: from util.FileHandlers import get_file_name [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


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