code: def create_assay_file(self, assays_to_parse, file_name):
      cid_start = time.time()
      assay_paths, cid_ref_list = self.create_cid_list(assays_to_parse)
      cid_end = time.time()
  
      print(
          "CID length is: {0}, created in: {1} hours".format(
              cid_ref_list.size, (cid_end - cid_start) / 3600
          )
      )
      print("Creating overview of {0} assays".format(len(assay_paths)))
  
      path_final = os.path.join(data_dir, file_name)
      assay_results = list()
      assay_names = list()
      cid_len = cid_ref_list.size
  
      all_assay_start = time.time()
  
      for assay_path in assay_paths:
          assay_start = time.time()
  
          filename = os.path.basename(assay_path)
          assay_name = "PCBA-" + filename.replace(".csv", "")
          print("Looking at: {0}".format(assay_name))
  
          df = pd.read_csv(
              assay_path,
              usecols=["PUBCHEM_CID", "PUBCHEM_ACTIVITY_OUTCOME"],
          )
          df = df.dropna(
              subset=["PUBCHEM_CID", "PUBCHEM_ACTIVITY_OUTCOME"]
          )
          if len(df.index) == 0:
              continue
          df["IS_ACTIVE"] = df["PUBCHEM_ACTIVITY_OUTCOME"] == "Active"
          df = df.rename(columns={"IS_ACTIVE": assay_name})
          df["PUBCHEM_CID"] = df["PUBCHEM_CID"].astype(int)
          df[assay_name] = df[assay_name].astype(int)
          df = df.set_index("PUBCHEM_CID")
          df = df[~df.index.duplicated(keep="last")]
  
          assay_results_array = array.array(
              "i", (-1 for i in range(0, cid_len))
          )
          print(assay_path)
          for i in range(0, cid_len):
              cid = cid_ref_list[i]
              if cid in df.index:
                  val = df.get_value(cid, assay_name)
              else:
                  # Just write NA
                  val = -1
  
              assay_results_array[i] = val
  
          assay_names.append(assay_name)
          assay_results.append(assay_results_array)
          assay_end = time.time()
          print(
              "Parsed: {0} in {1} seconds".format(
                  assay_name, assay_end - assay_start
              )
          )
  
      # Now, write out the results csv, going line by line through all molecule results
      assay_results_len = len(assay_results)
  
      all_assay_end = time.time()
  
      print(
          "Parsed all assays in: {} hours".format(
              (all_assay_end - all_assay_start) / 3600
          )
      )
  
      smiles_start = time.time()
  
      print("Reading in smiles info")
      with open(
          os.path.join(data_dir, "pubchemsmiles_tuple.pickle"), "rb"
      ) as f:
          keys, values = pickle.load(f)
  
      header_line = list()
      header_line.append("mol_id")
      header_line.append(",smiles")
      for assay_name in assay_names:
          header_line.append(",")
          header_line.append(assay_name)
      header_line_txt = "".join(header_line)
  
      f_final = open(path_final, "w+")
      f_final.write(header_line_txt + "\n")
  
      for i in range(0, cid_len):
          cid = cid_ref_list[i]
  
          # printing the mol_id
          line_for_comp = "CID" + str(cid)
  
          # printing the SMILES
          bisect_pos = bisect_left(keys, cid, 0)
          cid_pos = (
              bisect_pos
              if bisect_pos != len(keys) and keys[bisect_pos] == cid
              else -1
          )
  
          if cid_pos == -1:
              continue
  
          line_for_comp += "," + str(values[cid_pos])
          for j in range(0, assay_results_len):
              val = assay_results[j][i]
              if val == -1:
                  line_for_comp += ","
              else:
                  line_for_comp += "," + str(val)
          f_final.write(line_for_comp + "\n")
  
      f_final.close()
  
      # Now gzip it
      with open(path_final, "rb") as f_in:
          with gzip.open(path_final + ".gz", "wb") as f_out:
              shutil.copyfileobj(f_in, f_out)
  
      # Now remove the intermediate csv
      os.remove(path_final)
      smiles_end = time.time()
  
      print(
          "Smiles joined and gzip in: {} hours".format(
              (smiles_end - smiles_start) / 3600
          )
      )
  
      print(
          "Finished creating dataset: {} in: {} hours".format(
              file_name, (smiles_end - all_assay_start) / 3600
          )
      )
  
file_path: deepchem/contrib/pubchem_dataset/create_assay_overview.py
imports: import pandas
  import os
  import pickle
  import array
  from bisect import bisect_left
  import gzip
  import time
  import shutil
  import deepchem
  import requests
  import argparse
  import numpy
label_desc: Use image node_id 7 for calling the PCBADatsetBuilder obj's underlying member method code with example usage: obj.create_assay_file(assays_to_parse, file_name) without return types