コード例 #1
0
ファイル: compareProjects.py プロジェクト: jakesyl/cing
    def format(self): # pylint: disable=W0221
        header = sprintf('------------ Projects %s ------------', self.name)
        footer = '-'*len(header)
        return sprintf("""%s
entries: %s
ranges:  %s
%s""", header, self.entries.zap('name').format('%r '), self.ranges, footer )
コード例 #2
0
ファイル: ROGscore.py プロジェクト: jakesyl/cing
    def format(self): # pylint: disable=W0221
        return io.sprintf(
"""%s CingResult %s (%s) %s
comment   = %s
alternate = %s
valueList = %s
""",                   constants.dots, self.checkID, self.level, constants.dots,
                       self.comment, self.alternate, self.valueList
                      )
コード例 #3
0
ファイル: compareProjects.py プロジェクト: jakesyl/cing
def printRestraintScores( projects, stream=sys.stdout ):

    n = len(projects)
    if n == 0:
        return

#    print constants.dots20*(n+1)
#    print ' Restraints target', projects[0].target
#    print constants.dots20*(n+1)
#    print

    hlen=40

    printTitle('Restraint scores target '+projects.name, 110, stream)

    for p in projects:
        header = sprintf('%s project %-20s %s', '-'*hlen, p.name, '-'*hlen)
        fprintf( stream,'%s\n', header)

        if len(p.dihedrals)+len(p.distances) == 0:
            fprintf( stream,'%s\n%s\n\n',   "  No restraints",'-'*len(header))
            continue


        if len( p.distances ) > 0:
            fprintf( stream,    '%-25s %5s %5s %5s %5s %5s %5s   %-7s  %4s %4s %4s %4s    rmsd\n',
                   'DistanceRestraintLists', 'count', 'intra', 'seq', 'med', 'long', 'amb', 'ROG','low','>0.1','>0.3','>0.5'
                   )

            for r in p.distances:
                fprintf( stream,'  %-23s %5d %5d %5d %5d %5d %5d   %-7s  %4d %4d %4d %4d    %5.3f +- %5.3f\n',
                        r.name,
                        len(r), len(r.intraResidual), len(r.sequential), len(r.mediumRange), len(r.longRange), len(r.ambiguous),
                        r.rogScore,
                        r.violCountLower, r.violCount1, r.violCount3, r.violCount5,
                        r.rmsdAv, r.rmsdSd
                       )
            fprintf(stream, "\n")
        #end if
        if len(p.dihedrals) > 0:
            fprintf( stream,    '%-25s %5s %5s %5s %5s %5s %5s   %-7s  %4s %4s %4s %4s    rmsd\n',
                   'DihedralRestraintsLists', 'count', '','','','','', 'ROG','','>1','>3','>5',
                   )
            for r in p.dihedrals:
                fprintf( stream,'  %-23s %5s %5s %5s %5s %5s %5s   %-7s  %4s %4d %4d %4d    %5.3f +- %5.3f\n',
                        r.name,
                        len(r), '.', '.', '.', '.', '.',
                        r.rogScore, '.',
                        r.violCount1, r.violCount3, r.violCount5,
                        r.rmsdAv, r.rmsdSd
                       )
        #end if
        fprintf( stream,'%s\n\n',  '-'*len(header))
コード例 #4
0
ファイル: talosPlus.py プロジェクト: jakesyl/cing
    def __str__( self ):
        r = ''
        for col in self.table.columnDefs:
            if not col.hide:
                if self[col.name] == None:
                    dot=col.fmt.find('.')
                    if dot < 0:
                        fmt = col.fmt[:-1] + 's'
                    else:
                        fmt = col.fmt[0:dot] + 's'
                    #endif

                    r = r + fmt % (self.table.noneIndicator) + ' '
                else:
                    r = r + sprintf(col.fmt, self[ col.name ] ) + ' '
                #end if
            #end if
        #end for
        return r
コード例 #5
0
ファイル: compareProjects.py プロジェクト: jakesyl/cing
    def __init__(self, molecule, residueList):
        NTlist.__init__( self )
        self.molecule     = molecule

        for i in range(0,molecule.modelCount):
            mName = sprintf('%s_model_%d', molecule.name, i)
            m = PhiPsiModelList(mName, i )
            self.append( m )
        #end for

        # Assemble the phi,psi of the models from residueList
        for res in residueList:
#            if res and res.has_key('PHI') and res.has_key('PSI'):
            if res and res.has_key('PHI') and res.has_key('PSI') and res.has_key('Cb4N') and res.has_key('Cb4C'):
                for i in range(0,molecule.modelCount):
                    #print '>>', res, i,molecule.modelCount,len(res.PHI),len(res.PSI),len(res.Cb4N),len(res.Cb4C)
#                    self[i].append(res.PHI[i],res.PSI[i])
                    self[i].append(res.PHI[i],res.PSI[i],res.Cb4N[i],res.Cb4C[i])
                    self[i].last().residue = res
コード例 #6
0
ファイル: queeny.py プロジェクト: jakesyl/cing
 def format(self):
     return sprintf('%s (%1s) %-20s %-20s  L: %7.3f  U: %7.3f  (%7.3f)  H: %7.3f',
                    self, str(self.flagged)[0:1], self.atm1, self.atm2, self.lower, self.upper, self.upperChange, self.uncertainty)
コード例 #7
0
ファイル: talosPlus.py プロジェクト: jakesyl/cing
def exportShifts2TalosPlus( project, fileName=None):
    """Export shifts to TalosPlus format

    Return True on error including situation where no shifts were added to the file.

---------------------------------------------------

An example of the required shift table format is shown below. Complete examples can be found in the talos/shifts and talos/test directories. Specifically:

In the current version of TALOS/TALOS+, residue numbering must begin at 1.
The protein sequence should be given as shown, using one or more "DATA SEQUENCE" lines. Space characters in the sequence will be ignored. Use "c" for oxidized CYS (CB ~ 42.5 ppm) and "C" for reduced CYS (CB ~ 28 ppm) in both the sequence header and the shift table.
The table must include columns for residue ID, one-character residue name, atom name, and chemical shift.
The table must include a "VARS" line which labels the corresponding columns of the table.
The table must include a "FORMAT" line which defines the data type of the corresponding columns of the table.
Atom names are always given exactly as:
    HA       for H-alpha of all residues except glycine
    HA2      for the first H-alpha of glycine residues
    HA3      for the second H-alpha
    C        for C' (CO)
    CA       for C-alpha
    CB       for C-beta
    N        for N-amide
    HN       for H-amide
As noted, there is an exception for naming glycine assignments, which should use HA2 and HA3 instead of HA. In the case of glycine HA2/HA3 assignments, TALOS/TALOS+ will use the average value of the two, so that it is not necessary to have these assigned stereo specifically ; for use of TALOS/TALOS+, the assignment can be arbitrary. Note however that the assignment must be given exactly as either "HA2" or "HA3" rather than "HA2|HA3" etc.
Other types of assignments may be present in the shift table; they will be ignored.

Example shift table (excerpts):

   REMARK Ubiquitin input for TALOS, HA2/HA3 assignments arbitrary.

   DATA SEQUENCE MQIFVKTLTG KTITLEVEPS DTIENVKAKI QDKEGIPPDQ QRLIFAGKQL
   DATA SEQUENCE EDGRTLSDYN IQKESTLHLV LRLRGG

   VARS   RESID RESNAME ATOMNAME SHIFT
   FORMAT %4d   %1s     %4s      %8.3f

     1 M           HA                  4.23
     1 M           C                 170.54
     1 M           CA                 54.45
     1 M           CB                 33.27
     2 Q           N                 123.22
     2 Q           HA                  5.25
     2 Q           C                 175.92
     2 Q           CA                 55.08
     2 Q           CB                 30.76
---------------------------------------------------

From talos+ randcoil.tab file:

REMARK Talos Random Coil Table 2005.032.16.15
REMARK Cornilescu, Delaglio and Bax
REMARK CA/CB from Spera, Bax, JACS 91.
REMARK Others from Wishart et al. J. Biomol. NMR, 5(1995), 67-81
REMARK Pro N shift is the current database average (7 residues).
REMARK HIS = Wishart's val - 0.5*(diff between prot./non-prot. Howarth&Lilley)

DATA RESNAMES  A C c D E F G H I K L M N P Q R S T V W Y
DATA ATOMNAMES HA CA CB C N HN

#
# Values for C are CYS-reduced.
# Values for c are CYS-oxidized.
# Values for H are HIS-unprotonated.
# Values for h are for HIS-protonated.
# Values for D and E are for protonated forms.
---------------------------------------------------

    """

    if not project:
        return True
    #end if

    if not project.molecule:
        nTerror('exportShifts2TalosPlus: no molecule defined')
        return True
    molecule = project.molecule
    residues = molecule.residuesWithProperties('protein')
    if not residues:
        nTerror('exportShifts2TalosPlus: no amino acid defined')
        return True

    table = NmrPipeTable()
    table.remarks.append( sprintf('shifts from %s', molecule.name ) )
    residueOffset = residues[0].resNum-1 # residue numbering has to start from 1
    table.remarks.append( sprintf('residue numbering offset  %d', residueOffset ) )

#   generate a one-letter sequence string; map 'all chains to one sequence'
    seqString = ''
    for res in residues:
#        seqString = seqString + res.db.shortName JFD mod; wrong, look at format def above!
        if res.translate(constants.INTERNAL_0) == 'CYSS':
            seqString = seqString + 'c' # oxidized
        else:
            seqString = seqString + res.db.shortName
    #end for

#   data
    table.data.SEQUENCE = seqString

#   add collun entries
    table.addColumn('RESID',    '%-4d')
    table.addColumn('RESNAME',  '%-4s')
    table.addColumn('ATOMNAME', '%-4s')
    table.addColumn('SHIFT',    '%8.3f')

    # defines IUPAC to talos mapping and nuclei used
    talosDict = dict(
                 N  = 'N',
                 H  = 'HN',
                 CA = 'CA',
                 HA = 'HA',
                 HA2= 'HA2',
                 HA3= 'HA3',
                 QA = 'HA2,HA3', # QA will be translsate into real atoms
                 CB = 'CB',
                 C  = 'C'
                 )
    talosNuclei = talosDict.keys()

    atmCount = 0
    for resId,res in enumerate(residues):
        for ac in res.allAtoms():
            atomName = ac.translate(constants.IUPAC)
            if (ac.isAssigned(resonanceListIdx=constants.RESONANCE_LIST_IDX_ANY) and ( atomName in talosNuclei)):
                shift = ac.shift(resonanceListIdx=constants.RESONANCE_LIST_IDX_ANY) # save the shift, because Gly QA pseudo atom does get expanded
                for ra in ac.realAtoms():
                    atomName = ra.translate(constants.IUPAC)
                    # Translate to TalosPlus
                    if talosDict.has_key(atomName):
                        atomName = talosDict[atomName]
                    else:
                        nTerror('exportShifts2TalosPlus: strange, we should not be here (ra=%s)', ra)
                        continue
                    #end if

                    #print '>', seqString[resId:resId+1]
                    table.addRow( RESID=resId+1, RESNAME=seqString[resId:resId+1], ATOMNAME=atomName, SHIFT=shift)
                    atmCount += 1
                #end for
            #end if
        #end for
    #end for

    # save the table
    if not fileName:
        fileName = molecule.name + '.tab'
    if not table.writeFile(fileName):
        nTmessage( '==> exportShifts2TalosPlus:  %-4d shifts   written to "%s"', atmCount, fileName )
    if atmCount == 0:
        return True
コード例 #8
0
ファイル: talosPlus.py プロジェクト: jakesyl/cing
    def format(self): # pylint: disable=W0221
        return sprintf(
'''=== NmrPipeTable "%s" ===
columns:  %s
nrows:    %d''', self.tabFile, self.columnDefs.zap('name'), self.nrows
        )
コード例 #9
0
ファイル: compareProjects.py プロジェクト: jakesyl/cing
 def __str__(self):
     return sprintf('<PhiPsiLists (%d)>', len(self))
コード例 #10
0
ファイル: compareProjects.py プロジェクト: jakesyl/cing
 def __str__(self):
     return sprintf('<PhiPsiModelList %s (%d)>', self.name, len(self))
コード例 #11
0
ファイル: classes2.py プロジェクト: jakesyl/cing
 def __str__(self):
     return io.sprintf('<%s "%s" (%s,%d)>' % (self.__CLASS__, self.name, self.status, len(self)))
コード例 #12
0
ファイル: classes2.py プロジェクト: jakesyl/cing
 def __str__(self):
     return io.sprintf('<%s "%s">' % (self.__CLASS__, self.name))