Skip to content

Commit

Permalink
Revert "Fetch genotype file via HTTPS"
Browse files Browse the repository at this point in the history
This reverts commit 433e7a5.
  • Loading branch information
tsujigiri committed Nov 15, 2015
1 parent d96de27 commit 1933157
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions app/workers/parsing.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
class Parsing
include Sidekiq::Worker
GENOTYPE_FILE_BASE_URL = 'https://opensnp.org'

sidekiq_options queue: :user_snps, retry: 5, unique: true

attr_reader :genotype, :temp_table_name, :normalized_csv, :stats, :start_time
Expand Down Expand Up @@ -43,8 +41,8 @@ def create_temp_table
end

def normalize_csv
rows = genotype_file.each_line
.reject { |line| line.start_with?('#') } # Skip comments
rows = File.readlines(genotype.genotype.path)
.reject { |line| line.start_with?('#') } # Skip comments
stats[:rows_without_comments] = rows.length
csv = send(:"parse_#{genotype.filetype.gsub('-', '_').downcase}", rows)
known_chromosomes = ['MT', 'X', 'Y', (1..22).map(&:to_s)].flatten
Expand All @@ -62,14 +60,6 @@ def normalize_csv
stats[:rows_after_parsing] = csv.length
end

def genotype_file
if Rails.env.production?
open("#{GENOTYPE_FILE_BASE_URL}#{genotype.genotype.url}")
else
open(genotype.genotype.path)
end
end

def copy_csv_into_temp_table
sql = <<-SQL
COPY #{temp_table_name} (
Expand Down

0 comments on commit 1933157

Please sign in to comment.