<commit_before>'''
Created on 28 Nov 2013

@author: jmht
'''

import os
import re

class ShelxeLogParser(object):
    """
    Class to mine information from a shelxe log
    """
    
    def __init__(self,logfile):
        
        self.logfile = logfile
        
        # All data refers to the best cycle
        self.CC = None
        self.avgChainLength = None
        self.maxChainLength = None
        self.numChains = None
        self.cycle = None
        self.cputime = None
        <commit_msg>Add a shelxe pdb parser<commit_after>'''
Created on 28 Nov 2013

@author: jmht
'''

import os
import re


class ShelxePdbParser(object):
    #UNTESTED!!
    def __init__(self, pdbfile):
        self.CC             = None
        self.numResidues    = None
        self.numChains      = None
        
        return self.parse( pdbfile )
    
    def parse(self, pdbfile):
        with open(pdbfile) as f:
            line = f.readline.strip()
        
        tokens = line.split()
        assert line.startswith("TITLE") and len( tokens ) == 12
        
        self.CC             = tokens[6][:-1] # Remove % from end
        self.numResidues    = int(tokens[7])
        self.numChains      = int(tokens[10])
        
        return
    

class ShelxeLogParser(object):
    """
    Class to mine information from a shelxe log
    """
    
    def __init__(self,logfile):
        
        self.logfile = logfile
        
        # All data refers to the best cycle
        self.CC = None
        self.avgChainLength = None
        self.maxChainLength = None
        self.numChains = None
        self.cycle = None
        self.cputime = None
        
{'fraction_non_alphanumeric': 0.08695652173913043, 'fraction_numerical': 0.011473429951690822, 'mean_word_length': 1.6469648562300319, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '76865', 'n_tokens_mistral': 514, 'n_tokens_neox': 496, 'n_words': 136}