@platforma-open/milaboratories.mixcr-clonotyping-2.workflow 2.24.0 → 2.25.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
   WARN  Issue while reading "/home/runner/work/mixcr-clonotyping/mixcr-clonotyping/.npmrc". Failed to replace env in config: ${NPMJS_TOKEN}
2
2
 
3
- > @platforma-open/milaboratories.mixcr-clonotyping-2.workflow@2.24.0 build /home/runner/work/mixcr-clonotyping/mixcr-clonotyping/workflow
3
+ > @platforma-open/milaboratories.mixcr-clonotyping-2.workflow@2.25.0 build /home/runner/work/mixcr-clonotyping/mixcr-clonotyping/workflow
4
4
  > rm -rf dist && pl-tengo check && pl-tengo build
5
5
 
6
6
  info: Skipping unknown file type: test/columns.test.ts
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @platforma-open/milaboratories.mixcr-clonotyping.workflow
2
2
 
3
+ ## 2.25.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 427ffa6: Include junction lengths and total number of added nt
8
+
3
9
  ## 2.24.0
4
10
 
5
11
  ### Minor Changes
@@ -541,6 +541,52 @@ calculateExportSpecs := func(presetSpecForBack, blockId) {
541
541
  }
542
542
 
543
543
 
544
+ junctionTypes := [ "VJ", "VD", "DJ" ]
545
+ for junctionType in junctionTypes {
546
+ feature := junctionType + "Junction"
547
+ naRegex := junctionType == "VJ" ? "region_not_covered" : "no_d_gene"
548
+
549
+ columnsSpecPerClonotypeNoAggregates += [ {
550
+ column: "nLength" + feature,
551
+ id: "n-length-" + text.to_lower(junctionType) + "-junction",
552
+ naRegex: naRegex,
553
+ allowNA: true,
554
+ spec: {
555
+ name: "pl7.app/vdj/sequenceLength",
556
+ valueType: "Int",
557
+ domain: {
558
+ "pl7.app/vdj/feature": feature,
559
+ "pl7.app/alphabet": "nucleotide"
560
+ },
561
+ annotations: a(orderP, false, {
562
+ "pl7.app/label": "Length of " + junctionType + " Junction nt"
563
+ })
564
+ }
565
+ } ]
566
+ exportArgs += [ [ "-nLength", feature ] ]
567
+ orderP -= 100
568
+ }
569
+
570
+
571
+ columnsSpecPerClonotypeNoAggregates += [ {
572
+ column: "nLengthTotalAdded",
573
+ id: "n-length-total-added",
574
+ naRegex: "region_not_covered|no_d_gene",
575
+ allowNA: true,
576
+ spec: {
577
+ name: "pl7.app/vdj/sequenceLength",
578
+ valueType: "Int",
579
+ domain: {
580
+ "pl7.app/alphabet": "nucleotide"
581
+ },
582
+ annotations: a(orderP, false, {
583
+ "pl7.app/label": "Total number of added nt"
584
+ })
585
+ }
586
+ } ]
587
+ orderP -= 100
588
+
589
+
544
590
 
545
591
  geneHitColumnVariants := [ {
546
592
  name: "pl7.app/vdj/geneHitWithAllele",
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@platforma-open/milaboratories.mixcr-clonotyping-2.workflow",
3
- "version": "2.24.0",
3
+ "version": "2.25.0",
4
4
  "description": "Tengo-based template",
5
5
  "dependencies": {
6
6
  "@platforma-sdk/workflow-tengo": "^4.10.0",
@@ -75,7 +75,7 @@ self.body(func(inputs) {
75
75
  aggExpressions := []
76
76
 
77
77
  for colDef in schemaPerClonotypeNoAggregates {
78
- if colDef.column == "clonotypeLabel" {
78
+ if colDef.column == "clonotypeLabel" || colDef.column == "nLengthTotalAdded" {
79
79
  continue
80
80
  }
81
81
  aggExpressions = append(aggExpressions,
@@ -91,6 +91,14 @@ self.body(func(inputs) {
91
91
 
92
92
  aggregatedDf := currentDf.groupBy("clonotypeKey").agg(aggExpressions...)
93
93
 
94
+ // Calculate total added nucleotides: VDJunction + DJJunction for chains with D genes, VJJunction for chains without D genes
95
+ aggregatedDf = aggregatedDf.withColumns(
96
+ pt.when(pt.col("nLengthVDJunction").isNotNull().and(pt.col("nLengthVDJunction").neq("no_d_gene"))).
97
+ then(pt.col("nLengthVDJunction").cast("Int").plus(pt.col("nLengthDJJunction").cast("Int"))).
98
+ otherwise(pt.col("nLengthVJJunction").cast("Int")).
99
+ alias("nLengthTotalAdded")
100
+ )
101
+
94
102
  aggregatedDf = clonotypeLabel.addClonotypeLabelColumnsPt(aggregatedDf, "clonotypeKey", "clonotypeLabel", pt)
95
103
 
96
104
  aggregatedDf.save("output.tsv")
@@ -540,6 +540,52 @@ calculateExportSpecs := func(presetSpecForBack, blockId) {
540
540
  }
541
541
  }
542
542
 
543
+ // Include junction lengths for calculation of total added nucleotides
544
+ junctionTypes := [ "VJ", "VD", "DJ" ]
545
+ for junctionType in junctionTypes {
546
+ feature := junctionType + "Junction"
547
+ naRegex := junctionType == "VJ" ? "region_not_covered" : "no_d_gene"
548
+
549
+ columnsSpecPerClonotypeNoAggregates += [ {
550
+ column: "nLength" + feature,
551
+ id: "n-length-" + text.to_lower(junctionType) + "-junction",
552
+ naRegex: naRegex,
553
+ allowNA: true,
554
+ spec: {
555
+ name: "pl7.app/vdj/sequenceLength",
556
+ valueType: "Int",
557
+ domain: {
558
+ "pl7.app/vdj/feature": feature,
559
+ "pl7.app/alphabet": "nucleotide"
560
+ },
561
+ annotations: a(orderP, false, {
562
+ "pl7.app/label": "Length of " + junctionType + " Junction nt"
563
+ })
564
+ }
565
+ } ]
566
+ exportArgs += [ [ "-nLength", feature ] ]
567
+ orderP -= 100
568
+ }
569
+
570
+ // Spec for total added length (calculated by pt in aggregate-by-clonotype-key, no flag)
571
+ columnsSpecPerClonotypeNoAggregates += [ {
572
+ column: "nLengthTotalAdded",
573
+ id: "n-length-total-added",
574
+ naRegex: "region_not_covered|no_d_gene",
575
+ allowNA: true,
576
+ spec: {
577
+ name: "pl7.app/vdj/sequenceLength",
578
+ valueType: "Int",
579
+ domain: {
580
+ "pl7.app/alphabet": "nucleotide"
581
+ },
582
+ annotations: a(orderP, false, {
583
+ "pl7.app/label": "Total number of added nt"
584
+ })
585
+ }
586
+ } ]
587
+ orderP -= 100
588
+
543
589
  // VDJC Hits
544
590
 
545
591
  geneHitColumnVariants := [ {