Example #1
0
class Test(BT.BiskitTest):
    """DSSP test"""

    TAGS = [BT.EXE]

    def prepare(self):
        self.f = T.testRoot()+"/com/1BGS.pdb"


    def test_DSSP( self ):
        """DSSP test"""

        from Biskit import PDBModel

        if self.local: print 'Loading PDB...'
        self.m = PDBModel(self.f)
        self.m = self.m.compress( self.m.maskProtein() )

        if self.local:  print 'Starting DSSP'
        self.dssp = Dssp( self.m )

        if self.local: print 'Running DSSP'

        self.result = self.dssp.run()

        if self.local:
            print "Sequence :", self.m.sequence()
            print "Secondary:", self.result            

        self.assertEquals( self.result, self.EXPECTED)


    EXPECTED =  '.....SHHHHHHHHHHHSS..TTEE.HHHHHHHT..GGGT.HHHHSTT.EEEEEEE..TT..S...TT..EEEEE.S..SSS..S.EEEEETT..EEEESSSSSS.EE...EEEEETTT..SHHHHHHHHHHHHT..TT..SSHHHHHHHHHHT..SSEEEEEE.HHHHHHHTTTTHHHHHHHHHHHHHHT..EEEEE.'
Example #2
0
class Test(BT.BiskitTest):
    """DSSP test"""

    TAGS = [BT.EXE]

    def prepare(self):
        self.f = T.testRoot() + "/com/1BGS.pdb"

    def test_DSSP(self):
        """DSSP test"""

        from Biskit import PDBModel

        if self.local: print 'Loading PDB...'
        self.m = PDBModel(self.f)
        self.m = self.m.compress(self.m.maskProtein())

        if self.local: print 'Starting DSSP'
        self.dssp = Dssp(self.m, verbose=self.local, debug=self.DEBUG)

        if self.local: print 'Running DSSP'

        self.result = self.dssp.run()

        if self.local:
            print "Sequence :", self.m.sequence()
            print "Secondary:", self.result

        self.assertEquals(self.result, self.EXPECTED)

    EXPECTED = '.....SHHHHHHHHHHHSS..TTEE.HHHHHHHT..GGGT.HHHHSTT.EEEEEEE..TT..S...TT..EEEEE.S..SSS..S.EEEEETT..EEEESSSSSS.EE...EEEEETTT..SHHHHHHHHHHHHT..TT..SSHHHHHHHHHHT..SSEEEEEE.HHHHHHHTTTTHHHHHHHHHHHHHHT..EEEEE.'
Example #3
0
class Test(BT.BiskitTest):
    """DSSP test"""

    TAGS = [BT.EXE]

    def prepare(self):
        self.f = T.testRoot() + "/com/1BGS.pdb"

    def generic_test(self, pdb, expected=None, proteinonly=False):
        """generic DSSP test"""

        from Biskit import PDBModel

        if self.local: print 'Loading PDB...'
        self.m = PDBModel(pdb)

        if proteinonly:
            self.m = self.m.compress(self.m.maskProtein())

        if self.local: print 'Starting DSSP'
        self.dssp = Dssp(self.m, verbose=self.local, debug=self.DEBUG)

        if self.local: print 'Running DSSP'

        self.result = self.dssp.run()

        if self.local:
            print "Sequence :", self.m.sequence()
            print "Secondary:", self.result

        if expected:
            self.assertEquals(self.result, expected)

    EXPECTED = '.....SHHHHHHHHHHHSS..TTEE.HHHHHHHT..GGGT.HHHHSTT.EEEEEEE..TT..S...TT..EEEEE.S..SSS..S.EEEEETT..EEEESSSSSS.EE...EEEEETTT..SHHHHHHHHHHHHT..TT..SSHHHHHHHHHHT..SSEEEEEE.HHHHHHHTTTTHHHHHHHHHHHHHHT..EEEEE.'

    def test_DSSP(self):
        """DSSP test"""
        self.generic_test(self.f, expected=self.EXPECTED, proteinonly=True)

    def test_DSSP_2W3A(self):
        """DSSP test 2W3A"""
        self.generic_test('2W3A', proteinonly=True)

    def test_DSSP_1R4Q(self):
        """DSSP test"""
        self.generic_test('1R4Q', proteinonly=True)

    def test_DSSP_1AM7(self):
        self.generic_test('1AM7')

    def test_DSSP_5FB8(self):
        self.generic_test('5fb8')
Example #4
0
    def process_all( self, file_dic, keep_hetatoms=0 ):
        """
        Process PDB files in file_dic.
        The PDB is read from:
          - L{TemplateSearcher.F_NR}

        and cleaned files are written to:
          - L{F_CLEANED}
          - L{F_COFFEE}
          - L{F_MODELLER}

        If the file L{F_CLEANED} already exists, this file is
        used to write modeller and t-coffee pdbs.

        @param file_dic: dictionary mapping filenames of pdb files to
                         the chains of interest, e.g. { fname : chain_id, }
        @type  file_dic: {str:str}
        @param keep_hetatoms: keep hetatoms (default: 0)
        @type  keep_hetatoms: 0|1
        """
        fasta = ""
        c = None

        for f, id in file_dic.items():

            self.logWrite( '\nCLEANING ' + f + '...')

            try:
                code = string.split(f, '/')[-1][:4]

                ## clean to standard PDB
                c = PDBCleaner( f, self.log )

                ## if /templates/nr_cleaned/pfb-file exists
                if os.path.exists(
                    self.outFolder+self.F_CLEANED + code + '.pdb' ):

                    model = PDBModel( self.outFolder+self.F_CLEANED \
                                      + code + '.pdb' )

                ## read pdb from /templates/nr
                else:
                    model = c.process( keep_hetatoms=keep_hetatoms )

                    ## write complete cleaned PDB
                    model.writePdb( self.outFolder+self.F_CLEANED \
                                    + code + '.pdb')

                code = model.pdbCode
                title = code + '_' + id

                ## extract needed chain
                if len( id ) > 0:
                    model = self.__chain_by_id( model, id )

                fname =  "%s%s.pdb" % (self.outFolder + self.F_MODELLER, title)
                self.write_modeller_pdb( model, fname )

                ## write T_coffee CA trace with res sequence
                fname = "%s%s.alpha"%(self.outFolder + self.F_COFFEE, title)
                self.write_tcoffee_pdb( model, fname )

                ## append fasta
                fasta += self.fasta_sequence( title, model.sequence() )

            except:
                self.logWrite( 'Error cleaning ' + f)
                self.logWrite( T.lastError() )
                self.err_cleaner = c
                self.err_file = f

        fasta_out = open( self.outFolder + self.F_FASTA, 'w' )
        fasta_out.write( fasta )
        fasta_out.close()
Example #5
0
    Syntax pdb2seq.py |pdb_file|
    """

def printSequence( header, s ):

    n_chunks = len( s ) / 80

    print ">%s" % header 

    for i in range(0, n_chunks+1):

        if i * 80 + 80 < len( s ):
            chunk = s[i * 80 : i * 80 + 80]
        else:
            chunk = s[i * 80 :]

        print chunk


if __name__ == '__main__':

    if len( sys.argv ) < 1:
        _use()

    m = PDBModel( sys.argv[1] )

    seq = m.sequence()

    printSequence( m.pdbCode, seq )
Example #6
0
class Test(BT.BiskitTest):
    """DSSP test"""

    TAGS = [BT.EXE]

    def prepare(self):
        self.f = T.testRoot()+"/com/1BGS.pdb"
        
    def generic_test(self, pdb, expected=None, proteinonly=False):
        """generic DSSP test"""

        from Biskit import PDBModel

        if self.local: print 'Loading PDB...'
        self.m = PDBModel(pdb)
        
        if proteinonly:
            self.m = self.m.compress( self.m.maskProtein() )

        if self.local:  print 'Starting DSSP'
        self.dssp = Dssp( self.m, verbose=self.local, debug=self.DEBUG )

        if self.local: print 'Running DSSP'

        self.result = self.dssp.run()  ## returns modified PDBModel
        self.result = self.result.compress( self.result.maskProtein() )
        self.result = ''.join(self.result['dssp'])

        if self.local:
            print "Sequence :", self.m.sequence()
            print "Secondary:", self.result            
        
        if expected:
            self.assertEquals( self.result, expected)        


    EXPECTED =  '.....SHHHHHHHHHHHSS..TTEE.HHHHHHHT..GGGT.HHHHSTT.EEEEEEE..TT..S...TT..EEEEE.S..SSS..S.EEEEETT..EEEESSSSSS.EE...EEEEETTT..SHHHHHHHHHHHHT..TT..SSHHHHHHHHHHT..SSEEEEEE.HHHHHHHTTTTHHHHHHHHHHHHHHT..EEEEE.'
    def test_DSSP( self ):
        """DSSP test"""
        self.generic_test(self.f, expected=self.EXPECTED, proteinonly=False)

    def test_DSSP_2W3A( self ):
        """DSSP test 2W3A"""
        self.generic_test('2W3A', proteinonly=False)

    def test_DSSP_3TGI( self ):
        """DSSP test 3TGI"""
        ## handling of residues with insertion code (184A, 186A, 221A)
        self.generic_test('3TGI', proteinonly=False)

    def test_DSSP_1R4Q( self ):
        """DSSP test"""
        self.generic_test('1R4Q', proteinonly=False)    

    def test_DSSP_1AM7(self):
        self.generic_test('1AM7')

    def test_DSSP_5FB8(self):
        self.generic_test('5fb8')
        
    def test_DSSP_3j4q(self):
        self.generic_test(T.testRoot('dssp') + '/3j4q.pdb')
Example #7
0
    Syntax pdb2seq.py |pdb_file|
    """

def printSequence( header, s ):

    n_chunks = len( s ) / 80

    print ">%s" % header 

    for i in range(0, n_chunks+1):

        if i * 80 + 80 < len( s ):
            chunk = s[i * 80 : i * 80 + 80]
        else:
            chunk = s[i * 80 :]

        print chunk


if __name__ == '__main__':

    if len( sys.argv ) < 1:
        _use()

    m = PDBModel( sys.argv[1] )

    seq = m.sequence()

    printSequence( m.pdbCode, seq )