-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Improve linking of source metadata - Centralize long (modal-extensible) lists - Test for raw data availability of genomes - Reduce requests to IRNMG (when output is empty)
- Loading branch information
1 parent
3e099c4
commit 79071af
Showing
25 changed files
with
463 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
class GenomeSequencingExperiment < ApplicationRecord | ||
belongs_to :genome | ||
belongs_to :sequencing_experiment | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
class SequencingExperiment < ApplicationRecord | ||
has_many(:genome_sequencing_experiments, dependent: :destroy) | ||
has_many(:genomes, through: :genome_sequencing_experiments) | ||
|
||
validates(:sra_accession, presence: true, uniqueness: true) | ||
before_validation(:load_from_sra_accession) | ||
|
||
include HasExternalResources | ||
include SequencingExperiment::ExternalResources | ||
|
||
class << self | ||
def by_biosample(acc) | ||
SequencingExperiment.where(biosample_accession: acc) | ||
end | ||
|
||
def by_sra(acc) | ||
SequencingExperiment.find_or_create_by(sra_accession: acc) | ||
end | ||
end | ||
|
||
def link | ||
return unless sra_accession.present? | ||
|
||
"https://www.ncbi.nlm.nih.gov/sra/#{sra_accession}[accn]" | ||
end | ||
|
||
def metadata_dom | ||
return unless metadata_xml | ||
@metadata_dom ||= Nokogiri::XML(metadata_xml) | ||
end | ||
|
||
def metadata_xpath(path) | ||
metadata_dom&.xpath(path) | ||
end | ||
|
||
def title | ||
metadata_xpath('//EXPERIMENT_SET/EXPERIMENT/TITLE')&.text || sra_acccession | ||
end | ||
|
||
def bioproject_accession | ||
@bioproject_accession ||= nil | ||
return @bioproject_accession unless @bioproject_accession.nil? | ||
|
||
study = metadata_xpath('//EXPERIMENT_SET/EXPERIMENT/STUDY_REF')&.first | ||
@bioproject_accession ||= | ||
study&.xpath( | ||
'IDENTIFIERS/EXTERNAL_ID[@namespace="BioProject"]' | ||
)&.first&.text || '' | ||
end | ||
|
||
def bioproject_link | ||
return unless bioproject_accession.present? | ||
|
||
"https://www.ncbi.nlm.nih.gov/bioproject/#{bioproject_accession}" | ||
end | ||
|
||
private | ||
|
||
def load_from_sra_accession | ||
reload_metadata! | ||
end | ||
end |
Oops, something went wrong.