Esempio n. 1
0
def create_html(dataset, output_html_dir, org_html, project_name, config):
    import os

    div_txt = ""
    call_txt = ""
    detail_txt = ""
    for i in range(len(dataset["id_list"])):
        div_txt += li_template.format(id = str(i), title = dataset["id_list"][i])
        call_txt += call_template.format(id = str(i), title = dataset["id_list"][i])
        detail_txt += detail_template.format(id = str(i), title = dataset["id_list"][i])
        
    f_template = open(os.path.dirname(os.path.abspath(__file__)) + "/templates/" + org_html)
    html_template = f_template.read()
    f_template.close()
    
    f_html = open(output_html_dir + "/" + org_html, "w")
    f_html.write(
        html_template.format(project = project_name, 
            version = tools.version_text(),
            date = tools.now_string(),
            div_list = div_txt,
            call_list = call_txt,
            details = detail_txt,
            style = "../style/%s" % os.path.basename(tools.config_getpath(config, "style", "path", "default.js")),
        ))
    f_html.close()
Esempio n. 2
0
def create_html(dataset, output_html_dir, org_html, project_name, config):

    import paplot.subcode.tools as tools    
    import os

    chart_txt = ""
    js_txt = ""

    for i in range(len(dataset["plots"])):
        chart_txt += html_chart_template.format(chart_id = dataset["plots"][i])
        js_txt += html_js_template.format(i = str(i), chart_id = dataset["plots"][i])
        if dataset["plots"][i] == "chart_brush":
            js_txt += html_js_brushed_template.format(i = str(i))
        
    f_template = open(os.path.dirname(os.path.abspath(__file__)) + "/templates/" + org_html)
    html_template = f_template.read()
    f_template.close()
    
    f_html = open(output_html_dir + "/" + org_html, "w")
    f_html.write(
        html_template.format(project = project_name, 
            version = tools.version_text(),
            date = tools.now_string(),
            charts = chart_txt,
            js_add_div = js_txt,
            style = "../style/%s" % os.path.basename(tools.config_getpath(config, "style", "path", "default.js")),
        ))
    f_html.close()
Esempio n. 3
0
def create_html(dataset, output_di, config):

    import paplot.subcode.tools as tools
    import paplot.prep as prep
    import os

    chart_txt = ""
    js_txt = ""

    for i in range(len(dataset["plots"])):
        js_txt += html_js_template.format(i=str(i), chart_id=dataset["plots"][i])
        if dataset["plots"][i] == "chart_brush":
            chart_txt += '<p class="muted pull-left" style="margin-right: 15px;">Select a range to zoom in</p>\n'
            js_txt += html_js_brushed_template.format(i=str(i))
        chart_txt += html_chart_template.format(chart_id=dataset["plots"][i])

    f_template = open(os.path.dirname(os.path.abspath(__file__)) + "/templates/graph_qc.html")
    html_template = f_template.read()
    f_template.close()

    f_html = open(output_di["dir"] + "/" + output_di["html"], "w")
    f_html.write(
        html_template.format(project=output_di["project"],
                             title=output_di["title"],
                             data_js=output_di["js"],
                             version=prep.version_text(),
                             date=tools.now_string(),
                             charts=chart_txt,
                             js_add_div=js_txt,
                             style="../style/%s" % os.path.basename(tools.config_getpath(config, "style", "path", "default.js")),
                             ))
    f_html.close()
Esempio n. 4
0
def copy_dir_style(dst, config):

    import paplot.subcode.tools as tools
    import shutil
    import os
    import glob

    pattern = os.path.dirname(os.path.abspath(__file__)) + "/style/*"
    li_files = glob.glob(pattern)

    for f in li_files:
        shutil.copy(f, dst)

    # for option file
    option = tools.config_getpath(config, "style", "path")
    if len(option) > 0:
        shutil.copy(option, dst)
Esempio n. 5
0
def copy_dir_style(dst, config):
    
    import paplot.subcode.tools as tools
    import shutil
    import os
    import glob

    pattern = os.path.dirname(os.path.abspath(__file__)) + "/style/*"
    li_files = glob.glob(pattern)
    
    for f in li_files:
        shutil.copy(f, dst)
    
    # for option file
    option = tools.config_getpath(config, "style", "path")
    if len(option) > 0:
        shutil.copy(option, dst)
Esempio n. 6
0
def create_html(dataset, params, config):
    import os
    import paplot.subcode.tools as tools
    import paplot.prep as prep

    html_div_template = "<div style='float: left;' id='div_pm{id}'></div>\n"
    html_add_template = "msig_draw.add_div('div_pm{id}');\n"

    div_text = ""
    add_text = ""
    for i in range(dataset["sig_num"]):
        div_text += html_div_template.format(id=i)
        add_text += html_add_template.format(id=i)

    integral_text = ""
    if dataset["intergral"] is True:
        integral_text = html_integral_template

    f_template = open(
        os.path.dirname(os.path.abspath(__file__)) +
        "/templates/graph_pmsignature.html")
    html_template = f_template.read()
    f_template.close()

    sig_num_sift = 0
    if tools.config_getboolean(config, "result_format_pmsignature",
                               "background"):
        sig_num_sift = 1

    f_html = open(params["dir"] + "/" + dataset["html"], "w")
    f_html.write(
        html_template.format(
            project=params["project"],
            title="%s(#sig %d)" %
            (params["title"], dataset["sig_num"] + sig_num_sift),
            data_js=dataset["js"],
            version=prep.version_text(),
            date=tools.now_string(),
            divs=div_text,
            add_divs=add_text,
            integral=integral_text,
            style="../style/%s" % os.path.basename(
                tools.config_getpath(config, "style", "path", "default.js")),
        ))
    f_html.close()
Esempio n. 7
0
def create_html(dataset, output_di, config):
    import os
    import paplot.subcode.tools as tools
    import paplot.prep as prep

    sub1_text = ""
    sub2_text = ""
    set_sub_add_text = ""
    set_sub_select_text = ""
    for i in range(len(dataset["subdata"])):

        sub_text = subplot_template.format(
            i=i, title=dataset["subdata"][i]["title"])
        if dataset["subdata"][i]["pos"] == 1:
            sub1_text += sub_text
            set_sub_add_text += js_set_sub_add.format(i=i, type=1)
        else:
            sub2_text += sub_text
            set_sub_add_text += js_set_sub_add.format(i=i, type=2)

        set_sub_select_text += js_set_sub_select.format(i=i)

    f_template = open(
        os.path.dirname(os.path.abspath(__file__)) +
        "/templates/graph_mutation.html")
    html_template = f_template.read()
    f_template.close()

    f_html = open(output_di["dir"] + "/" + output_di["html"], "w")
    f_html.write(
        html_template.format(
            project=output_di["project"],
            title=output_di["title"],
            data_js=output_di["js"],
            version=prep.version_text(),
            date=tools.now_string(),
            sub1=sub1_text,
            sub2=sub2_text,
            set_sub_add=set_sub_add_text,
            set_sub_select=set_sub_select_text,
            style="../style/%s" % os.path.basename(
                tools.config_getpath(config, "style", "path", "default.js")),
        ))
    f_html.close()
Esempio n. 8
0
def create_html(dataset, output_di, config):
    import os
    import paplot.prep as prep

    div_txt = ""
    call_txt = ""
    detail_txt = ""
    for i in range(len(dataset["id_list"])):
        div_txt += li_template.format(id=str(i), title=dataset["id_list"][i])
        detail_txt += detail_template.format(id=str(i),
                                             title=dataset["id_list"][i])
        call_txt += call_template.format(id=str(i),
                                         title=dataset["id_list"][i])


#        if i >= 50:
#            if i == 50:
#                call_txt += call_later_header
#            call_txt += call_later_template.format(id = str(i), title = dataset["id_list"][i])
#        else:
#            call_txt += call_template.format(id = str(i), title = dataset["id_list"][i])

    f_template = open(
        os.path.dirname(os.path.abspath(__file__)) +
        "/templates/graph_ca.html")
    html_template = f_template.read()
    f_template.close()

    f_html = open(output_di["dir"] + "/" + output_di["html"], "w")
    f_html.write(
        html_template.format(
            project=output_di["project"],
            title=output_di["title"],
            data_js=output_di["js"],
            version=prep.version_text(),
            date=tools.now_string(),
            div_list=div_txt,
            call_list=call_txt,
            details=detail_txt,
            style="../style/%s" % os.path.basename(
                tools.config_getpath(config, "style", "path", "default.js")),
        ))
    f_html.close()
Esempio n. 9
0
def copy_dir_style(dst, config):
    """Copy ./style directory to the destination directory"""
    import paplot.subcode.tools as tools
    import shutil
    import os
    import glob

    pattern = os.path.dirname(
        os.path.abspath(__file__)) + "/style/*"  # ./style/*
    li_files = glob.glob(pattern)

    for f in li_files:
        shutil.copy(f, dst)

    # for option file
    option = tools.config_getpath(config, "style",
                                  "path")  # Additional style file
    if len(option) > 0:
        shutil.copy(option, dst)
Esempio n. 10
0
def create_html(dataset, output_html_dir, org_html, project_name, config):
    import os
    import paplot.subcode.tools as tools
    
    sub1_text = ""
    sub2_text = ""
    set_sub_add_text = ""
    set_sub_select_text = ""
    for i in range(len(dataset["subdata"])):
        
        sub_text = subplot_template.format(i = i, title = dataset["subdata"][i]["title"])
        if dataset["subdata"][i]["pos"] == 1:
            sub1_text += sub_text
            set_sub_add_text += js_set_sub_add.format(i = i, type = 1)
        else:
            sub2_text += sub_text
            set_sub_add_text += js_set_sub_add.format(i = i, type = 2)
            
        set_sub_select_text += js_set_sub_select.format(i = i)

    f_template = open(os.path.dirname(os.path.abspath(__file__)) + "/templates/" + org_html)
    html_template = f_template.read()
    f_template.close()
    
    f_html = open(output_html_dir + "/" + org_html, "w")
    f_html.write(
        html_template.format(project = project_name, 
            version = tools.version_text(),
            date = tools.now_string(),
            sub1 = sub1_text,
            sub2 = sub2_text,
            set_sub_add = set_sub_add_text,
            set_sub_select = set_sub_select_text,
            style = "../style/%s" % os.path.basename(tools.config_getpath(config, "style", "path", "default.js")),
        ))
    f_html.close()
Esempio n. 11
0
def load_subdata(ids, sec, config):
    import os
    import paplot.subcode.tools as tools
    import paplot.convert as convert
    import paplot.color as color

    input_file = tools.config_getpath(config, sec, "path", default = "")
    if os.path.exists(input_file) == False:
        print ("[ERROR] file is not exist. %s" % input_file)
        return None

    sept = tools.config_getstr(config, sec, "sept").replace("\\t", "\t").replace("\\n", "\n").replace("\\r", "\r")
    mode = tools.config_getstr(config, sec, "mode")
    comment = tools.config_getstr(config, sec, "comment")
    title = tools.config_getstr(config, sec, "title")
    
    label = []
    item = []
    colors_n_di = {}
    colors_h_di = {}
    for name_set in tools.config_getstr(config, sec, "name_set").split(","):
        name_set_split = convert.text_to_list(name_set, ":")
        for i in range(len(name_set_split)):
            text = name_set_split[i]
            if i == 0:
                item.append(text)
                if len(name_set_split) == 1:
                    label.append(text)
            elif i == 1:
                label.append(text)
            elif i == 2:
                colors_n_di[name_set_split[0]] = color.name_to_value(text)
            elif i == 3:
                colors_h_di[name_set_split[0]] = color.name_to_value(text)
    
    # fill in undefined items
    colors_n_di = color.create_color_dict(item, colors_n_di, color.osaka_subway_colors) 
    colors_h_di2 = {}
    for key in colors_n_di:
        if key in colors_h_di: continue
        colors_h_di2[key] = color.saturation_down(colors_n_di[key])
    
    # dict to value
    colors_n = []
    for key in item:
        colors_n.append(colors_n_di[key])
    
    if mode == "range":
        item.remove(item[0])
    
    header = []
    if tools.config_getboolean(config, sec, "header") == True:
        pos_value = -1
        pos_id = -1
    else:
        pos_value = tools.config_getint(config, sec, "col_value")-1
        pos_id = tools.config_getint(config, sec, "col_ID")-1
        header = ["",""]
    
    # copy id_list for find check
    unlookup = []
    for iid in ids:
        unlookup.append(iid)
        
    # read
    data_text = ""
    values = []
    for line in open(input_file):
        line = line.strip()
        if len(line.replace(sept, "")) == 0:
            continue
        
        if comment != "" and line.find(comment) == 0:
            continue
        
        if len(header) == 0:
            header = convert.text_to_list(line,sept)
            try:
                colname = tools.config_getstr(config, sec, "col_value")
                pos_value = header.index(colname)
                colname = tools.config_getstr(config, sec, "col_ID")
                pos_id = header.index(colname)
            except Exception as e:
                print(e.message)
                return None
                
            continue
        
        cols = convert.text_to_list(line,sept)
        if (cols[pos_id] in ids) == False: continue
        else: unlookup.remove(cols[pos_id])

        id_pos = ids.index(cols[pos_id])
        
        if mode == "fix":
            if cols[pos_value] in item:
                data_text += subdata_data_template.format(id = id_pos, item = item.index(cols[pos_value]))
            else:
                print("[" + sec + "] name_set: data is undefined." + cols[pos_value] + "\n")
                continue
        elif mode == "range" or mode == "gradient":
            try:
                values.append(float(cols[pos_value]))
            except Exception as e:
                print(colname + ": data type is invalid.\n" + e.message)
                continue
            
            data_text += subdata_data_template.format(id = id_pos, item = cols[pos_value])

    if len(unlookup) > 0:
        print("[WARNING] can't find IDs subplot data.")
        print(unlookup)
        
    if mode == "gradient" and len(values) > 0:
        item[0] = min(values)
        item[1] = max(values)
        
    return [data_text, item, colors_n, label, title] 
Esempio n. 12
0
def create_html(dataset, output_di, config):
    """
    Create HTML file for CA

    Parameters
    ----------
    dataset: dict: {"id_list"   : [id column values],
                    "group_list": [group names],
                    "color"     : [group colors]}
    output_di: dict: {"dir"    : project directory full path,
                      "data"   : filenames for formatted data
                      "js"     : JavaScript file name
                      "html"   : HTML file name
                      "project": Project name given by user on command line
                      "title"  : Report title. The default is "CA graphs"}
    config: configparser.RawConfigParser

    Return
    ------
    None
    """
    import os
    import paplot.prep as prep
    import paplot.subcode.tools as tools

    # Create strings of thumbnails to embed in HTML
    div_txt = ""
    call_txt = ""
    detail_txt = ""
    for i in range(len(dataset["id_list"])):
        div_txt += li_template.format(id=str(i), title=dataset["id_list"][i])         # Rough thumbnail
        detail_txt += detail_template.format(id=str(i), title=dataset["id_list"][i])  # Detailed thumbnail
        call_txt += call_template.format(id=str(i), title=dataset["id_list"][i])      # Drawing rough thumbnail
#        if i >= 50:
#            if i == 50:
#                call_txt += call_later_header
#            call_txt += call_later_template.format(id = str(i), title = dataset["id_list"][i])
#        else:
#            call_txt += call_template.format(id = str(i), title = dataset["id_list"][i])

    # Overlay
    overlay_txt = overlay_template.format(id=str(len(dataset["id_list"])))

    # Get HTML template
    f_template = open(os.path.dirname(os.path.abspath(__file__)) + "/templates/graph_ca.html")  # ./templates/graph_ca.html
    html_template = f_template.read()
    f_template.close()

    # Create HTML file
    f_html = open(output_di["dir"] + "/" + output_di["html"], "w")  # Create a file under the project directory
    f_html.write(
        html_template.format(
            project=output_di["project"],  # Project name
            title=output_di["title"],      # Report title
            data_js=output_di["js"],       # JavaScript file
            version=prep.version_text(),   # Paplot version
            date=tools.now_string(),       # Cuurent time
            div_list=div_txt,              # Rough thumbnail
            details=detail_txt,            # Detailed thumbnail
            overlay=overlay_txt,           # Overlay thumbnail
            call_list=call_txt,            # Drawing rough thumbnail
            style="../style/%s" % os.path.basename(tools.config_getpath(config, "style", "path", "default.js")),  # ./style/default.js
        ))
    f_html.close()
Esempio n. 13
0
def load_genome_size(config):
    """
    Read and parse a genome-size file and return a nested list:
    [ [ A chromosome number in lowercase letters,
        The size of the 1st element,
        The color of the 1st element,
        The original name of the 1st element(that is not necessarily lowercase) or a user-defined name,
      ],
      ...
    ]
    """
    import os
    import paplot.subcode.tools as tools

    default_path = os.path.dirname(os.path.abspath(__file__)) + "/templates/genome_size_hg19.csv"  # ./templates/genome_size_hg19.csv
    path = tools.config_getpath(config, "genome", "path", default_path)

    # Create a list with Name:Label:Color for each element
    # Name is like chromosome number such as 1, 2, ..., X, Y, ...
    # :Label and :Color is optional
    settings = tools.config_getstr(config, "ca", "use_chrs").replace(" ", "").split(",")

    use_chrs = []
    labels = []
    colors = []
    for i in range(len(settings)):
        # items[0]: Name corresponding to chromosome number
        # items[1]: Label
        # items[2]: Color
        items = settings[i].split(":")
        use_chrs.append(items[0].lower())  # Conversion of chromosome number to lowercase
        labels.append("")
        colors.append("#BBBBBB")  # gray

        for j in range(len(items)):
            if j == 0:
                if items[j][0:3] == "chr":
                    use_chrs[i] = items[j][3:]  # Remove the leading "chr"
            elif j == 1:
                labels[i] = items[j]
            elif j == 2:
                colors[i] = items[j]
    if len(use_chrs) < 1:
        return []

    # Read genome size
    f = open(path)
    read = f.read()
    f.close()
    formatt = read.replace("\r", "\n").replace(" ", "")

    genome_size = []
    _max = 0
    for row in formatt.split("\n"):
        # Delimiter setting
        sept = ","
        if row.find(",") < 0:
            sept = "\t"

        # Split the line and the second element must be numeric
        # item[0]: chromosome number
        # item[1]: size of item[0]
        items = row.split(sept)
        if len(items) < 2:
            continue
        if items[1].isdigit() is False:
            continue

        # The first element must be included in the list of chromosome numbers extracted from the configuration file
        label = items[0].lower()  # Convert label to lowercase
        if label[0:3] == "chr":
            label = label[3:len(label)]  # Remove the leading "chr"
        if (label in use_chrs) is False:
            continue

        # Create a list that is an element of genome_size
        # The list has the following elements
        #   1st: A chromosome number in lowercase letters
        #   2st: The size of the 1st element
        #   3st: The color of the 1st element
        #   4st: The original name of the 1st element(that is not necessarily lowercase) or a user-defined name
        # genome_size is in the order read from the genome-size file instead of the configuration file
        pos = use_chrs.index(label)
        if labels[pos] == "":
            labels[pos] = items[0]
        genome_size.append([label, int(items[1]), colors[pos], labels[pos]])

        # Maximum size of the chromosome
        if _max < int(items[1]):
            _max = int(items[1])

    # The minimum size of the chromosomes is set to 1/10 of the maximum size
    for i in range(len(genome_size)):
        if genome_size[i][1] < int(_max / 10):
            genome_size[i][1] = int(_max / 10)

    return genome_size
Esempio n. 14
0
def load_genome_size(config):
    
    path = tools.config_getpath(config, "genome", "path", "../../config/hg19.csv")
    
    settings = tools.config_getstr(config, "sv", "use_chrs").replace(" ", "").split(",")
    use_chrs = [];
    colors = [];
    labels = [];
    
    for i in range(len(settings)):
        items = settings[i].split(":")
        use_chrs.append(items[0].lower())
        labels.append("")
        colors.append("#BBBBBB")
        
        for j in range(len(items)):            
            if j == 0: 
                if items[j][0:3] == "chr":
                    use_chrs[i] = items[j][3:]
                    
            elif j == 1:
                labels[i] = items[j]
            elif j == 2:
                colors[i] = items[j]

    if len(use_chrs) < 1:
        return []
        
    f = open(path)
    read = f.read()
    f.close()
    
    formatt = read.replace("\r", "\n").replace(" ", "")
    
    genome_size = []
    _max = 0
    for row in formatt.split("\n"):
        sept = ","
        if row.find(",") < 0:
            sept = "\t"
        items = row.split(sept)

        if len(items) < 2:
            continue
        
        if items[1].isdigit() == False:
            continue

        label = items[0].lower()
        if label[0:3] == "chr":
            label = label[3:len(label)]
            
        if (label in use_chrs) == False:
            continue
        
        pos = use_chrs.index(label)
        
        if _max < int(items[1]):
            _max = int(items[1])
        
        if labels[pos] == "":
            labels[pos] = items[0]
            
        genome_size.append([label, int(items[1]), colors[pos], labels[pos]])

    for i in range(len(genome_size)):
        if genome_size[i][1] < int(_max/10):
            genome_size[i][1] = int(_max/10)
    
    return genome_size
Esempio n. 15
0
def load_genome_size(config):

    path = tools.config_getpath(config, "genome", "path",
                                "../../config/hg19.csv")

    settings = tools.config_getstr(config, "ca",
                                   "use_chrs").replace(" ", "").split(",")
    use_chrs = []
    colors = []
    labels = []

    for i in range(len(settings)):
        items = settings[i].split(":")
        use_chrs.append(items[0].lower())
        labels.append("")
        colors.append("#BBBBBB")

        for j in range(len(items)):
            if j == 0:
                if items[j][0:3] == "chr":
                    use_chrs[i] = items[j][3:]

            elif j == 1:
                labels[i] = items[j]
            elif j == 2:
                colors[i] = items[j]

    if len(use_chrs) < 1:
        return []

    f = open(path)
    read = f.read()
    f.close()

    formatt = read.replace("\r", "\n").replace(" ", "")

    genome_size = []
    _max = 0
    for row in formatt.split("\n"):
        sept = ","
        if row.find(",") < 0:
            sept = "\t"
        items = row.split(sept)

        if len(items) < 2:
            continue

        if items[1].isdigit() == False:
            continue

        label = items[0].lower()
        if label[0:3] == "chr":
            label = label[3:len(label)]

        if (label in use_chrs) == False:
            continue

        pos = use_chrs.index(label)

        if _max < int(items[1]):
            _max = int(items[1])

        if labels[pos] == "":
            labels[pos] = items[0]

        genome_size.append([label, int(items[1]), colors[pos], labels[pos]])

    for i in range(len(genome_size)):
        if genome_size[i][1] < int(_max / 10):
            genome_size[i][1] = int(_max / 10)

    return genome_size
Esempio n. 16
0
def load_subdata(ids, sec, config):
    import os
    import paplot.subcode.tools as tools
    import paplot.convert as convert
    import paplot.color as color

    input_file = tools.config_getpath(config, sec, "path", default = "../../example/sample_summary.csv")
    if os.path.exists(input_file) == False:
        print ("[ERROR] file is not exist. %s" % input_file)
        return None

    sept = tools.config_getstr(config, sec, "sept")
    mode = tools.config_getstr(config, sec, "mode")
    comment = tools.config_getstr(config, sec, "comment")
    title = tools.config_getstr(config, sec, "title")
    
    label = []
    item = []
    colors_n_di = {}
    colors_h_di = {}
    for name_set in tools.config_getstr(config, sec, "name_set").split(","):
        name_set_split = convert.text_to_list(name_set, ":")
        for i in range(len(name_set_split)):
            text = name_set_split[i]
            if i == 0:
                item.append(text)
                if len(name_set_split) == 1:
                    label.append(text)
            elif i == 1:
                label.append(text)
            elif i == 2:
                colors_n_di[name_set_split[0]] = color.name_to_value(text)
            elif i == 3:
                colors_h_di[name_set_split[0]] = color.name_to_value(text)
    
    # fill in undefined items
    colors_n_di = color.create_color_dict(item, colors_n_di, color.osaka_subway_colors) 
    colors_h_di2 = {}
    for key in colors_n_di:
        if colors_h_di.has_key(key): continue
        colors_h_di2[key] = color.Saturation_down(colors_n_di[key])
    
    # dict to value
    colors_n = []
    for key in item:
        colors_n.append(colors_n_di[key])
    
    if mode == "range":
        item.remove(item[0])
    
    header = []
    if tools.config_getboolean(config, sec, "header") == True:
        pos_value = -1
        pos_ID = -1
    else:
        pos_value = tools.config_getint(config, sec, "col_value")
        pos_ID = tools.config_getint(config, sec, "col_ID")
        header = ["",""]
    
    # copy Ids for find check
    unlookup = []
    for iid in ids:
        unlookup.append(iid)
        
    # read
    data_text = ""
    values = []
    for line in open(input_file):
        line = line.strip()
        if len(line.replace(sept, "")) == 0:
            continue
        
        if comment != "" and line.find(comment) == 0:
            continue
        
        if len(header) == 0:
            header = convert.text_to_list(line,sept)
            try:
                colname = tools.config_getstr(config, sec, "col_value")
                pos_value = header.index(colname)
                colname = tools.config_getstr(config, sec, "col_ID")
                pos_ID = header.index(colname)
            except Exception as e:
                print(e.message)
                return None
                
            continue
        
        cols = convert.text_to_list(line,sept)
        if (cols[pos_ID] in ids) == False: continue
        else: unlookup.remove(cols[pos_ID])

        id_pos = ids.index(cols[pos_ID])
        
        if mode == "fix":
            if cols[pos_value] in item:
                data_text += subdata_data_template.format(id = id_pos, item = item.index(cols[pos_value]))
            else:
                print("[" + sec + "] name_set: data is undefined." + cols[pos_value] + "\n")
                continue
        elif mode == "range":
            try:
                values.append(float(cols[pos_value]))
            except Exception as e:
                print(colname + ": data type is invalid.\n" + e.message)
                continue
            
            data_text += subdata_data_template.format(id = id_pos, item = cols[pos_value])
            
        elif mode == "gradient":
            try:
                values.append(float(cols[pos_value]))
            except Exception as e:
                print(colname + ": data type is invalid.\n" + e.message)
                continue
            
            data_text += subdata_data_template.format(id = id_pos, item = cols[pos_value])
    
    if len(unlookup) > 0:
        print("[WARNING] can't find IDs subplot data.")
        print(unlookup)
        
    if mode == "gradient" and len(values) > 0:
        item[0] = min(values)
        item[1] = max(values)
        
    return [data_text, item, colors_n, label, title]