github
Advanced Search
  • Home
  • Pricing and Signup
  • Explore GitHub
  • Blog
  • Login

harijay / xtaltools

  • Admin
  • Watch Unwatch
  • Fork
  • Your Fork
  • Pull Request
  • Download Source
    • 1
    • 0
  • Source
  • Commits
  • Network (0)
  • Issues (0)
  • Downloads (0)
  • Wiki (1)
  • Graphs
  • Tree: e683fce

click here to add a description

click here to add a homepage

  • Branches (1)
    • master
  • Tags (0)
Sending Request…
Enable Donations

Pledgie Donations

Once activated, we'll place the following badge in your repository's detail box:
Pledgie_example
This service is courtesy of Pledgie.

Python scripts to aid certain aspects of crystallographic analysis — Read more

  cancel

  cancel
  • Private
  • Read-Only
  • HTTP Read-Only

This URL has Read+Write access

Anomalous around a script to get you the values of f\' and f" for an atom 
at any given wavelength 
harijay (author)
Wed Jul 01 08:10:57 -0700 2009
commit  e683fcef6a5ad7394b87382e58d4dce32a85585b
tree    87058c4d4b6ed12c09d323d910520f748ead6787
parent  c90448fe4f7969458c7d28e17923bd6f16713d50
xtaltools / maskconvert.py maskconvert.py
100755 95 lines (77 sloc) 3.479 kb
edit raw blame history
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#!/usr/bin/python
import subprocess
import os.path
# To change this template, choose Tools | Templates
# and open the template in the editor.
 
__author__="hari"
__date__ ="$Jun 29, 2009 10:09:03 AM$"
 
import os,sys,argparse
class Converter(object):
    program = None
    # Mask convert maskconvert -i input mask -o outputformat
    def __init__(self,toformat=None ,infilepath=None):
        self.toformat = toformat
        self.infilepath = infilepath
        if "linux" in sys.platform:
            gotprog = self.__checkformapman("lx_mapman")
            if gotprog:
                Converter.program = gotprog
                print "Using %s for mask conversion" % self.program
 
            elif self.__checkformapman("mapman"):
                gotprog = self.__checkformapman("mapman")
                Converter.program = gotprog
                print "Using %s for mask conversion" % self.program
      
        elif "darwin" in sys.platform:
            gotprog = self.__checkformapman("osx_mapman")
            if gotprog:
                Converter.program = gotprog
                print "Using %s for mask conversion" % self.program
 
            elif __checkformapman("mapman"):
                gotprog = __checkformapman("mapman")
                Converter.program = gotprog
                print "Using %s for mask conversion" % self.program
        else:
            print "Exiting no mapman in path"
            raise
 
    def __checkformapman(self,myprogram):
        def is_exe(tested_program):
            return os.path.exists(tested_program) and os.access(tested_program, os.X_OK)
 
        fpath, fname = os.path.split(myprogram)
 
        if fpath:
            if is_exe(os.path.join(fpath,fname)):
                program = os.path.join(fpath, fname)
                return program
 
        else:
            for path in os.environ["PATH"].split(os.pathsep):
                exe_file = os.path.join(path, myprogram)
                if is_exe(exe_file):
                    program = exe_file
                    return program
        return None
 
    def convertto(self,format,informat="CCP4"):
        print "Converting format to %s using %s " % ( format , self.program)
        base,name = os.path.split(self.infilepath)
        name_root = os.path.splitext(name)[0]
        # The coot file browser does not filter and show files ending with synonymous X-PLOR format
        # So converting it to CNS
        
        if format == "X-PLOR":
            format = "CNS"
        outfile = os.path.join(base,"".join([name_root,".",format.lower()]))
        print os.path.join(base, outfile)
        if os.path.lexists(self.infilepath):
            mapman_scr = """re m1 %s %s\nwr m1 %s %s\nquit\n""" % (self.infilepath,informat,outfile,format)
            tmp = open("tmp.scr","w")
            tmp.write(mapman_scr)
            tmp.close()
            a = os.system(self.program + " < tmp.scr ")
            
 
        
 
 
if __name__ == "__main__":
    parser = argparse.ArgumentParser()
    parser.add_argument("-i" , dest="infile" ,required=True)
    parser.add_argument("-d" , dest="output_format", required=True, choices=["CCP4", "X-PLOR","CNS","OMAP"])
    parser.add_argument("-s",dest="input_format",choices=["CCP4", "X-PLOR","CNS","OMAP"])
    cli = parser.parse_args()
    c = Converter(infilepath=cli.infile)
    if cli.input_format:
        c.convertto(cli.output_format,cli.input_format)
    else:
        c.convertto(cli.output_format)
   
 
Blog | Support | Training | Contact | API | Status | Twitter | Help | Security
© 2010 GitHub Inc. All rights reserved. | Terms of Service | Privacy Policy
Powered by the Dedicated Servers and
Cloud Computing of Rackspace Hosting®
Dedicated Server