Skip to content

Commit

Permalink
include gene summary sources on import
Browse files Browse the repository at this point in the history
  • Loading branch information
Adam Coffman committed Jan 21, 2015
1 parent 1b28da4 commit 442e098
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
3 changes: 1 addition & 2 deletions lib/importer/entity_maps/evidence_item.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ def self.tsv_to_entity_properties_map
'Statement' => [:text, default_processor],
'Evidence Direction' => [:clinical_direction, default_processor],
'Clinical Significance' => [:outcome, default_processor],
'stars' => [:rating, ->(x) { x.strip.to_i }]

'stars' => [:rating, ->(x) { x.strip.to_i }],
}
end

Expand Down
19 changes: 19 additions & 0 deletions lib/importer/entity_maps/gene_summary_source.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
module Importer
module EntityMaps
class GeneSummarySource < Base
def self.tsv_to_entity_properties_map
{
'Sources' => [:pubmed_id, default_multivalue_processor],
}
end

def self.mapped_entity_class
::Source
end

def self.multivalue_columns
[:pubmed_id]
end
end
end
end
4 changes: 4 additions & 0 deletions lib/importer/gene_summaries_adaptor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ def valid_row?(row)

def create_entities_for_row(row)
gene = EntityMaps::Gene.get_entity_from_row(row)
sources = EntityMaps::GeneSummarySource.get_entity_from_row(row)
sources.each do |s|
gene.sources << s
end
Scrapers::MyGeneInfo.populate_gene_metadata(gene).save
end
end
Expand Down

0 comments on commit 442e098

Please sign in to comment.