sanger/sequencescape

Y24-245 - As lab users we would like to be able to make a submission from a Stock Plate for the 10x - CITEseq and Emseq pipelines so that we no longer need to do a fake cherrypick to reduce workload and remove creation of fake data

stevieing opened this issue · 3 comments

User story
As lab users we would like to be able to make a submission from a Stock Plate for the 10x - CITEseq and Emseq pipelines so that we no longer need to do a fake cherrypick to reduce workload and remove creation of fake data

Who are the primary contacts for this story
Steve / Liz

Who is the nominated tester for UAT
SSRs / ??

Acceptance criteria
To be considered successful the solution must allow:

  • Add stock plate to the list of acceptable puroposes for Limber PCR bespoke request type
  • Update the appropriate relationships
  • Release onto UAT from branch to try and test the process end to end to ensure there are no hidden issues
  • Add a scenario to the existing integration suite test to create a plate of purpose 'Stock Plate' with a submission for Bespoke PCR on it and check you can create the first child plate 'LBB Ligation'

Dependencies
This story is blocked by the following dependencies:

  • #<issue_no.>
  • sanger/#<issue_no.>

References
This story has a non-blocking relationship with:

  • #4127
  • sanger/#<issue_no.>

Additional context
Add any other context or screenshots about the feature request here.

For existing DB (e.g. UAT and PROD), use the following steps to manually update the Stock Plate purpose:

login to the server, e.g.
ssh sss0-uat.psd.sanger.ac.uk

Go to the current release directory:
cd /var/www/sequencescape/current/

Run the console
bundle exec rails c

#find the stock plate
p = PlatePurpose.find_by(name:"Stock Plate")

#update the type
p.type = 'PlatePurpose::Input'

#save it
p.save

Check the uat database, i.e. psdd. in Mysql Workbench, run query:
select * from sequencescape_staging.plate_purposes where name = 'Stock Plate';
check if the stock plate type is 'PlatePurpose::Input'.
If so, that should mean the update is successful.

The issue with the cucumber tests is that the pooling behaviour for wells is overridden for plates with PlatePurpose::Input at app/models/plate_purpose/input.rb:54.

Attached following is the numbered trace of the execution flow:

  1. app/models/tag_layout.rb:60
  2. app/models/tag_layout/walk_wells_by_pools.rb:6
  3. app/models/plate.rb:83
  4. app/models/plate_purpose.rb:69
  5. app/models/plate_purpose/input.rb:54

In app/models/well.rb we have the following scopes declared:

scope :pooled_as_target_by_transfer,
      -> do
        joins("LEFT JOIN transfer_requests patb ON #{table_name}.id=patb.target_asset_id")
          .select_table
          .select('patb.submission_id AS pool_id')
          .distinct
      end

scope :pooled_as_source_by,
      ->(type) do
        joins("LEFT JOIN requests pasb ON #{table_name}.id=pasb.asset_id")
          .where(
            [
              '(pasb.sti_type IS NULL OR pasb.sti_type IN (?)) AND pasb.state IN (?)',
              [type, *type.descendants].map(&:name),
              Request::Statemachine::OPENED_STATE
            ]
          )
          .select_table
          .select('pasb.submission_id AS pool_id')
          .distinct
      end

The input plates use pooled_as_source_by in the overridden function that's used to pool wells.

Image

It says there in the PlatePurpose::Input comments (see the image above) that each well requires to have requests associated with them, but we do not have requests attached to the wells of this input plate. This causes the pooled_as_source_by call to return an empty list eventually failing the test by not letting the application attach tags to the primary aliquot of each well.

There's one more update to be done for this.

As @wendyyang has mentioned above, we need to set the stock plate as an input plate.

Also, we will have to populate request_type_plate_purposes table with a record associating the request type limber_chromium_bespoke (its ID) with plate purpose Stock Plate (its ID).

As far as I know, this is done with the record loader. However, record loader only allows purposes in config/default_records/plate_purposes and it is not possible to add Stock Plate into it as Stock Plate purpose is already populated in the purposes table.

I think we will have to add a new record to the table associating limber_chromium_bespoke (its ID) with plate purpose Stock Plate (its ID).