<jupyter_start><jupyter_text>1. Import libraries<jupyter_code>import pandas as pd
import numpy as np
import glob
import os<jupyter_output><empty_output><jupyter_text>2. Create project subdirectories<jupyter_code>project_dir = os.getcwd()
tables_output = '../tables'
images_output = '../images'

if not os.path.exists(tables_output):
    os.makedirs(tables_output)

if not os.path.exists(images_output):
    os.makedirs(images_output)

project_dir<jupyter_output><empty_output><jupyter_text>3. Glob list of `.mzXML` files, make dataframe<jupyter_code>list_files = glob.glob('../data/*.mzXML')
list_files = [(x.split('\\')[-1], x.split('\\')[-1][:-6]) for x in list_files]
print('n files = ', len(list_files))

phenodata = pd.DataFrame(list_files, columns =['FileName', 'SampleCode']) 
phenodata['SampleCode'] = phenodata['SampleCode'].str.replace('Saleska_', '').str.replace('_23.*', '', regex = True)
phenodata['Time'] = phenodata['SampleCode'].apply(lambda x: 'T0' if x.find('I_') == -1 else 
                                                  ('T1' if x.find('II_') == -1 else
                                                  ('T2' if x.find('III_') == -1 else 'T3')))
phenodata['Sample_type'] = phenodata['SampleCode'].apply(lambda x: 'Litter' if x.find('NC') != -1 else 
                                                  ('peat' if x.find('T0') != -1 else 'peat_litter'))

filename = os.path.join(tables_output, 'metadata_bog.csv')
phenodata.to_csv(filename, index=False)
phenodata<jupyter_output>n files =  8
{'fraction_non_alphanumeric': 0.17052214144084601, 'fraction_numerical': 0.01255783212161269, 'mean_word_length': 3.439882697947214, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 12, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '370886', 'license': 'MIT', 'n_tokens_mistral': 531, 'n_tokens_neox': 518, 'n_words': 100, 'path': '0_metadata/0_make_metadata.ipynb', 'repo_name': 'Coayala/bog_metabolomics', 'size': '1513'}