Esempio n. 1
0
def get_molecule_type(prefix, ext='.ent'):
    ''' 
    will get the download .extension file (either ent or pdb) and parse the molecule type out into
    a file
    '''
    d = parse_equivalencesFile(prefix)
    outf=open(prefix+'.moltype','w')
    l=[]
    for k,v in d.iteritems():
        q = Popen("cat pdb%s.ent | grep 'COMPND   2 MOLECULE'"%(transform_lowercase([k])[0]),shell=True, stdout=PIPE)
        out=q.communicate()[0].split('COMPND   2 MOLECULE:')[1].strip().strip(';')
        l.append(out+'\t'+k+'\t'+v)
    l.sort()
    for e in l:
        outf.write(e)
Esempio n. 2
0
from numpy import median

filename = sys.argv[1]
col = int(sys.argv[2]) #number of columns
f = open(filename).read().split('\n')
#parse the equivalences file
sps = {}
for e in f:
    if e == '' or e == '\t\t':
        continue
    else:
        bline = e.split('\t')
        sp = bline[0].split('_')[0]
        sp = sp.split()        
        if 'SP.' in bline[0]:
            sp = transform_sentence_case([sp[0]])[0]+' '+transform_lowercase([sp[1]])[0]
        else:
            sp = ' '.join(sp)#sp[0][0]+'. '+transform_lowercase([sp[1]])[0]
            
        pdb=bline[1]
        ind=bline[2]
        if not sp in sps:
            sps[sp]= []
            sps[sp].append((pdb,ind))
        else:
            sps[sp].append((pdb,ind))

#create the table
t = open(filename[:filename.rfind('.')]+'.latextable','w')
header ='\\begin{table}[ht]\n\t\\tiny\n\t\\caption{}\n\t\\begin{center}\n\\begin{tabular}{ ccc'+' cc'*(col-1)
header += '}\n\t\\toprule\n\t Species'+ '& PDB & Plot'*col +'\\\\\n'
Esempio n. 3
0
filename = sys.argv[1]
col = int(sys.argv[2])  #number of columns
f = open(filename).read().split('\n')
#parse the equivalences file
sps = {}
for e in f:
    if e == '' or e == '\t\t':
        continue
    else:
        bline = e.split('\t')
        sp = bline[0].split('_')[0]
        sp = sp.split()
        if 'SP.' in bline[0]:
            sp = transform_sentence_case(
                [sp[0]])[0] + ' ' + transform_lowercase([sp[1]])[0]
        else:
            sp = ' '.join(sp)  #sp[0][0]+'. '+transform_lowercase([sp[1]])[0]

        pdb = bline[1]
        ind = bline[2]
        if not sp in sps:
            sps[sp] = []
            sps[sp].append((pdb, ind))
        else:
            sps[sp].append((pdb, ind))

#create the table
t = open(filename[:filename.rfind('.')] + '.latextable', 'w')
header = '\\begin{table}[ht]\n\t\\tiny\n\t\\caption{}\n\t\\begin{center}\n\\begin{tabular}{ ccc' + ' cc' * (
    col - 1)