Class: EBICheck::Process
- Inherits:
-
Object
- Object
- EBICheck::Process
- Defined in:
- lib/ebi_check/process.rb
Overview
rubocop:disable Metrics/ClassLength
Constant Summary collapse
- EGA =
Service names to identify EGA and ENA accessions
'EGA'- ENA =
'ENA'- TEMPLATE_STUDY_INFO =
Templates for printing information
'Study ID: %s, EBI Accession Number: %s'- TEMPLATE_STUDY_ERROR =
' Error retrieving study XML - %s'- TEMPLATE_SAMPLE_INFO =
' Sample ID: %s, EBI Accession Number: %s'- TEMPLATE_SAMPLE_ERROR =
' Error retrieving sample XML - %s'- TEMPLATE_SC =
SC = Sequencescape side
' SC: %s=%s'- TEMPLATE_EBI =
EBI = EBI EGA / ENA side
' EBI: %s=%s'
Instance Method Summary collapse
-
#initialize(out = $stdout) ⇒ Process
constructor
Initializes a new EBICheck::Process instance.
-
#samples_by_accession_numbers(sample_numbers) ⇒ void
Compares local and remote sample XML data for the given sample accession numbers.
-
#samples_by_ids(sample_ids) ⇒ void
Compares local and remote sample XML data for the given sample IDs.
-
#samples_by_study_accession_numbers(study_numbers) ⇒ void
Compares local and remote sample XML data for the given study accession numbers.
-
#samples_by_study_ids(study_ids) ⇒ void
Compares local and remote sample XML data for the given study IDs.
-
#studies_by_accession_numbers(study_numbers) ⇒ void
Compares local and remote study XML data for the given study accession numbers.
-
#studies_by_ids(study_ids) ⇒ void
Compares local and remote study XML data for the given study IDs.
Constructor Details
#initialize(out = $stdout) ⇒ Process
Initializes a new EBICheck::Process instance.
44 45 46 |
# File 'lib/ebi_check/process.rb', line 44 def initialize(out = $stdout) @out = out end |
Instance Method Details
#samples_by_accession_numbers(sample_numbers) ⇒ void
This method returns an undefined value.
Compares local and remote sample XML data for the given sample accession numbers.
115 116 117 118 |
# File 'lib/ebi_check/process.rb', line 115 def samples_by_accession_numbers(sample_numbers) sample_ids = Sample::Metadata.where(sample_ebi_accession_number: sample_numbers).pluck(:sample_id) samples_by_ids(sample_ids) end |
#samples_by_ids(sample_ids) ⇒ void
This method returns an undefined value.
Compares local and remote sample XML data for the given sample IDs.
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 |
# File 'lib/ebi_check/process.rb', line 96 def samples_by_ids(sample_ids) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength samples = Sample.where(id: sample_ids) samples_by_study = samples.group_by { |sample| sample.studies.first } samples_by_study.each do |study, samples| print_study_info(study) samples.each do |sample| check_sample(sample) rescue StandardError, Faraday::Error => e out.puts format(TEMPLATE_SAMPLE_ERROR, e.) end rescue Faraday::Error => e out.puts format(TEMPLATE_STUDY_ERROR, e.) end end |
#samples_by_study_accession_numbers(study_numbers) ⇒ void
This method returns an undefined value.
Compares local and remote sample XML data for the given study accession numbers.
123 124 125 126 |
# File 'lib/ebi_check/process.rb', line 123 def samples_by_study_accession_numbers(study_numbers) study_ids = Study::Metadata.where(study_ebi_accession_number: study_numbers).pluck(:study_id) samples_by_study_ids(study_ids) end |
#samples_by_study_ids(study_ids) ⇒ void
This method returns an undefined value.
Compares local and remote sample XML data for the given study IDs.
79 80 81 82 83 84 85 86 87 88 89 90 91 |
# File 'lib/ebi_check/process.rb', line 79 def samples_by_study_ids(study_ids) # rubocop:disable Metrics/MethodLength study_ids.each do |study_id| study = Study.find_by(id: study_id) print_study_info(study) study.samples.each do |sample| check_sample(sample) rescue StandardError, Faraday::Error => e out.puts format(TEMPLATE_SAMPLE_ERROR, e.) end rescue Faraday::Error => e out.puts format(TEMPLATE_STUDY_ERROR, e.) end end |
#studies_by_accession_numbers(study_numbers) ⇒ void
This method returns an undefined value.
Compares local and remote study XML data for the given study accession numbers.
71 72 73 74 |
# File 'lib/ebi_check/process.rb', line 71 def studies_by_accession_numbers(study_numbers) study_ids = Study::Metadata.where(study_ebi_accession_number: study_numbers).pluck(:study_id) studies_by_ids(study_ids) end |
#studies_by_ids(study_ids) ⇒ void
This method returns an undefined value.
Compares local and remote study XML data for the given study IDs.
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/ebi_check/process.rb', line 51 def studies_by_ids(study_ids) # rubocop:disable Metrics/MethodLength study_ids.each do |study_id| study = Study.find_by(id: study_id) print_study_info(study) xml = local_study_xml(study) local = extract_study_fields(xml) xml = remote_study_xml(study) remote = extract_study_fields(xml) print_differences(local, remote) rescue Faraday::Error => e out.puts format(TEMPLATE_STUDY_ERROR, e.) end end |