mountetna / monoetna

mono-repository version of etna projects
GNU General Public License v2.0
1 stars 0 forks source link

Magma: one-to-many link within the same model #947

Closed coleshaw closed 2 years ago

coleshaw commented 2 years ago

To support sc_seq, Magma needs to be able to construct one-to-many (collection) relationships within a single model. This would mimic the reference_patient (one-to-one, child) attribute in IPI, and would be used for constructing a "bundle" of related sc_seq records.

graft commented 2 years ago

Isn't this just the same as collection?

coleshaw commented 2 years ago

Except I think we weren't sure that would actually work within the same model? i.e. can a sc_seq record have a collection of sc_seq records?

coleshaw commented 2 years ago

If you've tested that and are sure it works, then we can close this issue and add that attribute to the sc_seq model in coprojects_template, since I think the DS were waiting on engineering to confirm that feature is available.

coleshaw commented 2 years ago

I don't recall the exact (biology) terms that folks agreed on...but it was something like "associated assays", i.e. the primary entry point would be a GEX sc_seq record, that would then have as a collection the associated CITE / ATAC seq records? Sorry, bad memory for the final, agreed upon attribute names :disappointed:

Am I mis-remembering that discussion? Probably from several modelling meetings ago.

graft commented 2 years ago

I am not sure this works, but the attribute behavior seems consistent with collection here. There are examples of collection collecting links e.g. rna_seq_plate though not in the same model.

dtm2451 commented 2 years ago

Can confirm @coleshaw! This is what I get if I try to apply a csv with the attributes discussed in modeling meetings:

dan@pop-os:~/GitHub/monoetna$ etna administrate models apply_template coprojects_template --environment development --file ~/Downloads/coprojects_template_models_project_tree_TEST.csv 
Traceback (most recent call last):
    9: from /home/dan/.rbenv/versions/2.7.6/bin/etna:23:in `<main>'
    8: from /home/dan/.rbenv/versions/2.7.6/bin/etna:23:in `load'
    7: from /home/dan/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/etna-0.1.45/bin/etna:29:in `<top (required)>'
    6: from /home/dan/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/etna-0.1.45/lib/etna/application.rb:190:in `run_command'
    5: from /home/dan/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/etna-0.1.45/lib/commands.rb:318:in `execute'
    4: from /home/dan/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/etna-0.1.45/lib/commands.rb:376:in `load_models_from_csv'
    3: from /home/dan/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/etna-0.1.45/lib/commands.rb:376:in `open'
    2: from /home/dan/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/etna-0.1.45/lib/commands.rb:377:in `block in load_models_from_csv'
    1: from /home/dan/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/etna-0.1.45/lib/etna/clients/magma/workflows/add_project_models_workflow.rb:42:in `prepare_changeset_from_csv'
/home/dan/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/etna-0.1.45/lib/etna/clients/magma/workflows/add_project_models_workflow.rb:47:in `validate_changeset': undefined method `models' for #<Array:0x0000565400620db8> (NoMethodError)

The csv: coprojects_template_models_project_tree_TEST.csv

The attributes:

coleshaw commented 2 years ago

Yes, I agree that it is consistent with collection, but I think it was up to us to verify if that behavior worked or didn't work within the same model ... i.e. would it break Magma if we added it to the model, right now? :shrug:

dtm2451 commented 2 years ago

*confirmed specifically that the etna path fails to interpret what was wanted to happen, not whether or not magma could handle the link or not. But hopefully my message gives more full context of the desired attributes.

coleshaw commented 2 years ago

Thanks @dtm2451 , I think that concrete example helps!

So I think there are two related tasks for this issue, then:

coleshaw commented 2 years ago

Tasks: