lib/genome/updaters/get_pubchem.rb
def process_pubchem_file(pubchem_file)
        alternate_names = []
        current_id = nil
        lines_processed = 0
        Zlib::GzipReader.new(pubchem_file).each_line do |line|
          (cid, name) = line.split("\t")
          lines_processed += 1
          if (current_id != cid)
            process_drug(current_id, alternate_names) unless current_id.nil?
            current_id = cid
            alternate_names = []
          end
          if name.size <= 250
            alternate_names << name
          end
          if lines_processed % 1_000_000 == 0
            puts "Processed #{lines_processed}..."
          end
        end
      end
#This file takes the format of compound_id\tname
#sorted by perceived quality, with the first entry for a given ID
#being the "primary" PubChem name
This file takes the format of compound_id\tname
sorted by perceived quality, with the first entry for a given ID
being the "primary" PubChem name
This file takes the format of compound_id \ tname sorted by perceived quality with the first entry for a given ID being the " primary " PubChem name
def process_pubchem_file(pubchem_file)
        alternate_names = []
        current_id = nil
        lines_processed = 0
        Zlib::GzipReader.new(pubchem_file).each_line do |line|
          (cid, name) = line.split("\t")
          lines_processed += 1
          if (current_id != cid)
            process_drug(current_id, alternate_names) unless current_id.nil?
            current_id = cid
            alternate_names = []
          end
          if name.size <= 250
            alternate_names << name
          end
          if lines_processed % 1_000_000 == 0
            puts "Processed #{lines_processed}..."
          end
        end
      end
def process_pubchem_file ( pubchem_file ) alternate_names = [ ] current_id = nil lines_processed = 0 Zlib :: GzipReader . new ( pubchem_file ) . each_line do | line | ( cid , name ) = line . split ( "\t" ) lines_processed += 1 if ( current_id != cid ) process_drug ( current_id , alternate_names ) unless current_id . nil? current_id = cid alternate_names = [ ] end if name . size <= 250 alternate_names << name end if lines_processed % 1_000_000 == 0 puts "Processed #{lines_processed}..." end end end
This file takes the format of compound_id\tname
sorted by perceived quality, with the first entry for a given ID
being the "primary" PubChem name
This file takes the format of compound_id \ tname sorted by perceived quality with the first entry for a given ID being the " primary " PubChem name
pubchem_file