Heim  >  Artikel  >  Backend-Entwicklung  >  Pthon批量处理将pdb文件生成dssp文件

Pthon批量处理将pdb文件生成dssp文件

WBOY
WBOYOriginal
2016-06-10 15:10:191881Durchsuche
# -*- coding: utf-8 -*-
"""
Created on Sat Jun 20 19:36:34 2015

@author: chaofn
"""
import os

"""
这个程序的目的是将linux下/ifs/home/fanchao/Manesh_pdb目录中的所有文件(一共有215个文件)
批处理
将pdb文件生成dssp文件

"""
#listdir返回文件名的列表
fileLine=os.listdir('/ifs/home/fanchao/Manesh_pdb')
#遍历整个列表
for i in range(len(fileLine)-1):
  #将字符串用变量表示
  input_file='/ifs/home/fanchao/Manesh_pdb/'+fileLine[i]
  #先去掉文件名的后缀,然后形成后缀为dssp的文件名
  out_file=fileLine[i].split('.')[0]+'.dssp'
  output_file='/ifs/home/fanchao/Manesh_dssp/'+out_file
  #注意:参数的传递(先是%s,然后是%变量名),多个变量的传入要用元组表示,在元组前用%
  os.system('/ifs/share/lib/dssp/dssp2 -i %s -o %s' %(input_file,output_file))

Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn