Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Y24-410 - [BUG] Unable to update/send EGA sample metadata #4432

Open
neilsycamore opened this issue Oct 18, 2024 · 4 comments
Open

Y24-410 - [BUG] Unable to update/send EGA sample metadata #4432

neilsycamore opened this issue Oct 18, 2024 · 4 comments
Assignees
Labels
Bug Bug in code Data integrity Data Integrity Must've MoSCoW Prioritization - Must Have Capability/Feature Value: 5 Value to the insitute is very high

Comments

@neilsycamore
Copy link
Contributor

neilsycamore commented Oct 18, 2024

Describe the bug
Creating accession identifiers for samples works fine however should a user need to update a sample's metadata when this is sent to the EGA webin submit service and error is displayed and the data is not updated in SS (this only applies to EGA accessioning service NOT the ENA). In summary creation is fine but the update is not working.

To Reproduce
Steps to reproduce the behaviour:
In a Sequencescape console:

def get_next_uat_sample(manifest_id=19348)
  sm = SampleManifest.find_by(id:manifest_id) #manifest created for testing data
  sample = sm.samples.select {|s| s.ebi_accession_number.nil?}.first #first sample without accession id
  sample.sample_metadata.update!(gender:'Unknown',phenotype:'Unknown') #data is initially missing to prevent auto accessioning on manifest upload
  puts "https://uat.sequencescape.psd.sanger.ac.uk/samples/#{sample.id}" #goto url
end
irb(main):020:0> get_next_uat_sample(manifest_id=19348)
https://uat.sequencescape.psd.sanger.ac.uk/samples/6970962

On UAT sample page select 'Generate Accession Number'
Screenshot 2024-10-18 at 12 33 04

Next select 'Update EBI Sample data
Screenshot 2024-10-18 at 12 34 29

Expected behaviour
Screenshot 2024-10-18 at 12 42 13

Additional context
The error message "Could not get accession number. EBI may be down or invalid data submitted: 500 Internal Server Error" is also returned when attempting to update sample accession metadata within the application script console

@neilsycamore neilsycamore added Bug Bug in code Value: 5 Value to the insitute is very high Must've MoSCoW Prioritization - Must Have Capability/Feature labels Oct 18, 2024
@psd-issuer psd-issuer bot changed the title [BUG] Unable to update/send EGA sample metadata Y24-410 - [BUG] Unable to update/send EGA sample metadata Oct 18, 2024
@neilsycamore neilsycamore added the Data integrity Data Integrity label Oct 18, 2024
@wendyyang wendyyang self-assigned this Nov 5, 2024
@wendyyang
Copy link
Contributor

wendyyang commented Nov 13, 2024

I have investigated the errors. The followings are the steps for investigations:

  1. set up a local SS using UAT config by modifying the config/config.rb:

     configatron.accession do |accession|
             # copy from the deployment file
             # accession.url = 'http://localhost:9999/accession_service/'
             # accession.view_url = 'http://localhost:9999/view_accession/'
             accession.url = 'https://wwwdev.ebi.ac.uk/ena/submit/drop-box/submit'
             accession.view_url = 'https://wwwdev.ebi.ac.uk/ena/data/view/'
             
             # accession.ega.user = 'ega_accession_login'
             # accession.ega.password = 'ega_accession_password'
             # accession.ena.user = 'era_accession_login'
             # accession.ena.password = 'era_accession_password'
             
             # find out the value from vault and replace     
             accession.ega.user      = 'ega-box-03'
             accession.ega.password  = 'xxxxxxxxx'
             accession.ena.user      = 'era-drop-2'
             accession.ena.password  = 'xxxxxxxxx'
        end
    
  2. run the local SS. using UAT database:
    DATABASE_URL=mysql2://psdd:xxxxxx@xxxxxx:3321/sequencescape_staging
    bundle exec rails s

Outcomes from the investigations:
When click the 'Update EBI Sample data' at (http://127.0.0.1:3000/samples/accession/6970962)

The code break at app/models/accession_service.rb
response = rc.post(payload)

inside
def post_files(file_params)

and redirect back to sample page

At this point, some of the variables values are:
payload:

{"SAMPLE"=>#AccessionService::AccessionedFile:/var/folders/gp/t2pcm07d3tq0yrymvqnj20xm0000gq/T/sample_file20241113-71882-cdpmls, "SUBMISSION"=>#AccessionService::AccessionedFile:/var/folders/gp/t2pcm07d3tq0yrymvqnj20xm0000gq/T/submission_file20241113-71882-q6k2yq}

The file /var/folders/gp/t2pcm07d3tq0yrymvqnj20xm0000gq/T/sample_file20241113-71882-cdpmls :

<TITLE>2405STDY8433361</TITLE>human9606strainsample_descriptiongenderunknownphenotypeUnknownsubject_id2405STDY8433361geographic_location_(country_and/or_sea)missing: human-identifiablecollection_date2024

The file /var/folders/gp/t2pcm07d3tq0yrymvqnj20xm0000gq/T/submission_file20241113-71882-q6k2yq :

restclient:

@block=nil,
@options={:user=>"ega-box-03", :password=>"SanGeRBOX**", :headers=>{:user_agent=>"Sequencescape Accession Client (development)"}},
@url="https://wwwdev.ebi.ac.uk/ena/submit/drop-box/submit">

response:
Could not get accession number. EBI may be down or invalid data submitted here:
500 Internal Server Error

@wendyyang
Copy link
Contributor

However in UAT, clicking 'https://uat.sequencescape.psd.sanger.ac.uk/samples/6970962' 'Update EBI Sample data', got the response:

Could not get accession number. Error in submitted data: ["\n - In sample, accession: "EGAN00004611033". The current submission account EGAB00000000006 does not own the object being updated ERS21332394."].

@wendyyang
Copy link
Contributor

As we are investigating this bug using UAT, and https://wwwdev.ebi.ac.uk/ena/submit/drop-box/submit. There may be difference from the production DB. However, we couldn't use the real examples to test.

Regarding the different responses we got back, I found the one 'The current submission account EGAB00000000006 does not own the object being updated ...' is because the sample has been removed from EBI test database, (the test DB update every 24 hours). So we can ignore this response.

When the sample is still in EBI test database, and we try to update the sample, the error we got back is 'Could not get accession number. EBI may be down or invalid data submitted: 500 Internal Server Error'. Details of the response looks like the following:

<RECEIPT receiptDate="2024-11-19T14:20:49.524Z" submissionFile="submission_62.xml" success="false">
  <SAMPLE alias="44a1fc3e-a340-11ef-9b56-02423c45b5b8" status="PRIVATE"/>
  <SUBMISSION alias="8967bd3c-8d41-11ef-ac4b-0242c01b973620241119T1417"/>
  <MESSAGES>
    <ERROR>Failed to submit samples to BioSamples</ERROR>
    <ERROR>Failed to submit samples to BioSamples</ERROR>
    <ERROR>An exception occurred: java.lang.RuntimeException: Failed to submit all samples to BioSamples</ERROR>
    <INFO>This submission is a TEST submission and will be discarded within 24 hours</INFO>
  </MESSAGES>
  <ACTIONS>MODIFY</ACTIONS>
  <ACTIONS>PROTECT</ACTIONS>
</RECEIPT>

@wendyyang
Copy link
Contributor

wendyyang commented Nov 20, 2024

The following URL was also used to send the request directly and can see the details of the response. https://wwwdev.ebi.ac.uk/ena/submit/drop-box/swagger-ui/index.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Bug in code Data integrity Data Integrity Must've MoSCoW Prioritization - Must Have Capability/Feature Value: 5 Value to the insitute is very high
Projects
None yet
Development

When branches are created from issues, their pull requests are automatically linked.

3 participants