# Path: metatlas/io/metatlas_get_data_helper_fun.py
# def create_msms_dataframe(df):
# def compare_EIC_to_BPC_for_file(metatlas_dataset,file_index,yscale = 'linear'):
# def get_data_for_atlas_df_and_file(input_tuple):
# def get_bpc(filename,dataset='ms1_pos',integration='bpc'):
# def df_container_from_metatlas_file(my_file):
# def fast_nearest_interp(xi, x, y):
# def remove_ms1_data_not_in_atlas(atlas_df, data):
# def extract(data, ids, default=None):
# def set_nested(data, ids, value):
# def make_atlas_df(atlas):
# def transfer_identification_data_to_atlas(data, atlas, ids_list=None):
# def get_data_for_mzrt(row, data_df_pos, data_df_neg, extra_time=0.5, use_mz='mz', extra_mz=0.0):
# def get_ms1_summary(row):
# def get_ms2_data(row):
# def prefilter_ms1_dataframe_with_boundaries(data_df, rt_max, rt_min, mz_min, mz_max, extra_time=0.5, extra_mz=0.01):
# def get_ms1_eic(row):
# def retrieve_most_intense_msms_scan(data):
# def get_data_for_atlas_and_lcmsrun(atlas_df, df_container, extra_time, extra_mz):
#     def get_feature_data(atlas_df, pos_df, neg_df, use_mz='mz'):
# def get_ms2_dict(ms2_feature_data_df):
# def get_ms1_summary_data(ms1_feature_data_df):
# def get_eic_data(ms1_feature_data_df):
# def get_unique_scan_data(data):
# def get_non_redundant_precursor_list(prt,pmz,rt_cutoff,mz_cutoff):
# def organize_msms_scan_data(data,list_of_prt,list_of_pmz,list_of_pintensity):
# def get_data_for_a_compound(mz_ref,rt_ref,what_to_get,h5file,extra_time):
# def get_dill_data(fname):
# def get_group_names(data):
# def get_group_shortnames(data):
# def get_file_names(data,full_path=False):
# def get_compound_names(data,use_labels=False):
# def make_data_sources_tables(groups, myatlas, output_loc, polarity=None, overwrite=True):
#     D = defaultdict(list)
#     D = {k:v for k,v in D.items() if len(v)>1}


import matplotlib 
import sys
import os
import numpy as np
import warnings
from matplotlib import pyplot as plt
from textwrap import wrap
from metatlas.io import metatlas_get_data_helper_fun as ma_data
    plt.rcParams['axes.linewidth'] = 2 # set the value globally
    
    for i,name in enumerate(names):
        plot_chromatogram(my_data[i], name, ax=ax[i])

    f.savefig(file_name)    
    plt.close(f)


def plot_compounds_and_files(output_dir,
                             data,
                             nCols = 8,
                             share_y = False,
                             pool=None,
                             plot_types='both'):
    '''
    Parameters
    ----------
    output_dir location of saved pdf plots
    nCols number of columns per pdf file
    share_y subplots share/not share they y axis
    processes number of cores to use
    plot_types compounds per file or files per compound or both

    Returns
    -------
    nothing
    '''

    file_names = ma_data.get_file_names(data)

# Path: metatlas/io/metatlas_get_data_helper_fun.py
# def create_msms_dataframe(df):
# def compare_EIC_to_BPC_for_file(metatlas_dataset,file_index,yscale = 'linear'):
# def get_data_for_atlas_df_and_file(input_tuple):
# def get_bpc(filename,dataset='ms1_pos',integration='bpc'):
# def df_container_from_metatlas_file(my_file):
# def fast_nearest_interp(xi, x, y):
# def remove_ms1_data_not_in_atlas(atlas_df, data):
# def extract(data, ids, default=None):
# def set_nested(data, ids, value):
# def make_atlas_df(atlas):
# def transfer_identification_data_to_atlas(data, atlas, ids_list=None):
# def get_data_for_mzrt(row, data_df_pos, data_df_neg, extra_time=0.5, use_mz='mz', extra_mz=0.0):
# def get_ms1_summary(row):
# def get_ms2_data(row):
# def prefilter_ms1_dataframe_with_boundaries(data_df, rt_max, rt_min, mz_min, mz_max, extra_time=0.5, extra_mz=0.01):
# def get_ms1_eic(row):
# def retrieve_most_intense_msms_scan(data):
# def get_data_for_atlas_and_lcmsrun(atlas_df, df_container, extra_time, extra_mz):
#     def get_feature_data(atlas_df, pos_df, neg_df, use_mz='mz'):
# def get_ms2_dict(ms2_feature_data_df):
# def get_ms1_summary_data(ms1_feature_data_df):
# def get_eic_data(ms1_feature_data_df):
# def get_unique_scan_data(data):
# def get_non_redundant_precursor_list(prt,pmz,rt_cutoff,mz_cutoff):
# def organize_msms_scan_data(data,list_of_prt,list_of_pmz,list_of_pintensity):
# def get_data_for_a_compound(mz_ref,rt_ref,what_to_get,h5file,extra_time):
# def get_dill_data(fname):
# def get_group_names(data):
# def get_group_shortnames(data):
# def get_file_names(data,full_path=False):
# def get_compound_names(data,use_labels=False):
# def make_data_sources_tables(groups, myatlas, output_loc, polarity=None, overwrite=True):
#     D = defaultdict(list)
#     D = {k:v for k,v in D.items() if len(v)>1}


# Path: metatlas/plots/chromatograms_mp_plots.py
import matplotlib 
import sys
import os
import numpy as np
import warnings
from matplotlib import pyplot as plt
from textwrap import wrap
from metatlas.io import metatlas_get_data_helper_fun as ma_data

    plt.rcParams['axes.linewidth'] = 2 # set the value globally
    
    for i,name in enumerate(names):
        plot_chromatogram(my_data[i], name, ax=ax[i])

    f.savefig(file_name)    
    plt.close(f)


def plot_compounds_and_files(output_dir,
                             data,
                             nCols = 8,
                             share_y = False,
                             pool=None,
                             plot_types='both'):
    '''
    Parameters
    ----------
    output_dir location of saved pdf plots
    nCols number of columns per pdf file
    share_y subplots share/not share they y axis
    processes number of cores to use
    plot_types compounds per file or files per compound or both

    Returns
    -------
    nothing
    '''

    file_names = ma_data.get_file_names(data)

    compound_names = ma_data.get_compound_names(data)[0]