def parse_pubs_txt(self):
    if os.path.exists(self.pubs_info_file_path):
        self.info = u.get_TAB_delimited_file_as_dictionary(self.pubs_info_file_path)
    pubs_header = u.get_columns_of_TAB_delim_file(self.pubs_file_path, include_first_column=True)
    headers_expected = ['Authors', 'Title', 'Publication', 'Volume', 'Number', 'Pages', 'Year', 'doi']
    missing_headers = [h for h in pubs_header if (h not in headers_expected)]
    if len(missing_headers):
        raise ConfigError(('Sorry, the pubs.txt seems to be missing some of the headers that are mandatory. Each of                                the columns in the following list must be present in this file: %s (hint: yours do not have                               the following: %s).' % (', '.join(headers_expected), ', '.join(missing_headers))))
    self.pubs_txt = u.get_TAB_delimited_file_as_dictionary(self.pubs_file_path, indexing_field=pubs_header.index('doi'))
    for doi in self.pubs_txt:
        authors = []
        co_first_authors = []
        co_senior_authors = []
        p = self.pubs_txt[doi]
        for author in [_.strip() for _ in p['Authors'].split(';')]:
            if (not len(author)):
                continue
            (author_last_name, author_first_name_raw) = [_.strip() for _ in author.split(',')]
            author_first_name = ''.join([n[0] for n in author_first_name_raw.split()])
            author_final_name = ('%s %s' % (author_last_name, author_first_name))
            if author_first_name_raw.endswith('*'):
                co_first_authors.append(author_final_name)
            elif author_first_name_raw.endswith('+'):
                co_senior_authors.append(author_final_name)
            authors.append(author_final_name)
        if p['Number']:
            issue = ('%s(%s):%s' % (p['Volume'], p['Number'], p['Pages']))
        else:
            issue = ('%s:%s' % (p['Volume'], p['Pages']))
        year = p['Year'].strip()
        pub_entry = {'authors': authors, 'title': p['Title'], 'journal': p['Publication'], 'issue': issue, 'doi': doi, 'year': year, 'co_first_authors': co_first_authors, 'co_senior_authors': co_senior_authors}
        if (year not in self.pubs_dict):
            self.pubs_dict[year] = [pub_entry]
        else:
            self.pubs_dict[year].append(pub_entry)
def parse_pubs_txt(self):
    if os.path.exists(self.pubs_info_file_path):
        self.info = u.get_TAB_delimited_file_as_dictionary(self.pubs_info_file_path)
    pubs_header = u.get_columns_of_TAB_delim_file(self.pubs_file_path, include_first_column=True)
    headers_expected = ['Authors', 'Title', 'Publication', 'Volume', 'Number', 'Pages', 'Year', 'doi']
    missing_headers = [h for h in pubs_header if (h not in headers_expected)]
    if len(missing_headers):
        raise ConfigError(('Sorry, the pubs.txt seems to be missing some of the headers that are mandatory. Each of                                the columns in the following list must be present in this file: %s (hint: yours do not have                               the following: %s).' % (', '.join(headers_expected), ', '.join(missing_headers))))
    self.pubs_txt = u.get_TAB_delimited_file_as_dictionary(self.pubs_file_path, indexing_field=pubs_header.index('doi'))
    for doi in self.pubs_txt:
        authors = []
        co_first_authors = []
        co_senior_authors = []
        p = self.pubs_txt[doi]
        for author in [_.strip() for _ in p['Authors'].split(';')]:
            if (not len(author)):
                continue
            (author_last_name, author_first_name_raw) = [_.strip() for _ in author.split(',')]
            author_first_name = .join([n[0] for n in author_first_name_raw.split()])
            author_final_name = ('%s %s' % (author_last_name, author_first_name))
            if author_first_name_raw.endswith('*'):
                co_first_authors.append(author_final_name)
            elif author_first_name_raw.endswith('+'):
                co_senior_authors.append(author_final_name)
            authors.append(author_final_name)
        if p['Number']:
            issue = ('%s(%s):%s' % (p['Volume'], p['Number'], p['Pages']))
        else:
            issue = ('%s:%s' % (p['Volume'], p['Pages']))
        year = p['Year'].strip()
        pub_entry = {'authors': authors, 'title': p['Title'], 'journal': p['Publication'], 'issue': issue, 'doi': doi, 'year': year, 'co_first_authors': co_first_authors, 'co_senior_authors': co_senior_authors}
        if (year not in self.pubs_dict):
            self.pubs_dict[year] = [pub_entry]
        else:
            self.pubs_dict[year].append(pub_entry)