File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -51,20 +51,15 @@ def external_sra_to_biosample(acc)
5151 ##
5252 # Find SRA entries linked to the BioSample +acc+ and return as Array
5353 def external_biosample_to_sra ( acc )
54- uri = "https://www.ebi.ac.uk/ena/browser/api/xml/ebisearch ?" +
55- "query=BIOSAMPLE:#{ acc } &includeLinks=true&domain=sra-experiment "
54+ uri = "https://www.ebi.ac.uk/ebisearch/ws/rest/sra-experiment ?" +
55+ "query=BIOSAMPLE:#{ acc } "
5656 body = external_request ( uri )
5757 return unless body . present?
5858
5959 ng = Nokogiri ::XML ( body )
60- ng . xpath ( '//EXPERIMENT_SET/EXPERIMENT' ) . map do |exp |
61- sra_acc = exp [ 'accession' ] || exp . xpath ( './IDENTIFIERS/PRIMARY_ID' ) . text
62- SequencingExperiment . find_or_create_by ( sra_accession : sra_acc ) do |se |
63- se . external_reuse_metadata_xml = true
64- se . queued_external = nil
65- se . retrieved_at = DateTime . now
66- se . metadata_xml = "<EXPERIMENT_SET>\n #{ exp . to_s } \n </EXPERIMENT_SET>"
67- end
60+ ng . xpath ( '//result/entries/entry' ) . map do |exp |
61+ sra_acc = exp [ 'acc' ] || exp [ 'id' ] or next
62+ SequencingExperiment . find_or_create_by ( sra_accession : sra_acc )
6863 end
6964 end
7065
You can’t perform that action at this time.
0 commit comments