Beispiel #1
0
def export2gif(molecule, pathMolGif, project = None):
    """Return True on error but will still put a default image in."""
    check_type(molecule, 'Molecule')
    check_string(pathMolGif)
    if project:
        check_type(project, 'Project')
#    nTdebug("Now in cing.Plugincode.molgrap#export2gif")
    m = Molgrap(project = project)
    m.run(molecule, pathMolGif)
    failed = False
    if not os.path.exists(pathMolGif):
        failed = True
        src =  os.path.join( cingPythonCingDir, 'PluginCode', DATA_STR, 'UnknownImage.gif' )
#        if os.path.exists(pathMolGif): # disable when done testing.
#            os.unlink(pathMolGif)
        nTmessage("copying default image from %s to %s" % (src, pathMolGif))
#        os.link(src, pathMolGif) # us a real copy JFD: fails between 2 filesystems
        disk.copy(src, pathMolGif) # us a real copy
#        os.symlink(src, pathMolGif) # funny, the extension on mac fails to show up for this file only; other extensions are shown ok...
    # end if
    pathMolGifPinup = pathMolGif[:-4] + '_pin.gif'
    if convertImageMagick(pathMolGif, pathMolGifPinup, options='-geometry 114x80'):
        nTerror("convertImageMagick failed for: " + pathMolGifPinup)
    # end if
    
    if failed:
        return True
    return None
Beispiel #2
0
def createPinUp(pdb_id, extraArgListStr):
    print 'pdb_id:             ' + pdb_id
    print 'extraArgListStr:    ' + extraArgListStr
    ch23 = pdb_id[1:3]
#    /Library/WebServer/Documents/NRG-CING/data/a2/1a24/1a24.cing/1a24/HTML
    htmlDir = '/Library/WebServer/Documents/%(results_base)s/data/%(ch23)s/%(pdb_id)s/%(pdb_id)s.cing/%(pdb_id)s/HTML' % {
                    'pdb_id':pdb_id,'ch23':ch23, 'results_base': extraArgListStr}
    inputPath = os.path.join(htmlDir, 'mol.gif')
    outputPath = os.path.join(htmlDir, 'mol_pin.gif')
    if convertImageMagick(inputPath, outputPath, options='-geometry 114x80'): # Dimension to match the one in molgrap.py
        print 'ERROR: failed for: ' + inputPath
Beispiel #3
0
def createPinUp(pdb_id, extraArgListStr):
    print 'pdb_id:             ' + pdb_id
    print 'extraArgListStr:    ' + extraArgListStr
    ch23 = pdb_id[1:3]
    #    /Library/WebServer/Documents/NRG-CING/data/a2/1a24/1a24.cing/1a24/HTML
    htmlDir = '/Library/WebServer/Documents/%(results_base)s/data/%(ch23)s/%(pdb_id)s/%(pdb_id)s.cing/%(pdb_id)s/HTML' % {
        'pdb_id': pdb_id,
        'ch23': ch23,
        'results_base': extraArgListStr
    }
    inputPath = os.path.join(htmlDir, 'mol.gif')
    outputPath = os.path.join(htmlDir, 'mol_pin.gif')
    if convertImageMagick(inputPath, outputPath, options='-geometry 114x80'
                          ):  # Dimension to match the one in molgrap.py
        print 'ERROR: failed for: ' + inputPath
Beispiel #4
0
    def testConvert2Web(self):

        fn = "pc_nmr_11_rstraints.ps"
#        fn = "1vnd_11_rstraints.ps"
        self.assertTrue( os.path.exists( cingDirTestsData) and os.path.isdir(cingDirTestsData ) )
        inputPath = os.path.join(cingDirTestsData,fn)
        fileList = convert2Web( inputPath, outputDir='.', doMontage=True )
        nTdebug( "Got back from convert2Web output file names: " + repr(fileList))
        self.assertNotEqual(fileList,True)
        if fileList != True:
            for file in fileList:
                self.assertNotEqual( file, None)
        fn1 = "pc_nmr_11_rstraints.pdf"
        self.assertFalse( joinPdfPagesByGhostScript( [fn1,fn1], "pc_nmr_11_rstraints_echo.pdf"))
        outputPath =  'pc_nmr_11_rstraints_pin.gif'
        self.assertFalse(convertImageMagick(inputPath, outputPath, options='-geometry 57x40'))
        self.assertTrue(os.path.exists(outputPath))