Rosetta
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
sequence.py
Go to the documentation of this file.
1 #!/usr/bin/python
2 
3 # (c) Copyright Rosetta Commons Member Institutions.
4 # (c) This file is part of the Rosetta software suite and is made available under license.
5 # (c) The Rosetta software is developed by the contributing members of the Rosetta Commons.
6 # (c) For more information, see http://www.rosettacommons.org. Questions about this can be
7 # (c) addressed to University of Washington UW TechTransfer, email: license@u.washington.edu.
8 
9 ## @file /GUIs/pyrosetta_toolkit/modules/tools/sequence.py
10 ## @brief general sequence tools for the toolkit- To be replaced by region class
11 ## @author Jared Adolf-Bryfogle (jadolfbr@gmail.com)
12 
13 
14 from rosetta import *
15 import loops
16 
17 def get_sequence(pose, loop_string):
18  """
19  Returns the sequence of the loop string.
20  Works on just chain, or N ter and C ter residues.
21  """
22 
23  if pose.total_residue()==0:
24  return ""
25  residue_array = loops.return_residue_array(pose, loop_string)
26  if not residue_array:return
27 
28  x = pose.sequence()
29  seq = ""
30  for num in residue_array:
31  seq = seq+x[num-1]
32  if seq=="I":
33  print "Region does not exist in PDB"
34  return
35  if seq=="":
36  seq = pose.sequence()
37  return seq