biopipen 0.23.8__tar.gz → 0.24.0__tar.gz

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.

Potentially problematic release.


This version of biopipen might be problematic. Click here for more details.

Files changed (228) hide show
  1. {biopipen-0.23.8 → biopipen-0.24.0}/PKG-INFO +8 -7
  2. biopipen-0.24.0/biopipen/__init__.py +1 -0
  3. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/core/proc.py +7 -0
  4. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/ns/cellranger.py +2 -2
  5. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/ns/scrna.py +13 -20
  6. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/ns/tcr.py +8 -6
  7. biopipen-0.24.0/biopipen/scripts/scrna/SeuratClustering.R +174 -0
  8. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/scrna/SeuratPreparing.R +13 -6
  9. biopipen-0.24.0/biopipen/scripts/scrna/SeuratSubClustering.R +169 -0
  10. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/scrna_metabolic_landscape/MetabolicFeaturesIntraSubset.R +5 -5
  11. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/scrna_metabolic_landscape/MetabolicPathwayActivity.R +3 -3
  12. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/tcr/Immunarch-basic.R +2 -3
  13. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/tcr/Immunarch-clonality.R +2 -3
  14. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/tcr/Immunarch-diversity.R +70 -49
  15. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/tcr/Immunarch-geneusage.R +2 -3
  16. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/tcr/Immunarch-kmer.R +2 -3
  17. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/tcr/Immunarch-overlap.R +2 -3
  18. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/tcr/Immunarch-spectratyping.R +2 -3
  19. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/tcr/Immunarch-tracking.R +2 -3
  20. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/tcr/Immunarch-vjjunc.R +2 -3
  21. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/tcr/Immunarch.R +1 -1
  22. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/tcr/ImmunarchLoading.R +2 -0
  23. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/tcr/TCRClustering.R +6 -2
  24. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/tcr/TESSA.R +3 -1
  25. biopipen-0.24.0/biopipen/scripts/tcr/immunarch-patched.R +142 -0
  26. biopipen-0.24.0/biopipen/utils/caching.R +44 -0
  27. {biopipen-0.23.8 → biopipen-0.24.0}/pyproject.toml +9 -8
  28. {biopipen-0.23.8 → biopipen-0.24.0}/setup.py +8 -7
  29. biopipen-0.23.8/biopipen/__init__.py +0 -1
  30. biopipen-0.23.8/biopipen/scripts/scrna/SeuratClustering.R +0 -157
  31. biopipen-0.23.8/biopipen/scripts/scrna/SeuratSubClustering.R +0 -185
  32. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/core/__init__.py +0 -0
  33. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/core/config.py +0 -0
  34. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/core/config.toml +0 -0
  35. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/core/defaults.py +0 -0
  36. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/core/filters.py +0 -0
  37. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/core/testing.py +0 -0
  38. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/ns/__init__.py +0 -0
  39. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/ns/bam.py +0 -0
  40. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/ns/bcftools.py +0 -0
  41. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/ns/bed.py +0 -0
  42. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/ns/cnv.py +0 -0
  43. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/ns/cnvkit.py +0 -0
  44. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/ns/cnvkit_pipeline.py +0 -0
  45. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/ns/delim.py +0 -0
  46. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/ns/gene.py +0 -0
  47. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/ns/gsea.py +0 -0
  48. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/ns/misc.py +0 -0
  49. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/ns/plot.py +0 -0
  50. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/ns/rnaseq.py +0 -0
  51. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/ns/scrna_metabolic_landscape.py +0 -0
  52. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/ns/tcgamaf.py +0 -0
  53. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/ns/vcf.py +0 -0
  54. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/ns/web.py +0 -0
  55. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/reports/bam/CNAClinic.svelte +0 -0
  56. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/reports/bam/CNVpytor.svelte +0 -0
  57. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/reports/bam/ControlFREEC.svelte +0 -0
  58. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/reports/cellranger/CellRangerCount.svelte +0 -0
  59. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/reports/cellranger/CellRangerVdj.svelte +0 -0
  60. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/reports/cnv/AneuploidyScore.svelte +0 -0
  61. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/reports/cnv/AneuploidyScoreSummary.svelte +0 -0
  62. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/reports/cnv/TMADScoreSummary.svelte +0 -0
  63. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/reports/cnvkit/CNVkitDiagram.svelte +0 -0
  64. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/reports/cnvkit/CNVkitHeatmap.svelte +0 -0
  65. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/reports/cnvkit/CNVkitScatter.svelte +0 -0
  66. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/reports/delim/SampleInfo.svelte +0 -0
  67. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/reports/gsea/FGSEA.svelte +0 -0
  68. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/reports/gsea/GSEA.svelte +0 -0
  69. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/reports/scrna/CellsDistribution.svelte +0 -0
  70. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/reports/scrna/DimPlots.svelte +0 -0
  71. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/reports/scrna/MarkersFinder.svelte +0 -0
  72. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/reports/scrna/MetaMarkers.svelte +0 -0
  73. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/reports/scrna/RadarPlots.svelte +0 -0
  74. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/reports/scrna/ScFGSEA.svelte +0 -0
  75. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/reports/scrna/SeuratClusterStats.svelte +0 -0
  76. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/reports/scrna/SeuratMap2Ref.svelte +0 -0
  77. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/reports/scrna/SeuratPreparing.svelte +0 -0
  78. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/reports/scrna/TopExpressingGenes.svelte +0 -0
  79. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/reports/scrna_metabolic_landscape/MetabolicFeatures.svelte +0 -0
  80. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/reports/scrna_metabolic_landscape/MetabolicFeaturesIntraSubset.svelte +0 -0
  81. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/reports/scrna_metabolic_landscape/MetabolicPathwayActivity.svelte +0 -0
  82. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/reports/scrna_metabolic_landscape/MetabolicPathwayHeterogeneity.svelte +0 -0
  83. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/reports/tcr/CDR3AAPhyschem.svelte +0 -0
  84. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/reports/tcr/CloneResidency.svelte +0 -0
  85. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/reports/tcr/Immunarch.svelte +0 -0
  86. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/reports/tcr/SampleDiversity.svelte +0 -0
  87. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/reports/tcr/TCRClusterStats.svelte +0 -0
  88. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/reports/tcr/TESSA.svelte +0 -0
  89. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/reports/tcr/VJUsage.svelte +0 -0
  90. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/reports/utils/gsea.liq +0 -0
  91. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/reports/utils/misc.liq +0 -0
  92. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/reports/vcf/TruvariBenchSummary.svelte +0 -0
  93. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/reports/vcf/TruvariConsistency.svelte +0 -0
  94. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/bam/BamMerge.py +0 -0
  95. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/bam/BamSplitChroms.py +0 -0
  96. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/bam/CNAClinic.R +0 -0
  97. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/bam/CNVpytor.py +0 -0
  98. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/bam/ControlFREEC.py +0 -0
  99. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/bcftools/BcftoolsAnnotate.py +0 -0
  100. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/bcftools/BcftoolsFilter.py +0 -0
  101. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/bcftools/BcftoolsSort.py +0 -0
  102. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/bed/Bed2Vcf.py +0 -0
  103. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/bed/BedConsensus.py +0 -0
  104. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/bed/BedLiftOver.sh +0 -0
  105. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/bed/BedtoolsMerge.py +0 -0
  106. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/cellranger/CellRangerCount.py +0 -0
  107. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/cellranger/CellRangerVdj.py +0 -0
  108. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/cnv/AneuploidyScore.R +0 -0
  109. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/cnv/AneuploidyScoreSummary.R +0 -0
  110. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/cnv/TMADScore.R +0 -0
  111. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/cnv/TMADScoreSummary.R +0 -0
  112. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/cnvkit/CNVkitAccess.py +0 -0
  113. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/cnvkit/CNVkitAutobin.py +0 -0
  114. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/cnvkit/CNVkitBatch.py +0 -0
  115. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/cnvkit/CNVkitCall.py +0 -0
  116. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/cnvkit/CNVkitCoverage.py +0 -0
  117. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/cnvkit/CNVkitDiagram.py +0 -0
  118. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/cnvkit/CNVkitFix.py +0 -0
  119. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/cnvkit/CNVkitGuessBaits.py +0 -0
  120. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/cnvkit/CNVkitHeatmap.py +0 -0
  121. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/cnvkit/CNVkitReference.py +0 -0
  122. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/cnvkit/CNVkitScatter.py +0 -0
  123. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/cnvkit/CNVkitSegment.py +0 -0
  124. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/cnvkit/guess_baits.py +0 -0
  125. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/delim/RowsBinder.R +0 -0
  126. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/delim/SampleInfo.R +0 -0
  127. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/gene/GeneNameConversion.py +0 -0
  128. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/gsea/Enrichr.R +0 -0
  129. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/gsea/FGSEA.R +0 -0
  130. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/gsea/GSEA.R +0 -0
  131. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/gsea/PreRank.R +0 -0
  132. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/misc/Config2File.py +0 -0
  133. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/misc/Str2File.py +0 -0
  134. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/plot/Heatmap.R +0 -0
  135. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/plot/VennDiagram.R +0 -0
  136. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/rnaseq/UnitConversion.R +0 -0
  137. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/scrna/CellTypeAnnotation-direct.R +0 -0
  138. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/scrna/CellTypeAnnotation-hitype.R +0 -0
  139. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/scrna/CellTypeAnnotation-sccatch.R +0 -0
  140. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/scrna/CellTypeAnnotation-sctype.R +0 -0
  141. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/scrna/CellTypeAnnotation.R +0 -0
  142. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/scrna/CellsDistribution.R +0 -0
  143. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/scrna/DimPlots.R +0 -0
  144. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/scrna/ExprImpution-alra.R +0 -0
  145. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/scrna/ExprImpution-rmagic.R +0 -0
  146. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/scrna/ExprImpution-scimpute.R +0 -0
  147. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/scrna/ExprImpution.R +0 -0
  148. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/scrna/MarkersFinder.R +0 -0
  149. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/scrna/MetaMarkers.R +0 -0
  150. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/scrna/ModuleScoreCalculator.R +0 -0
  151. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/scrna/RadarPlots.R +0 -0
  152. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/scrna/SCImpute.R +0 -0
  153. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/scrna/ScFGSEA.R +0 -0
  154. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/scrna/SeuratClusterStats-dimplots.R +0 -0
  155. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/scrna/SeuratClusterStats-features.R +0 -0
  156. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/scrna/SeuratClusterStats-hists.R +0 -0
  157. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/scrna/SeuratClusterStats-ngenes.R +0 -0
  158. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/scrna/SeuratClusterStats-stats.R +0 -0
  159. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/scrna/SeuratClusterStats.R +0 -0
  160. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/scrna/SeuratFilter.R +0 -0
  161. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/scrna/SeuratLoading.R +0 -0
  162. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/scrna/SeuratMap2Ref.R +0 -0
  163. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/scrna/SeuratMetadataMutater.R +0 -0
  164. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/scrna/SeuratSplit.R +0 -0
  165. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/scrna/SeuratSubset.R +0 -0
  166. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/scrna/SeuratTo10X.R +0 -0
  167. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/scrna/TopExpressingGenes.R +0 -0
  168. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/scrna/Write10X.R +0 -0
  169. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/scrna/sctype.R +0 -0
  170. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/scrna_metabolic_landscape/MetabolicFeatures.R +0 -0
  171. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/scrna_metabolic_landscape/MetabolicPathwayHeterogeneity.R +0 -0
  172. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/tcgamaf/Maf2Vcf.py +0 -0
  173. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/tcgamaf/MafAddChr.py +0 -0
  174. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/tcgamaf/maf2vcf.pl +0 -0
  175. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/tcr/Attach2Seurat.R +0 -0
  176. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/tcr/CDR3AAPhyschem.R +0 -0
  177. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/tcr/CloneResidency.R +0 -0
  178. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/tcr/CloneSizeQQPlot.R +0 -0
  179. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/tcr/GIANA/GIANA.py +0 -0
  180. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/tcr/GIANA/GIANA4.py +0 -0
  181. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/tcr/GIANA/Imgt_Human_TRBV.fasta +0 -0
  182. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/tcr/GIANA/query.py +0 -0
  183. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/tcr/Immunarch2VDJtools.R +0 -0
  184. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/tcr/ImmunarchFilter.R +0 -0
  185. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/tcr/ImmunarchSplitIdents.R +0 -0
  186. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/tcr/SampleDiversity.R +0 -0
  187. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/tcr/TCRClusterStats.R +0 -0
  188. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/tcr/TESSA_source/Atchley_factors.csv +0 -0
  189. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/tcr/TESSA_source/BriseisEncoder.py +0 -0
  190. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/tcr/TESSA_source/MCMC_control.R +0 -0
  191. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/tcr/TESSA_source/TrainedEncoder.h5 +0 -0
  192. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/tcr/TESSA_source/fixed_b.csv +0 -0
  193. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/tcr/TESSA_source/initialization.R +0 -0
  194. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/tcr/TESSA_source/post_analysis.R +0 -0
  195. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/tcr/TESSA_source/real_data.R +0 -0
  196. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/tcr/TESSA_source/update.R +0 -0
  197. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/tcr/TESSA_source/utility.R +0 -0
  198. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/tcr/VJUsage.R +0 -0
  199. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/tcr/vdjtools-patch.sh +0 -0
  200. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/vcf/TruvariBench.sh +0 -0
  201. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/vcf/TruvariBenchSummary.R +0 -0
  202. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/vcf/TruvariConsistency.R +0 -0
  203. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/vcf/Vcf2Bed.py +0 -0
  204. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/vcf/VcfAnno.py +0 -0
  205. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/vcf/VcfDownSample.sh +0 -0
  206. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/vcf/VcfFilter.py +0 -0
  207. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/vcf/VcfFix.py +0 -0
  208. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/vcf/VcfFix_utils.py +0 -0
  209. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/vcf/VcfIndex.py +0 -0
  210. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/vcf/VcfIntersect.py +0 -0
  211. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/vcf/VcfLiftOver.sh +0 -0
  212. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/vcf/VcfSplitSamples.py +0 -0
  213. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/web/Download.py +0 -0
  214. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/scripts/web/DownloadList.py +0 -0
  215. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/utils/__init__.py +0 -0
  216. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/utils/common_docstrs.py +0 -0
  217. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/utils/gene.R +0 -0
  218. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/utils/gene.py +0 -0
  219. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/utils/gsea.R +0 -0
  220. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/utils/io.R +0 -0
  221. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/utils/misc.R +0 -0
  222. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/utils/misc.py +0 -0
  223. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/utils/mutate_helpers.R +0 -0
  224. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/utils/plot.R +0 -0
  225. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/utils/reference.py +0 -0
  226. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/utils/rnaseq.R +0 -0
  227. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/utils/single_cell.R +0 -0
  228. {biopipen-0.23.8 → biopipen-0.24.0}/biopipen/utils/vcf.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: biopipen
3
- Version: 0.23.8
3
+ Version: 0.24.0
4
4
  Summary: Bioinformatics processes/pipelines that can be run from `pipen run`
5
5
  License: MIT
6
6
  Author: pwwang
@@ -14,9 +14,10 @@ Classifier: Programming Language :: Python :: 3.10
14
14
  Classifier: Programming Language :: Python :: 3.11
15
15
  Classifier: Programming Language :: Python :: 3.12
16
16
  Provides-Extra: runinfo
17
- Requires-Dist: datar[pandas] (>=0.15.2,<0.16.0)
18
- Requires-Dist: pipen-board[report] (>=0.13,<0.14)
19
- Requires-Dist: pipen-cli-run (>=0.11,<0.12)
20
- Requires-Dist: pipen-filters (>=0.10,<0.11)
21
- Requires-Dist: pipen-runinfo (>=0.4,<0.5) ; extra == "runinfo"
22
- Requires-Dist: pipen-verbose (>=0.9,<0.10)
17
+ Requires-Dist: datar[pandas] (>=0.15.3,<0.16.0)
18
+ Requires-Dist: pipen-board[report] (>=0.14,<0.15)
19
+ Requires-Dist: pipen-cli-run (>=0.12,<0.13)
20
+ Requires-Dist: pipen-filters (>=0.11,<0.12)
21
+ Requires-Dist: pipen-poplog (>=0.0.2,<0.0.3)
22
+ Requires-Dist: pipen-runinfo (>=0.5,<0.6) ; extra == "runinfo"
23
+ Requires-Dist: pipen-verbose (>=0.10,<0.11)
@@ -0,0 +1 @@
1
+ __version__ = "0.24.0"
@@ -25,3 +25,10 @@ class Proc(PipenProc):
25
25
  "filters": {**FILTERS, **filtermanager.filters},
26
26
  "search_paths": SEARCH_PATHS + [str(REPORT_DIR)],
27
27
  }
28
+
29
+ plugin_opts = {
30
+ "poplog_pattern": (
31
+ r"^(?P<level>INFO|WARN|WARNING|CRITICAL|ERROR|DEBUG?)\s*"
32
+ r"\[\d+-\d+-\d+ \d+:\d+:\d+\] (?P<message>.*)$"
33
+ )
34
+ }
@@ -35,7 +35,7 @@ class CellRangerCount(Proc):
35
35
  {%- set fastqs = fastqs[0] | glob: "*.fastq.gz" -%}
36
36
  {%- endif -%}
37
37
  {%- set sample = commonprefix(*fastqs) |
38
- regex_replace: "_L\\d+_$", "" |
38
+ regex_replace: "_L\\d+_?$", "" |
39
39
  regex_replace: "_S\\d+$", "" -%}
40
40
  {{- sample -}}
41
41
  """
@@ -84,7 +84,7 @@ class CellRangerVdj(Proc):
84
84
  {%- set fastqs = fastqs[0] | glob: "*.fastq.gz" -%}
85
85
  {%- endif -%}
86
86
  {%- set sample = commonprefix(*fastqs) |
87
- regex_replace: "_L\\d+_$", "" |
87
+ regex_replace: "_L\\d+_?$", "" |
88
88
  regex_replace: "_S\\d+$", "" -%}
89
89
  {{- sample -}}
90
90
  """
@@ -278,18 +278,14 @@ class SeuratClustering(Proc):
278
278
  The results will be saved in `seurat_clusters_<resolution>`.
279
279
  The final resolution will be used to define the clusters at `seurat_clusters`.
280
280
  - <more>: See <https://satijalab.org/seurat/reference/findclusters>
281
- cache (type=auto): Whether to cache the seurat object with cluster information.
281
+ cache (type=auto): Whether to cache the information at different steps.
282
282
  If `True`, the seurat object will be cached in the job output directory, which will be not cleaned up when job is rerunning.
283
- The cached seurat object will be saved as `<signature>.cached.RDS` file, where `<signature>` is the signature determined by
283
+ The cached seurat object will be saved as `<signature>.<kind>.RDS` file, where `<signature>` is the signature determined by
284
284
  the input and envs of the process.
285
- See -
286
- * <https://github.com/satijalab/seurat/issues/7849>
287
- * <https://github.com/satijalab/seurat/issues/5358> and
288
- * <https://github.com/satijalab/seurat/issues/6748> for more details.
285
+ See <https://github.com/satijalab/seurat/issues/7849>, <https://github.com/satijalab/seurat/issues/5358> and
286
+ <https://github.com/satijalab/seurat/issues/6748> for more details also about reproducibility issues.
289
287
  To not use the cached seurat object, you can either set `cache` to `False` or delete the cached file at
290
- `<signature>.cached.RDS` in the cache directory.
291
- If `True`, the cache directory is `.pipen/<Pipeline>/SeuratClustering/0/output/`
292
- You can also specify customized directory to save the cached seurat object by setting `cache` to the directory path.
288
+ `<signature>.RDS` in the cache directory.
293
289
 
294
290
  Requires:
295
291
  r-seurat:
@@ -309,7 +305,7 @@ class SeuratClustering(Proc):
309
305
  "RunUMAP": {"dims": 30},
310
306
  "FindNeighbors": {},
311
307
  "FindClusters": {"resolution": 0.8},
312
- "cache": False,
308
+ "cache": config.path.tmpdir,
313
309
  }
314
310
  script = "file://../scripts/scrna/SeuratClustering.R"
315
311
 
@@ -361,18 +357,14 @@ class SeuratSubClustering(Proc):
361
357
  The results will be saved in `<casename>_<resolution>`.
362
358
  The final resolution will be used to define the clusters at `<casename>`.
363
359
  - <more>: See <https://satijalab.org/seurat/reference/findclusters>
364
- cache (type=auto): Whether to cache the seurat object with cluster information.
360
+ cache (type=auto): Whether to cache the information at different steps.
365
361
  If `True`, the seurat object will be cached in the job output directory, which will be not cleaned up when job is rerunning.
366
- The cached seurat object will be saved as `<signature>.cached.RDS` file, where `<signature>` is the signature determined by
362
+ The cached seurat object will be saved as `<signature>.<kind>.RDS` file, where `<signature>` is the signature determined by
367
363
  the input and envs of the process.
368
- See -
369
- * <https://github.com/satijalab/seurat/issues/7849>
370
- * <https://github.com/satijalab/seurat/issues/5358> and
371
- * <https://github.com/satijalab/seurat/issues/6748> for more details.
364
+ See <https://github.com/satijalab/seurat/issues/7849>, <https://github.com/satijalab/seurat/issues/5358> and
365
+ <https://github.com/satijalab/seurat/issues/6748> for more details also about reproducibility issues.
372
366
  To not use the cached seurat object, you can either set `cache` to `False` or delete the cached file at
373
- `<signature>.cached.RDS` in the cache directory.
374
- If `True`, the cache directory is `.pipen/<Pipeline>/SeuratClustering/0/output/`
375
- You can also specify customized directory to save the cached seurat object by setting `cache` to the directory path.
367
+ `<signature>.RDS` in the cache directory.
376
368
  cases (type=json): The cases to perform subclustering.
377
369
  Keys are the names of the cases and values are the dicts inherited from `envs` except `mutaters` and `cache`.
378
370
  If empty, a case with name `subcluster` will be created with default parameters.
@@ -387,7 +379,7 @@ class SeuratSubClustering(Proc):
387
379
  "RunUMAP": {"dims": 30},
388
380
  "FindNeighbors": {},
389
381
  "FindClusters": {"resolution": 0.8},
390
- "cache": False,
382
+ "cache": config.path.tmpdir,
391
383
  "cases": {"subcluster": {}},
392
384
  }
393
385
  script = "file://../scripts/scrna/SeuratSubClustering.R"
@@ -2002,4 +1994,5 @@ class MetaMarkers(Proc):
2002
1994
  plugin_opts = {
2003
1995
  "report": "file://../reports/scrna/MetaMarkers.svelte",
2004
1996
  "report_paging": 8,
1997
+ "poplog_max": 15,
2005
1998
  }
@@ -563,12 +563,13 @@ class Immunarch(Proc):
563
563
  A Gini coefficient of one (or 100 percents) expresses maximal inequality among values (for example where only one person has all the income).
564
564
  - d50: The D50 index.
565
565
  It is the number of types that are needed to cover 50%% of the total abundance.
566
- - dxx: The Dxx index.
567
- It is the number of types that are needed to cover xx%% of the total abundance.
568
- The percentage should be specified in the `args` argument using `perc` key.
569
566
  - raref: Species richness from the results of sampling through extrapolation.
570
567
  - by: The variables (column names) to group samples.
571
568
  Multiple columns should be separated by `,`.
569
+ - plot_type (choice): The type of the plot, works when `by` is specified.
570
+ Not working for `raref`.
571
+ - box: Boxplot
572
+ - bar: Barplot with error bars
572
573
  - subset: Subset the data before calculating the clonotype volumes.
573
574
  The whole data will be expanded to cell level, and then subsetted.
574
575
  Clone sizes will be re-calculated based on the subsetted data.
@@ -789,9 +790,9 @@ class Immunarch(Proc):
789
790
  },
790
791
  # Diversity
791
792
  "divs": {
792
- "filter": None,
793
793
  "method": "gini",
794
794
  "by": None,
795
+ "plot_type": "bar",
795
796
  "args": {},
796
797
  "order": [],
797
798
  "test": {
@@ -805,8 +806,8 @@ class Immunarch(Proc):
805
806
  "align_y": False,
806
807
  "log": False,
807
808
  "devpars": {
808
- "width": 1000,
809
- "height": 1000,
809
+ "width": 800,
810
+ "height": 800,
810
811
  "res": 100,
811
812
  },
812
813
  "subset": None,
@@ -851,6 +852,7 @@ class Immunarch(Proc):
851
852
  plugin_opts = {
852
853
  "report": "file://../reports/tcr/Immunarch.svelte",
853
854
  "report_paging": 3,
855
+ "poplog_max": 999,
854
856
  }
855
857
 
856
858
 
@@ -0,0 +1,174 @@
1
+ source("{{biopipen_dir}}/utils/misc.R")
2
+ source("{{biopipen_dir}}/utils/caching.R")
3
+
4
+ library(Seurat)
5
+ library(future)
6
+ library(tidyr)
7
+ library(dplyr)
8
+ library(digest)
9
+
10
+ set.seed(8525)
11
+
12
+ srtfile <- {{in.srtobj | quote}}
13
+ rdsfile <- {{out.rdsfile | quote}}
14
+ joboutdir <- {{job.outdir | quote}}
15
+ envs <- {{envs | r: todot="-"}}
16
+
17
+ if (length(envs$ScaleData) > 0 && length(envs$SCTransform) > 0) {
18
+ stop("Cannot specify both ScaleData and SCTransform")
19
+ }
20
+
21
+ options(str = strOptions(vec.len = 5, digits.d = 5))
22
+ options(future.globals.maxSize = 80000 * 1024^2)
23
+ plan(strategy = "multicore", workers = envs$ncores)
24
+
25
+ .expand_dims <- function(args, name = "dims") {
26
+ # Expand dims from 30 to 1:30
27
+ if (is.numeric(args[[name]]) && length(args[[name]] == 1)) {
28
+ args[[name]] <- 1:args[[name]]
29
+ }
30
+ args
31
+ }
32
+
33
+ envs$RunUMAP <- .expand_dims(envs$RunUMAP)
34
+ envs$FindNeighbors <- .expand_dims(envs$FindNeighbors)
35
+
36
+ log_info("Reading Seurat object ...")
37
+ sobj <- readRDS(srtfile)
38
+
39
+ if (isTRUE(envs$cache)) { envs$cache <- joboutdir }
40
+ if (length(envs$cache) > 1) {
41
+ log_warn("Multiple cache directories (envs.cache) detected, using the first one.")
42
+ envs$cache <- envs$cache[1]
43
+ }
44
+ sobj_sig <- capture.output(str(sobj))
45
+ dig_sig <- digest::digest(sobj_sig, algo = "md5")
46
+ dig_sig <- substr(dig_sig, 1, 8)
47
+ cache_dir <- NULL
48
+ if (is.character(envs$cache)) {
49
+ cache_dir <- file.path(envs$cache, paste0(dig_sig, ".seurat_cache"))
50
+ dir.create(cache_dir, recursive = TRUE, showWarnings = FALSE)
51
+ writeLines(sobj_sig, file.path(cache_dir, "signature.txt"))
52
+ }
53
+
54
+ if (length(envs$ScaleData) > 0) {
55
+ if (DefaultAssay(sobj) == "SCT") {
56
+ stop("SCT assay detected, but ScaleData is specified. Use SCTransform instead.")
57
+ }
58
+ cached <- get_cached(envs$ScaleData, "ScaleData", cache_dir)
59
+ if (is.null(cached$data)) {
60
+ log_info("Running ScaleData ...")
61
+ envs$ScaleData$object <- sobj
62
+ sobj <- do_call(ScaleData, envs$ScaleData)
63
+ cached$data <- list(assay = sobj@assays$RNA, commands = sobj@commands)
64
+ save_to_cache(cached, "ScaleData", cache_dir)
65
+ } else {
66
+ log_info("Loading cached ScaleData ...")
67
+ sobj@assays$RNA <- cached$data$assay
68
+ sobj@commands <- cached$data$commands
69
+ DefaultAssay(sobj) <- "RNA"
70
+ }
71
+ } else if (length(envs$SCTransform) > 0) {
72
+ if (DefaultAssay(sobj) != "SCT") {
73
+ stop("SCT assay not detected, but SCTransform is specified. Use ScaleData instead.")
74
+ }
75
+ cached <- get_cached(envs$SCTransform, "SCTransform", cache_dir)
76
+ asssay <- envs$SCTransform$new.assay.name %||% "SCT"
77
+ if (is.null(cached$data)) {
78
+ log_info("Running SCTransform ...")
79
+ envs$SCTransform$object <- sobj
80
+ sobj <- do_call(SCTransform, envs$SCTransform)
81
+ cached$data <- list(assay = sobj@assays$SCT, commands = sobj@commands)
82
+ save_to_cache(cached, "SCTransform", cache_dir)
83
+ } else {
84
+ log_info("Loading cached SCTransform ...")
85
+ sobj@assays[[assay]] <- cached$data$assay
86
+ sobj@commands <- cached$data$commands
87
+ DefaultAssay(sobj) <- assay
88
+ }
89
+ }
90
+
91
+ cached <- get_cached(envs$RunUMAP, "RunUMAP", cache_dir)
92
+ reduc_name <- envs$RunUMAP$reduction.name %||% "umap"
93
+ if (is.null(cached$data)) {
94
+ log_info("Running RunUMAP ...")
95
+ umap_args <- list_setdefault(
96
+ envs$RunUMAP,
97
+ object = sobj,
98
+ dims = 1:30,
99
+ reduction = sobj@misc$integrated_new_reduction %||% "pca"
100
+ )
101
+ ncells <- ncol(sobj)
102
+ umap_args$dims <- 1:min(max(umap_args$dims), ncells - 1)
103
+ umap_method <- envs$RunUMAP$umap.method %||% "uwot"
104
+ if (umap_method == "uwot" && is.null(envs$RunUMAP$n.neighbors)) {
105
+ # https://github.com/satijalab/seurat/issues/4312
106
+ umap_args$n.neighbors <- min(ncells - 1, 30)
107
+ }
108
+ sobj <- do_call(RunUMAP, umap_args)
109
+ cached$data <- list(reduc = sobj@reductions[[reduc_name]], commands = sobj@commands)
110
+ save_to_cache(cached, "RunUMAP", cache_dir)
111
+ } else {
112
+ log_info("Loading cached RunUMAP ...")
113
+ sobj@reductions[[reduc_name]] <- cached$data$reduc
114
+ sobj@commands <- cached$data$commands
115
+ }
116
+
117
+ cached <- get_cached(envs$FindNeighbors, "FindNeighbors", cache_dir)
118
+ if (is.null(cached$data)) {
119
+ log_info("Running FindNeighbors ...")
120
+ envs$FindNeighbors$object <- sobj
121
+ envs$FindNeighbors$reduction <- sobj@misc$integrated_new_reduction %||% "pca"
122
+ sobj <- do_call(FindNeighbors, envs$FindNeighbors)
123
+ cached$data <- list(graphs = sobj@graphs, commands = sobj@commands)
124
+ save_to_cache(cached, "FindNeighbors", cache_dir)
125
+ } else {
126
+ log_info("Loading cached FindNeighbors ...")
127
+ sobj@graphs <- cached$data$graphs
128
+ sobj@commands <- cached$data$commands
129
+ }
130
+
131
+ envs$FindClusters$random.seed <- envs$FindClusters$random.seed %||% 8525
132
+ resolution <- envs$FindClusters$resolution %||% 0.8
133
+ if (is.character(resolution)) {
134
+ if (grepl(",", resolution)) {
135
+ resolution <- as.numeric(trimws(unlist(strsplit(resolution, ","))))
136
+ } else {
137
+ resolution <- as.numeric(resolution)
138
+ }
139
+ }
140
+
141
+ for (res in resolution) {
142
+ envs$FindClusters$resolution <- res
143
+ cached <- get_cached(envs$FindClusters, paste0("FindClusters_", res), cache_dir)
144
+ res_key <- paste0("seurat_clusters_", res)
145
+ if (is.null(cached$data)) {
146
+ log_info("Running FindClusters at resolution: {res} ...")
147
+ envs$FindClusters$object <- sobj
148
+ sobj <- do_call(FindClusters, envs$FindClusters)
149
+ levels(sobj$seurat_clusters) <- paste0("c", as.numeric(levels(sobj$seurat_clusters)) + 1)
150
+ sobj[[res_key]] <- sobj$seurat_clusters
151
+ Idents(sobj) <- "seurat_clusters"
152
+ cached$data <- list(clusters = sobj$seurat_clusters, commands = sobj@commands)
153
+ save_to_cache(cached, paste0("FindClusters_", res), cache_dir)
154
+ } else {
155
+ log_info("Loading cached FindClusters at resolution: {res} ...")
156
+ sobj@commands <- cached$data$commands
157
+ sobj[[res_key]] <- cached$data$clusters
158
+ sobj$seurat_clusters <- cached$data$clusters
159
+ Idents(sobj) <- "seurat_clusters"
160
+ }
161
+ ident_table <- table(Idents(sobj))
162
+ log_info("- Found {length(ident_table)} clusters")
163
+ print(ident_table)
164
+ cat("\n")
165
+ }
166
+
167
+ if (DefaultAssay(sobj) == "SCT") {
168
+ # https://github.com/satijalab/seurat/issues/6968
169
+ log_info("Running PrepSCTFindMarkers ...")
170
+ sobj <- PrepSCTFindMarkers(sobj)
171
+ }
172
+
173
+ log_info("Saving results ...")
174
+ saveRDS(sobj, file = rdsfile)
@@ -301,26 +301,31 @@ log_info("Performing transformation/scaling ...")
301
301
  if (envs$use_sct) {
302
302
  log_info("- Running SCTransform ...")
303
303
  SCTransformArgs <- envs$SCTransform
304
- log_info(" SCTransform: {.formatArgs(SCTransformArgs)}")
304
+ # log to stdout but don't populate it to running log
305
+ print(" SCTransform: {.formatArgs(SCTransformArgs)}")
306
+ log_debug(" SCTransform: {.formatArgs(SCTransformArgs)}")
305
307
  SCTransformArgs$object <- sobj
306
308
  sobj <- do_call(SCTransform, SCTransformArgs)
307
309
  # Default is to use the SCT assay
308
310
  } else {
309
311
  log_info("- Running NormalizeData ...")
310
312
  NormalizeDataArgs <- envs$NormalizeData
311
- log_info(" NormalizeData: {.formatArgs(NormalizeDataArgs)}")
313
+ print(" NormalizeData: {.formatArgs(NormalizeDataArgs)}")
314
+ log_debug(" NormalizeData: {.formatArgs(NormalizeDataArgs)}")
312
315
  NormalizeDataArgs$object <- sobj
313
316
  sobj <- do_call(NormalizeData, NormalizeDataArgs)
314
317
 
315
318
  log_info("- Running FindVariableFeatures ...")
316
319
  FindVariableFeaturesArgs <- envs$FindVariableFeatures
317
- log_info(" FindVariableFeatures: {.formatArgs(FindVariableFeaturesArgs)}")
320
+ print(" FindVariableFeatures: {.formatArgs(FindVariableFeaturesArgs)}")
321
+ log_debug(" FindVariableFeatures: {.formatArgs(FindVariableFeaturesArgs)}")
318
322
  FindVariableFeaturesArgs$object <- sobj
319
323
  sobj <- do_call(FindVariableFeatures, FindVariableFeaturesArgs)
320
324
 
321
325
  log_info("- Running ScaleData ...")
322
326
  ScaleDataArgs <- envs$ScaleData
323
- log_info(" ScaleData: {.formatArgs(ScaleDataArgs)}")
327
+ print(" ScaleData: {.formatArgs(ScaleDataArgs)}")
328
+ log_debug(" ScaleData: {.formatArgs(ScaleDataArgs)}")
324
329
  ScaleDataArgs$object <- sobj
325
330
  sobj <- do_call(ScaleData, ScaleDataArgs)
326
331
  }
@@ -328,7 +333,8 @@ if (envs$use_sct) {
328
333
  log_info("- Running RunPCA ...")
329
334
  RunPCAArgs <- envs$RunPCA
330
335
  RunPCAArgs$npcs <- if (is.null(RunPCAArgs$npcs)) { 50 } else { min(RunPCAArgs$npcs, ncol(sobj) - 1) }
331
- log_info(" RunPCA: {.formatArgs(RunPCAArgs)}")
336
+ print(" RunPCA: {.formatArgs(RunPCAArgs)}")
337
+ log_debug(" RunPCA: {.formatArgs(RunPCAArgs)}")
332
338
  RunPCAArgs$object <- sobj
333
339
  sobj <- do_call(RunPCA, RunPCAArgs)
334
340
 
@@ -361,7 +367,8 @@ if (!envs$no_integration) {
361
367
  if (is.null(IntegrateLayersArgs$new.reduction)) {
362
368
  IntegrateLayersArgs$new.reduction <- new_reductions[[method]]
363
369
  }
364
- log_info(" IntegrateLayers: {.formatArgs(IntegrateLayersArgs)}")
370
+ print(" IntegrateLayers: {.formatArgs(IntegrateLayersArgs)}")
371
+ log_debug(" IntegrateLayers: {.formatArgs(IntegrateLayersArgs)}")
365
372
  IntegrateLayersArgs$object <- sobj
366
373
  sobj <- do_call(IntegrateLayers, IntegrateLayersArgs)
367
374
  # Save it for dimension reduction plots
@@ -0,0 +1,169 @@
1
+ source("{{biopipen_dir}}/utils/misc.R")
2
+ source("{{biopipen_dir}}/utils/caching.R")
3
+
4
+ library(Seurat)
5
+ library(future)
6
+ library(rlang)
7
+ library(tidyr)
8
+ library(dplyr)
9
+ library(tidyseurat)
10
+ library(digest)
11
+
12
+ set.seed(8525)
13
+
14
+ srtfile <- {{in.srtobj | quote}}
15
+ rdsfile <- {{out.rdsfile | quote}}
16
+ joboutdir <- {{job.outdir | quote}}
17
+ envs <- {{envs | r: todot = "-"}}
18
+
19
+ options(str = strOptions(vec.len = 5, digits.d = 5))
20
+ options(future.globals.maxSize = 80000 * 1024^2)
21
+ plan(strategy = "multicore", workers = envs$ncores)
22
+
23
+ .expand_dims <- function(args, name = "dims") {
24
+ # Expand dims from 30 to 1:30
25
+ if (!is.null(args) && is.numeric(args[[name]]) && length(args[[name]] == 1)) {
26
+ args[[name]] <- 1:args[[name]]
27
+ }
28
+ args
29
+ }
30
+
31
+ envs$RunUMAP <- .expand_dims(envs$RunUMAP)
32
+ envs$FindNeighbors <- .expand_dims(envs$FindNeighbors)
33
+
34
+ log_info("Reading Seurat object ...")
35
+ srtobj <- readRDS(srtfile)
36
+
37
+ if (isTRUE(envs$cache)) { envs$cache <- joboutdir }
38
+ if (length(envs$cache) > 1) {
39
+ log_warn("Multiple cache directories (envs.cache) detected, using the first one.")
40
+ envs$cache <- envs$cache[1]
41
+ }
42
+
43
+ if (!is.null(envs$mutaters) && length(envs$mutaters) > 0) {
44
+ log_info("Mutating Seurat object ...")
45
+ srtobj@meta.data <- srtobj@meta.data %>%
46
+ mutate(!!!lapply(mutaters, parse_expr))
47
+ }
48
+
49
+ if (length(envs$cases) == 0) {
50
+ envs$cases <- list(subcluster = list())
51
+ }
52
+
53
+ for (key in names(envs$cases)) {
54
+ log_info("")
55
+ log_info("Running case '{key}' ...")
56
+ log_info("===========================================")
57
+ case <- envs$cases[[key]]
58
+ case$RunUMAP <- .expand_dims(case$RunUMAP)
59
+ case$FindNeighbors <- .expand_dims(case$FindNeighbors)
60
+
61
+ case <- list_update(
62
+ list(
63
+ subset = envs$subset,
64
+ RunUMAP = envs$RunUMAP,
65
+ FindNeighbors = envs$FindNeighbors,
66
+ FindClusters = envs$FindClusters
67
+ ),
68
+ case
69
+ )
70
+
71
+ if (is.null(case$subset) || length(case$subset) == 0) {
72
+ stop(paste0("`subset` for case '", key, "' is empty."))
73
+ }
74
+
75
+ log_info("- Subsetting ...")
76
+ sobj <- tryCatch({
77
+ srtobj %>% filter(!!parse_expr(case$subset))
78
+ }, error = function(e) {
79
+ stop(paste0(" Error in subset: ", e$message))
80
+ })
81
+ sobj_sig <- capture.output(str(sobj))
82
+ dig_sig <- digest::digest(sobj_sig, algo = "md5")
83
+ dig_sig <- substr(dig_sig, 1, 8)
84
+ cache_dir <- NULL
85
+ if (is.character(envs$cache)) {
86
+ cache_dir <- file.path(envs$cache, paste0(dig_sig, ".seurat_cache"))
87
+ dir.create(cache_dir, recursive = TRUE, showWarnings = FALSE)
88
+ writeLines(sobj_sig, file.path(cache_dir, "signature.txt"))
89
+ }
90
+
91
+ cached <- get_cached(case$RunUMAP, "RunUMAP", cache_dir)
92
+ reduc_name <- case$RunUMAP$reduction.name %||% "umap"
93
+ if (is.null(cached$data)) {
94
+ log_info("- Running RunUMAP ...")
95
+ umap_args <- list_setdefault(
96
+ case$RunUMAP,
97
+ object = sobj,
98
+ dims = 1:30,
99
+ reduction = sobj@misc$integrated_new_reduction %||% "pca"
100
+ )
101
+ ncells <- ncol(sobj)
102
+ umap_args$dims <- 1:min(max(umap_args$dims), ncells - 1)
103
+ umap_method <- case$RunUMAP$umap.method %||% "uwot"
104
+ if (umap_method == "uwot" && is.null(case$RunUMAP$n.neighbors)) {
105
+ # https://github.com/satijalab/seurat/issues/4312
106
+ umap_args$n.neighbors <- min(ncells - 1, 30)
107
+ }
108
+ sobj <- do_call(RunUMAP, umap_args)
109
+ cached$data <- list(reduc = sobj@reductions[[reduc_name]], commands = sobj@commands)
110
+ save_to_cache(cached, "RunUMAP", cache_dir)
111
+ } else {
112
+ log_info("- Loading cached RunUMAP ...")
113
+ sobj@reductions[[reduc_name]] <- cached$data$reduc
114
+ sobj@commands <- cached$data$commands
115
+ }
116
+ reduc <- cached$data$reduc
117
+
118
+ cached <- get_cached(case$FindNeighbors, "FindNeighbors", cache_dir)
119
+ if (is.null(cached$data)) {
120
+ log_info("- Running FindNeighbors ...")
121
+ case$FindNeighbors$object <- sobj
122
+ if (is.null(case$FindNeighbors$reduction)) {
123
+ case$FindNeighbors$reduction <- sobj@misc$integrated_new_reduction %||% "pca"
124
+ }
125
+ sobj <- do_call(FindNeighbors, case$FindNeighbors)
126
+ cached$data <- list(graphs = sobj@graphs, commands = sobj@commands)
127
+ save_to_cache(cached, "FindNeighbors", cache_dir)
128
+ } else {
129
+ log_info("- Loading cached FindNeighbors ...")
130
+ sobj@graphs <- cached$data$graphs
131
+ sobj@commands <- cached$data$commands
132
+ }
133
+
134
+ case$FindClusters$random.seed <- case$FindClusters$random.seed %||% 8525
135
+ resolution <- case$FindClusters$resolution %||% 0.8
136
+ if (is.character(resolution)) {
137
+ if (grepl(",", resolution)) {
138
+ resolution <- as.numeric(trimws(unlist(strsplit(resolution, ","))))
139
+ } else {
140
+ resolution <- as.numeric(resolution)
141
+ }
142
+ }
143
+ for (res in resolution) {
144
+ case$FindClusters$resolution <- res
145
+ cached <- get_cached(case$FindClusters, paste0("FindClusters_", res), cache_dir)
146
+ res_key <- paste0("seurat_clusters_", res)
147
+ if (is.null(cached$data)) {
148
+ log_info("- Running FindClusters at resolution: {res} ...")
149
+ case$FindClusters$object <- sobj
150
+ sobj1 <- do_call(FindClusters, case$FindClusters)
151
+ levels(sobj1$seurat_clusters) <- paste0("s", as.numeric(levels(sobj1$seurat_clusters)) + 1)
152
+ sobj1[[res_key]] <- sobj1$seurat_clusters
153
+ cached$data <- sobj1@meta.data[, res_key, drop = FALSE]
154
+ save_to_cache(cached, paste0("FindClusters_", res), cache_dir)
155
+ } else {
156
+ log_info("- Using cached FindClusters at resolution: {res} ...")
157
+ }
158
+ ident_table <- table(cached$data[[res_key]])
159
+ log_info(" Found {length(ident_table)} clusters")
160
+ print(ident_table)
161
+ cat("\n")
162
+ }
163
+ log_info("- Updating meta.data with subclusters...")
164
+ srtobj <- AddMetaData(srtobj, metadata = cached$data, col.name = key)
165
+ srtobj[[paste0("sub_umap_", key)]] <- reduc
166
+ }
167
+
168
+ log_info("Saving results ...")
169
+ saveRDS(srtobj, file = rdsfile)
@@ -54,7 +54,7 @@ do_one_comparison <- function(
54
54
  subset_prefix,
55
55
  groupname
56
56
  ) {
57
- print(paste(" Design:", compname, "(", case, ",", control, ")"))
57
+ log_info(paste(" Design: {compname} ({case}, {control})"))
58
58
  case_code = paste0("subset(obj, subset = ", subset_col, " == '", case, "')")
59
59
  case_obj = tryCatch({
60
60
  eval(parse(text = case_code))
@@ -62,7 +62,7 @@ do_one_comparison <- function(
62
62
  NULL
63
63
  })
64
64
  if (is.null(case_obj)) {
65
- print(" Skip (not enough cells in case)")
65
+ log_warn(" Skip (not enough cells in case)")
66
66
  return (NULL)
67
67
  }
68
68
  control_code = paste0("subset(obj, subset = ", subset_col, " == '", control, "')")
@@ -72,7 +72,7 @@ do_one_comparison <- function(
72
72
  NULL
73
73
  })
74
74
  if (is.null(control_obj)) {
75
- print(" Skip (not enough cells in control)")
75
+ log_warn(" Skip (not enough cells in control)")
76
76
  add_report(
77
77
  list(kind = "error", content = "Not enough cells in control"),
78
78
  h1 = groupname,
@@ -86,7 +86,7 @@ do_one_comparison <- function(
86
86
  odir = file.path(groupdir, paste0(subset_prefix, compname))
87
87
  dir.create(odir, showWarnings = FALSE)
88
88
  if (ncol(exprs_case) < 3 || ncol(exprs_control) < 3) {
89
- print(" Skip (not enough cells)")
89
+ log_warn(" Skip (not enough cells)")
90
90
  add_report(
91
91
  list(kind = "error", content = "Not enough cells"),
92
92
  h1 = groupname,
@@ -131,7 +131,7 @@ do_one_comparison <- function(
131
131
  }
132
132
 
133
133
  do_one_group <- function(group) {
134
- print(paste("- Group:", group, "..."))
134
+ log_info("- Group: {group} ...")
135
135
 
136
136
  genes = intersect(metabolics, rownames(sobj))
137
137
  group_code = paste0(
@@ -71,7 +71,7 @@ num_of_pathways <- function(gmtfile, overlapgenes) {
71
71
  }
72
72
 
73
73
  do_one_subset <- function(s, subset_col, subset_prefix) {
74
- print(paste0(" Processing subset: ", s, "..."))
74
+ log_info(" Processing subset: {s} ...")
75
75
  if (is.null(s)) {
76
76
  subset_dir <- file.path(outdir, "ALL")
77
77
  dir.create(subset_dir, showWarnings = FALSE)
@@ -118,7 +118,7 @@ do_one_subset <- function(s, subset_col, subset_prefix) {
118
118
 
119
119
  for (pi in seq_along(pathway_names)) {
120
120
  p <- pathway_names[pi]
121
- print(paste0(" * Pathway (", pi, "): ", p, "..."))
121
+ log_info(" * Pathway ({pi}): {p} ...")
122
122
  genes <- pathways[[p]]
123
123
  genes_comm <- intersect(genes, rownames(subset_obj))
124
124
  genes_expressed <- names(rowSums(subset_obj)[rowSums(subset_obj) > 0])
@@ -312,7 +312,7 @@ do_one_subset <- function(s, subset_col, subset_prefix) {
312
312
  }
313
313
 
314
314
  do_one_subset_col <- function(subset_col, subset_prefix) {
315
- print(paste0("- Handling subset column: ", subset_col, " ..."))
315
+ log_info("- Handling subset column: {subset_col} ...")
316
316
  if (is.null(subset_col)) {
317
317
  do_one_subset(NULL, subset_col = NULL, subset_prefix = NULL)
318
318
  } else {
@@ -2,9 +2,8 @@
2
2
  # immfile, outdir, mutaters, immdata, n_samples
3
3
 
4
4
  log_info("")
5
- log_info("#####################################")
6
- log_info("# Basic analysis #")
7
- log_info("#####################################")
5
+ log_info("# Basic analysis")
6
+ log_info("-----------------------------------")
8
7
 
9
8
  volumes = {{envs.volumes | r}}
10
9
  lens = {{envs.lens | r}}