bthuronyi / CloneCoordinate

CloneCoordinate issue tracking
1 stars 0 forks source link

Multi-marker constructs break Sequencing "Assembly components with same marker as construct" #83

Closed bthuronyi closed 2 months ago

bthuronyi commented 3 months ago

"Assembly components with same marker as construct" in Sequencing doesn't properly handle constructs that have multiple antibiotic resistance markers. Instead, they are just not listed. This could be addressed by changing how markers are looked up in the Registry by the formula here.

evelynqi commented 3 months ago

Notes: -The problem right now it uses an (index, match == marker) condition. This doesn't work because if the part's construct marker is Cm and the construct marker is Cm,Km, these are not equal. There is also a problem where Cm,Km != Km,Cm. -Thinking about using a regexmatch...

evelynqi commented 3 months ago

-Also thinking about separating the conditional to look at Marker 1 and Marker 2 instead of the combined Marker

bthuronyi commented 3 months ago

One thing that could help is that the combined marker field is sorted, as I recall. So it's predictable. But yeah, regexmatch is almost certainly needed!

evelynqi commented 2 months ago

Talk with B: -This column helps with identifying which parts are from constructs that have the same marker as the antibiotic plate we are plating on to see where misassembly can arise. It would be helpful to add a column on the transformation sheet for lab members to identify what type of plate they plated on (required? no consensus yet). The part's donor plasmids antibiotic resistance marker would then need to be compared to that of the plate!

To do: -Add column -Transfer data of what it was plated on -Code regexmatch with transformation plate

evelynqi commented 2 months ago

https://docs.google.com/spreadsheets/d/1l7FTz599mQRtRKJ22gTEKHh-tkxkMDrYpmAAl_V1TwI/edit?usp=sharing

evelynqi commented 2 months ago

https://docs.google.com/spreadsheets/d/1l7FTz599mQRtRKJ22gTEKHh-tkxkMDrYpmAAl_V1TwI/edit?usp=sharing

Added new col in transformations sheet (U: Transformations_Antibiotic_plated)

Original Code: =if($K72="","", switch(left(K72), "s","", "a", IFERROR(join(" ",let(output, unique(arrayformula(trim(bycol( bycol(index(USER_u_Part_1:USER_u_Part_5,xmatch(K72,USER_u_ID)), lambda(x,if(x="","",index(dsDNA_d_Input_DNA,xmatch(x,dsDNA_d_ID))))), lambda(x,if(or(x="",x="anneal"),"",iferror(if(index(Registry_Marker,xmatch(x,Registry_Construct_name))=R72,x,""),"")))))),TRUE), filter(output, output<>""))), ""), "g",index(Golden_Gate_g_Assembly_constructs_with_same_marker,xmatch(K72,Golden_Gate_g_ID)), ""))

New Code: =if($K72="","", switch(left(K72), "s","", "a", IFERROR(join(" ",let(output, unique(arrayformula(trim(bycol( bycol(index(USER_u_Part_1:USER_u_Part_5,xmatch(K72,USER_u_ID)), lambda(x,if(x="","",index(dsDNA_d_Input_DNA,xmatch(x,dsDNA_d_ID))))), lambda(x,if(or(x="",x="anneal"),"",iferror(if(index(Registry_Marker,xmatch(x,Registry_Construct_name))=index(Transformations_Antibiotic_plated,xmatch($K72,Transformations_Source_ID)),x,""),"")))))),TRUE), filter(output, output<>""))), ""), "g",index(Golden_Gate_g_Assembly_constructs_with_same_marker,xmatch(K72,Golden_Gate_g_ID)), ""))

Similar code implemented in the Golden Gate (AH- Parts with same resistance as final construct)

Example: g109 is a Golden Gate construct with Cm, Km. If the transformation plate is Km, there are no constructs shown in assembly components with same marker as construct while all the parts are shown when the transformation plate is changed to Cm in the transformation plates.

evelynqi commented 2 months ago

New miniprep code:

=if($K3="","", switch(left(K3), "s","", "a", IFERROR(join(" ",let(output, unique(arrayformula(trim(bycol( bycol(index(USER_u_Part_1:USER_u_Part_5,xmatch(K3,USER_u_ID)), lambda(x,if(x="","",index(dsDNA_d_Input_DNA,xmatch(x,dsDNA_d_ID))))), lambda(x,if(or(x="",x="anneal"),"",iferror(if(AND(ARRAYFORMULA(REGEXMATCH(index(Registry_Marker,xmatch(x,Registry_Construct_name)), index(Transformations_Antibiotic_plated,xmatch($K3,Transformations_Source_ID))))), x,""),"")))))),TRUE), filter(output, output<>""))), ""), "g",index(Golden_Gate_g_Assembly_constructs_with_same_marker,xmatch(K3,Golden_Gate_g_ID)), ""))

New Golden Gate code:

=if(A3="","", trim(join(" ", bycol(DC3:DL3,lambda(col,ifs( col="","", AND(ARRAYFORMULA(REGEXMATCH(index(Registry_Marker,xmatch(col,Registry_Construct_name)), index(Transformations_Antibiotic_plated,xmatch($B3,Transformations_Source_ID))))), col, TRUE,""))))) )

Instead of what I had above, this code allows the parts to have other resistance markers than what is plated on. So if part 1 had both Km and Cb resistance markers and we plated our final construct on a Km plate, part 1 would appear as an assembly component with same marker as construct. Also, I think we should rename the column to assembly components with same marker of antibiotic plate (or something like this).

evelynqi commented 2 months ago

https://docs.google.com/spreadsheets/d/1l7FTz599mQRtRKJ22gTEKHh-tkxkMDrYpmAAl_V1TwI/edit?usp=sharing

bthuronyi commented 2 months ago

Also, I think we should rename the column to assembly components with same marker of antibiotic plate (or something like this).

Agreed!

bthuronyi commented 2 months ago

Looks good! My only comment is that the ARRAYFORMULA is redundant. None of the arguments to it are arrays -- INDEX returns a single value in each case -- so you should just remove it.

Otherwise go ahead and implement in live CC!

evelynqi commented 2 months ago

Okay, during implementation, I noticed a problem. Sequencing "Assembly components with same marker as construct" takes the result from the "Assembly components with same marker as construct" in the miniprep sheet, which makes sense. However, if the construct is a golden gate construct, the code takes the result from the "Parts with same resistance as final construct" in the Golden Gate sheet. Since my code compares the construct part's marker to the one of the plate during transformations, the logic doesn't work because some golden gates don't make it to transformation so that gID does not exist in the transformation sheet and doesn't have parts with same resistance as the plate because it wasn't plated. There are a couple of solutions: 1) Get rid of the "Parts with same resistance as final construct" on the golden gate sheet and have the code all in the miniprep sheet, when we know for sure that the golden gate assembly had been transformed 2) Have all the code in the miniprep sheet's "Assembly components with same marker as construct" that checks parts' resistance marker against the antibiotic of the plate and have new code on the golden gate "Parts with same resistance as final construct" that checks the parts' resistance marker with the constructs.