Skip to content

Commit

Permalink
Patch index parsing (#538)(patch)
Browse files Browse the repository at this point in the history
### Fixed
- Patch the way indexes are parsed in order to comply with the new naming format.
  • Loading branch information
Karl-Svard authored Oct 1, 2024
1 parent 61875d9 commit 547e9eb
Show file tree
Hide file tree
Showing 20 changed files with 25 additions and 24 deletions.
11 changes: 6 additions & 5 deletions cg_lims/get/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,19 +67,20 @@ def get_artifact_well(artifact: Artifact) -> str:

def get_index_well(artifact: Artifact):
"""Parsing out the index well position from the reagent label string which
typically looks like this: 'A05 IDT_10nt_446 (AGCGTGACCT-CCATCCGAGT)'
typically looks like this: '44_A05 IDT_10nt_446 (AGCGTGACCT-CCATCCGAGT)'
"""

if artifact.reagent_labels:
# Assuming one reagent label per artifact (reagent_labels is a list):
reagent_label = artifact.reagent_labels[0]
reagent_label: str = artifact.reagent_labels[0]

# Getting the index well:
index_well_with_zero = reagent_label.split(" ")[0]
index_well_with_zero_and_us: str = reagent_label.split(" ")[0]
index_well_with_zero: str = index_well_with_zero_and_us.split("_")[1]

# Picking out column and removing zeros by int():
index_well_col = int(index_well_with_zero[1:])
index_well_row = index_well_with_zero[0]
index_well_col: int = int(index_well_with_zero[1:])
index_well_row: str = index_well_with_zero[0]
return f"{index_well_row}{index_well_col}"
else:
return "-"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
</location>
<working-flag>true</working-flag>
<sample uri="http://127.0.0.1:8000/api/v2/samples/ACC7892A1" limsid="ACC7892A1" />
<reagent-label name="A01 UDP0001 (GAACTGAGCG-TCGTGGAGCG)" />
<reagent-label name="01_A01 UDP0001 (GAACTGAGCG-TCGTGGAGCG)" />
<workflow-stages />
</art:artifact>
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
</location>
<working-flag>true</working-flag>
<sample uri="http://127.0.0.1:8000/api/v2/samples/ACC7892A5" limsid="ACC7892A5" />
<reagent-label name="A02 UDP0009 (GACTGAGTAG-GTTGATAGTG)" />
<reagent-label name="09_A02 UDP0009 (GACTGAGTAG-GTTGATAGTG)" />
<workflow-stages />
</art:artifact>
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
</location>
<working-flag>true</working-flag>
<sample uri="http://127.0.0.1:8000/api/v2/samples/ACC7892A9" limsid="ACC7892A9" />
<reagent-label name="A03 UDP0017 (GAGAATGGTT-TCGGCAGCAA)" />
<reagent-label name="17_A03 UDP0017 (GAGAATGGTT-TCGGCAGCAA)" />
<workflow-stages />
</art:artifact>
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
</location>
<working-flag>true</working-flag>
<sample uri="http://127.0.0.1:8000/api/v2/samples/ACC7892A13" limsid="ACC7892A13" />
<reagent-label name="A04 UDP0025 (AACCATAGAA-GGCGAGATGG)" />
<reagent-label name="25_A04 UDP0025 (AACCATAGAA-GGCGAGATGG)" />
<workflow-stages />
</art:artifact>
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
</location>
<working-flag>true</working-flag>
<sample uri="http://127.0.0.1:8000/api/v2/samples/ACC7892A16" limsid="ACC7892A16" />
<reagent-label name="A05 UDP0033 (TGATTATACG-GTCGATTACA)" />
<reagent-label name="33_A05 UDP0033 (TGATTATACG-GTCGATTACA)" />
<workflow-stages />
</art:artifact>
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
</location>
<working-flag>true</working-flag>
<sample uri="http://127.0.0.1:8000/api/v2/samples/ACC7892A57" limsid="ACC7892A57" />
<reagent-label name="A06 UDP0041 (ACTCGGCAAT-GACAACTGAA)" />
<reagent-label name="41_A06 UDP0041 (ACTCGGCAAT-GACAACTGAA)" />
<workflow-stages />
</art:artifact>
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
</location>
<working-flag>true</working-flag>
<sample uri="http://127.0.0.1:8000/api/v2/samples/ACC7892A64" limsid="ACC7892A64" />
<reagent-label name="A07 UDP0049 (AGTGTTGCAC-CTGGTACACG)" />
<reagent-label name="49_A07 UDP0049 (AGTGTTGCAC-CTGGTACACG)" />
<workflow-stages />
</art:artifact>
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
</location>
<working-flag>true</working-flag>
<sample uri="http://127.0.0.1:8000/api/v2/samples/ACC7892A65" limsid="ACC7892A65" />
<reagent-label name="A08 UDP0057 (TCTATCCTAA-CGTCGACTGG)" />
<reagent-label name="57_A08 UDP0057 (TCTATCCTAA-CGTCGACTGG)" />
<workflow-stages />
</art:artifact>
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
</location>
<working-flag>true</working-flag>
<sample uri="http://127.0.0.1:8000/api/v2/samples/ACC7892A70" limsid="ACC7892A70" />
<reagent-label name="A09 UDP0065 (TAATGTGTCT-GTAAGGCATA)" />
<reagent-label name="65_A09 UDP0065 (TAATGTGTCT-GTAAGGCATA)" />
<workflow-stages />
</art:artifact>
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
</location>
<working-flag>true</working-flag>
<sample uri="http://127.0.0.1:8000/api/v2/samples/ACC7892A73" limsid="ACC7892A73" />
<reagent-label name="A10 UDP0073 (CCTGCGGAAC-ATCATAGGCT)" />
<reagent-label name="73_A10 UDP0073 (CCTGCGGAAC-ATCATAGGCT)" />
<workflow-stages />
</art:artifact>
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
</location>
<working-flag>true</working-flag>
<sample uri="http://127.0.0.1:8000/api/v2/samples/ACC7892A78" limsid="ACC7892A78" />
<reagent-label name="A11 UDP0081 (TGTCGCTGGT-TCGTCTGACT)" />
<reagent-label name="81_A11 UDP0081 (TGTCGCTGGT-TCGTCTGACT)" />
<workflow-stages />
</art:artifact>
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
</location>
<working-flag>true</working-flag>
<sample uri="http://127.0.0.1:8000/api/v2/samples/ACC7892A81" limsid="ACC7892A81" />
<reagent-label name="A12 UDP0089 (GTCCGTAAGC-CGTGTATCTT)" />
<reagent-label name="89_A12 UDP0089 (GTCCGTAAGC-CGTGTATCTT)" />
<workflow-stages />
</art:artifact>
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
</location>
<working-flag>true</working-flag>
<sample uri="http://127.0.0.1:8000/api/v2/samples/ACC7892A92" limsid="ACC7892A92" />
<reagent-label name="B01 UDP0002 (AGGTCAGATA-CTACAAGATA)" />
<reagent-label name="02_B01 UDP0002 (AGGTCAGATA-CTACAAGATA)" />
<workflow-stages />
</art:artifact>
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</location>
<working-flag>true</working-flag>
<sample uri="http://127.0.0.1:8000/api/v2/samples/ACC7271A5" limsid="ACC7271A5"/>
<reagent-label name="A02 IDT_10nt_652 (ACAACCAACT-ACCATCTTGT)"/>
<reagent-label name="09_A02 IDT_10nt_652 (ACAACCAACT-ACCATCTTGT)"/>
<udf:field type="Numeric" name="Amount (ng)">375</udf:field>
<udf:field type="Numeric" name="Volume of sample (ul)">15</udf:field>
<udf:field type="Numeric" name="Concentration (nM)">103.464487677</udf:field>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</location>
<working-flag>true</working-flag>
<sample uri="http://127.0.0.1:8000/api/v2/samples/dummy_sample1" limsid="dummy_sample1"/>
<reagent-label name="A02 IDT_10nt_652 (ACAACCAACT-ACCATCTTGT)"/>
<reagent-label name="09_A02 IDT_10nt_652 (ACAACCAACT-ACCATCTTGT)"/>
<udf:field type="Numeric" name="Amount (ng)">375</udf:field>
<udf:field type="Numeric" name="Volume of sample (ul)">15</udf:field>
<udf:field type="Numeric" name="Concentration (nM)">103.464487677</udf:field>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</location>
<working-flag>true</working-flag>
<sample uri="http://127.0.0.1:8000/api/v2/samples/ACC7272A2" limsid="ACC7272A2"/>
<reagent-label name="A01 IDT_10nt_651 (ATGGTTGACT-GCTTGTGCCA)"/>
<reagent-label name="01_A01 IDT_10nt_651 (ATGGTTGACT-GCTTGTGCCA)"/>
<udf:field type="Numeric" name="Amount (ng)">1500</udf:field>
<udf:field type="Numeric" name="Volume of sample (ul)">5</udf:field>
<udf:field type="Numeric" name="Concentration (nM)">408.310256999</udf:field>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</location>
<working-flag>true</working-flag>
<sample uri="http://127.0.0.1:8000/api/v2/samples/dummy_sample2" limsid="dummy_sample2"/>
<reagent-label name="A01 IDT_10nt_651 (ATGGTTGACT-GCTTGTGCCA)"/>
<reagent-label name="01_A01 IDT_10nt_651 (ATGGTTGACT-GCTTGTGCCA)"/>
<udf:field type="Numeric" name="Amount (ng)">1500</udf:field>
<udf:field type="Numeric" name="Volume of sample (ul)">5</udf:field>
<udf:field type="Numeric" name="Concentration (nM)">408.310256999</udf:field>
Expand Down
2 changes: 1 addition & 1 deletion tests/fixtures/test_make_kapa_csv/artifacts/2-1155129.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</location>
<working-flag>true</working-flag>
<sample uri="http://127.0.0.1:8000/api/v2/samples/ACC7271A5" limsid="ACC7271A5"/>
<reagent-label name="A02 IDT_10nt_652 (ACAACCAACT-ACCATCTTGT)"/>
<reagent-label name="09_A02 IDT_10nt_652 (ACAACCAACT-ACCATCTTGT)"/>
<udf:field type="Numeric" name="Amount (ng)">375</udf:field>
<udf:field type="Numeric" name="Volume of sample (ul)">15</udf:field>
<udf:field type="Numeric" name="Concentration (nM)">103.464487677</udf:field>
Expand Down
2 changes: 1 addition & 1 deletion tests/fixtures/test_make_kapa_csv/artifacts/2-1155130.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</location>
<working-flag>true</working-flag>
<sample uri="http://127.0.0.1:8000/api/v2/samples/ACC7272A2" limsid="ACC7272A2"/>
<reagent-label name="A01 IDT_10nt_651 (ATGGTTGACT-GCTTGTGCCA)"/>
<reagent-label name="01_A01 IDT_10nt_651 (ATGGTTGACT-GCTTGTGCCA)"/>
<udf:field type="Numeric" name="Amount (ng)">1500</udf:field>
<udf:field type="Numeric" name="Volume of sample (ul)">5</udf:field>
<udf:field type="Numeric" name="Concentration (nM)">408.310256999</udf:field>
Expand Down

0 comments on commit 547e9eb

Please sign in to comment.