biopipen 0.27.1__tar.gz → 0.27.3__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 (245) hide show
  1. {biopipen-0.27.1 → biopipen-0.27.3}/PKG-INFO +3 -2
  2. biopipen-0.27.3/biopipen/__init__.py +1 -0
  3. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/ns/scrna.py +8 -0
  4. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/ns/snp.py +18 -15
  5. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/ns/tcr.py +73 -0
  6. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/scrna/MarkersFinder.R +30 -5
  7. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/scrna/MetaMarkers.R +17 -3
  8. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/scrna/RadarPlots.R +2 -2
  9. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/scrna/ScFGSEA.R +21 -4
  10. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/scrna/SeuratPreparing.R +113 -1
  11. biopipen-0.27.3/biopipen/scripts/snp/PlinkSimulation.py +124 -0
  12. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/stats/DiffCoexpr.R +3 -3
  13. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/tcr/CloneResidency.R +16 -4
  14. biopipen-0.27.3/biopipen/scripts/tcr/TCRDock.py +106 -0
  15. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/utils/misc.py +5 -1
  16. {biopipen-0.27.1 → biopipen-0.27.3}/pyproject.toml +3 -2
  17. {biopipen-0.27.1 → biopipen-0.27.3}/setup.py +6 -5
  18. biopipen-0.27.1/biopipen/__init__.py +0 -1
  19. biopipen-0.27.1/biopipen/scripts/snp/PlinkSimulation.py +0 -88
  20. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/core/__init__.py +0 -0
  21. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/core/config.py +0 -0
  22. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/core/config.toml +0 -0
  23. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/core/defaults.py +0 -0
  24. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/core/filters.py +0 -0
  25. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/core/proc.py +0 -0
  26. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/core/testing.py +0 -0
  27. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/ns/__init__.py +0 -0
  28. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/ns/bam.py +0 -0
  29. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/ns/bcftools.py +0 -0
  30. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/ns/bed.py +0 -0
  31. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/ns/cellranger.py +0 -0
  32. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/ns/cellranger_pipeline.py +0 -0
  33. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/ns/cnv.py +0 -0
  34. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/ns/cnvkit.py +0 -0
  35. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/ns/cnvkit_pipeline.py +0 -0
  36. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/ns/delim.py +0 -0
  37. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/ns/gene.py +0 -0
  38. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/ns/gsea.py +0 -0
  39. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/ns/misc.py +0 -0
  40. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/ns/plot.py +0 -0
  41. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/ns/rnaseq.py +0 -0
  42. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/ns/scrna_metabolic_landscape.py +0 -0
  43. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/ns/stats.py +0 -0
  44. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/ns/tcgamaf.py +0 -0
  45. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/ns/vcf.py +0 -0
  46. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/ns/web.py +0 -0
  47. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/reports/bam/CNAClinic.svelte +0 -0
  48. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/reports/bam/CNVpytor.svelte +0 -0
  49. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/reports/bam/ControlFREEC.svelte +0 -0
  50. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/reports/cellranger/CellRangerCount.svelte +0 -0
  51. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/reports/cellranger/CellRangerSummary.svelte +0 -0
  52. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/reports/cellranger/CellRangerVdj.svelte +0 -0
  53. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/reports/cnv/AneuploidyScore.svelte +0 -0
  54. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/reports/cnv/AneuploidyScoreSummary.svelte +0 -0
  55. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/reports/cnv/TMADScoreSummary.svelte +0 -0
  56. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/reports/cnvkit/CNVkitDiagram.svelte +0 -0
  57. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/reports/cnvkit/CNVkitHeatmap.svelte +0 -0
  58. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/reports/cnvkit/CNVkitScatter.svelte +0 -0
  59. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/reports/delim/SampleInfo.svelte +0 -0
  60. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/reports/gsea/FGSEA.svelte +0 -0
  61. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/reports/gsea/GSEA.svelte +0 -0
  62. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/reports/scrna/CellsDistribution.svelte +0 -0
  63. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/reports/scrna/DimPlots.svelte +0 -0
  64. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/reports/scrna/MarkersFinder.svelte +0 -0
  65. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/reports/scrna/MetaMarkers.svelte +0 -0
  66. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/reports/scrna/RadarPlots.svelte +0 -0
  67. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/reports/scrna/ScFGSEA.svelte +0 -0
  68. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/reports/scrna/SeuratClusterStats.svelte +0 -0
  69. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/reports/scrna/SeuratMap2Ref.svelte +0 -0
  70. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/reports/scrna/SeuratPreparing.svelte +0 -0
  71. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/reports/scrna/TopExpressingGenes.svelte +0 -0
  72. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/reports/scrna_metabolic_landscape/MetabolicFeatures.svelte +0 -0
  73. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/reports/scrna_metabolic_landscape/MetabolicFeaturesIntraSubset.svelte +0 -0
  74. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/reports/scrna_metabolic_landscape/MetabolicPathwayActivity.svelte +0 -0
  75. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/reports/scrna_metabolic_landscape/MetabolicPathwayHeterogeneity.svelte +0 -0
  76. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/reports/tcr/CDR3AAPhyschem.svelte +0 -0
  77. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/reports/tcr/CloneResidency.svelte +0 -0
  78. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/reports/tcr/Immunarch.svelte +0 -0
  79. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/reports/tcr/SampleDiversity.svelte +0 -0
  80. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/reports/tcr/TCRClusterStats.svelte +0 -0
  81. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/reports/tcr/TESSA.svelte +0 -0
  82. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/reports/tcr/VJUsage.svelte +0 -0
  83. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/reports/utils/gsea.liq +0 -0
  84. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/reports/utils/misc.liq +0 -0
  85. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/reports/vcf/TruvariBenchSummary.svelte +0 -0
  86. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/reports/vcf/TruvariConsistency.svelte +0 -0
  87. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/bam/BamMerge.py +0 -0
  88. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/bam/BamSplitChroms.py +0 -0
  89. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/bam/CNAClinic.R +0 -0
  90. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/bam/CNVpytor.py +0 -0
  91. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/bam/ControlFREEC.py +0 -0
  92. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/bcftools/BcftoolsAnnotate.py +0 -0
  93. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/bcftools/BcftoolsFilter.py +0 -0
  94. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/bcftools/BcftoolsSort.py +0 -0
  95. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/bed/Bed2Vcf.py +0 -0
  96. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/bed/BedConsensus.py +0 -0
  97. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/bed/BedLiftOver.sh +0 -0
  98. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/bed/BedtoolsMerge.py +0 -0
  99. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/cellranger/CellRangerCount.py +0 -0
  100. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/cellranger/CellRangerSummary.R +0 -0
  101. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/cellranger/CellRangerVdj.py +0 -0
  102. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/cnv/AneuploidyScore.R +0 -0
  103. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/cnv/AneuploidyScoreSummary.R +0 -0
  104. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/cnv/TMADScore.R +0 -0
  105. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/cnv/TMADScoreSummary.R +0 -0
  106. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/cnvkit/CNVkitAccess.py +0 -0
  107. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/cnvkit/CNVkitAutobin.py +0 -0
  108. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/cnvkit/CNVkitBatch.py +0 -0
  109. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/cnvkit/CNVkitCall.py +0 -0
  110. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/cnvkit/CNVkitCoverage.py +0 -0
  111. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/cnvkit/CNVkitDiagram.py +0 -0
  112. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/cnvkit/CNVkitFix.py +0 -0
  113. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/cnvkit/CNVkitGuessBaits.py +0 -0
  114. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/cnvkit/CNVkitHeatmap.py +0 -0
  115. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/cnvkit/CNVkitReference.py +0 -0
  116. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/cnvkit/CNVkitScatter.py +0 -0
  117. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/cnvkit/CNVkitSegment.py +0 -0
  118. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/cnvkit/guess_baits.py +0 -0
  119. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/delim/RowsBinder.R +0 -0
  120. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/delim/SampleInfo.R +0 -0
  121. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/gene/GeneNameConversion.py +0 -0
  122. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/gsea/Enrichr.R +0 -0
  123. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/gsea/FGSEA.R +0 -0
  124. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/gsea/GSEA.R +0 -0
  125. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/gsea/PreRank.R +0 -0
  126. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/misc/Config2File.py +0 -0
  127. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/misc/Str2File.py +0 -0
  128. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/plot/Heatmap.R +0 -0
  129. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/plot/VennDiagram.R +0 -0
  130. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/rnaseq/Simulation-ESCO.R +0 -0
  131. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/rnaseq/Simulation-RUVcorr.R +0 -0
  132. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/rnaseq/Simulation.R +0 -0
  133. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/rnaseq/UnitConversion.R +0 -0
  134. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/scrna/AnnData2Seurat.R +0 -0
  135. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/scrna/CellTypeAnnotation-celltypist.R +0 -0
  136. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/scrna/CellTypeAnnotation-direct.R +0 -0
  137. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/scrna/CellTypeAnnotation-hitype.R +0 -0
  138. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/scrna/CellTypeAnnotation-sccatch.R +0 -0
  139. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/scrna/CellTypeAnnotation-sctype.R +0 -0
  140. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/scrna/CellTypeAnnotation.R +0 -0
  141. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/scrna/CellsDistribution.R +0 -0
  142. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/scrna/DimPlots.R +0 -0
  143. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/scrna/ExprImpution-alra.R +0 -0
  144. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/scrna/ExprImpution-rmagic.R +0 -0
  145. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/scrna/ExprImpution-scimpute.R +0 -0
  146. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/scrna/ExprImpution.R +0 -0
  147. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/scrna/ModuleScoreCalculator.R +0 -0
  148. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/scrna/SCImpute.R +0 -0
  149. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/scrna/Seurat2AnnData.R +0 -0
  150. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/scrna/SeuratClusterStats-dimplots.R +0 -0
  151. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/scrna/SeuratClusterStats-features.R +0 -0
  152. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/scrna/SeuratClusterStats-hists.R +0 -0
  153. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/scrna/SeuratClusterStats-ngenes.R +0 -0
  154. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/scrna/SeuratClusterStats-stats.R +0 -0
  155. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/scrna/SeuratClusterStats.R +0 -0
  156. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/scrna/SeuratClustering.R +0 -0
  157. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/scrna/SeuratFilter.R +0 -0
  158. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/scrna/SeuratLoading.R +0 -0
  159. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/scrna/SeuratMap2Ref.R +0 -0
  160. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/scrna/SeuratMetadataMutater.R +0 -0
  161. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/scrna/SeuratSplit.R +0 -0
  162. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/scrna/SeuratSubClustering.R +0 -0
  163. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/scrna/SeuratSubset.R +0 -0
  164. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/scrna/SeuratTo10X.R +0 -0
  165. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/scrna/TopExpressingGenes.R +0 -0
  166. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/scrna/Write10X.R +0 -0
  167. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/scrna/celltypist-wrapper.py +0 -0
  168. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/scrna/sctype.R +0 -0
  169. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/scrna_metabolic_landscape/MetabolicFeatures.R +0 -0
  170. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/scrna_metabolic_landscape/MetabolicFeaturesIntraSubset.R +0 -0
  171. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/scrna_metabolic_landscape/MetabolicPathwayActivity.R +0 -0
  172. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/scrna_metabolic_landscape/MetabolicPathwayHeterogeneity.R +0 -0
  173. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/stats/ChowTest.R +0 -0
  174. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/stats/LiquidAssoc.R +0 -0
  175. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/stats/MetaPvalue.R +0 -0
  176. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/tcgamaf/Maf2Vcf.py +0 -0
  177. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/tcgamaf/MafAddChr.py +0 -0
  178. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/tcgamaf/maf2vcf.pl +0 -0
  179. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/tcr/Attach2Seurat.R +0 -0
  180. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/tcr/CDR3AAPhyschem.R +0 -0
  181. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/tcr/CloneSizeQQPlot.R +0 -0
  182. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/tcr/GIANA/GIANA.py +0 -0
  183. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/tcr/GIANA/GIANA4.py +0 -0
  184. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/tcr/GIANA/Imgt_Human_TRBV.fasta +0 -0
  185. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/tcr/GIANA/query.py +0 -0
  186. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/tcr/Immunarch-basic.R +0 -0
  187. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/tcr/Immunarch-clonality.R +0 -0
  188. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/tcr/Immunarch-diversity.R +0 -0
  189. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/tcr/Immunarch-geneusage.R +0 -0
  190. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/tcr/Immunarch-kmer.R +0 -0
  191. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/tcr/Immunarch-overlap.R +0 -0
  192. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/tcr/Immunarch-spectratyping.R +0 -0
  193. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/tcr/Immunarch-tracking.R +0 -0
  194. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/tcr/Immunarch-vjjunc.R +0 -0
  195. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/tcr/Immunarch.R +0 -0
  196. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/tcr/Immunarch2VDJtools.R +0 -0
  197. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/tcr/ImmunarchFilter.R +0 -0
  198. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/tcr/ImmunarchLoading.R +0 -0
  199. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/tcr/ImmunarchSplitIdents.R +0 -0
  200. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/tcr/SampleDiversity.R +0 -0
  201. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/tcr/TCRClusterStats.R +0 -0
  202. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/tcr/TCRClustering.R +0 -0
  203. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/tcr/TESSA.R +0 -0
  204. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/tcr/TESSA_source/Atchley_factors.csv +0 -0
  205. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/tcr/TESSA_source/BriseisEncoder.py +0 -0
  206. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/tcr/TESSA_source/MCMC_control.R +0 -0
  207. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/tcr/TESSA_source/TrainedEncoder.h5 +0 -0
  208. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/tcr/TESSA_source/fixed_b.csv +0 -0
  209. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/tcr/TESSA_source/initialization.R +0 -0
  210. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/tcr/TESSA_source/post_analysis.R +0 -0
  211. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/tcr/TESSA_source/real_data.R +0 -0
  212. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/tcr/TESSA_source/update.R +0 -0
  213. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/tcr/TESSA_source/utility.R +0 -0
  214. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/tcr/VJUsage.R +0 -0
  215. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/tcr/immunarch-patched.R +0 -0
  216. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/tcr/vdjtools-patch.sh +0 -0
  217. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/vcf/TruvariBench.sh +0 -0
  218. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/vcf/TruvariBenchSummary.R +0 -0
  219. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/vcf/TruvariConsistency.R +0 -0
  220. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/vcf/Vcf2Bed.py +0 -0
  221. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/vcf/VcfAnno.py +0 -0
  222. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/vcf/VcfDownSample.sh +0 -0
  223. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/vcf/VcfFilter.py +0 -0
  224. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/vcf/VcfFix.py +0 -0
  225. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/vcf/VcfFix_utils.py +0 -0
  226. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/vcf/VcfIndex.py +0 -0
  227. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/vcf/VcfIntersect.py +0 -0
  228. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/vcf/VcfLiftOver.sh +0 -0
  229. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/vcf/VcfSplitSamples.py +0 -0
  230. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/web/Download.py +0 -0
  231. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/scripts/web/DownloadList.py +0 -0
  232. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/utils/__init__.py +0 -0
  233. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/utils/caching.R +0 -0
  234. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/utils/common_docstrs.py +0 -0
  235. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/utils/gene.R +0 -0
  236. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/utils/gene.py +0 -0
  237. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/utils/gsea.R +0 -0
  238. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/utils/io.R +0 -0
  239. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/utils/misc.R +0 -0
  240. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/utils/mutate_helpers.R +0 -0
  241. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/utils/plot.R +0 -0
  242. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/utils/reference.py +0 -0
  243. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/utils/rnaseq.R +0 -0
  244. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/utils/single_cell.R +0 -0
  245. {biopipen-0.27.1 → biopipen-0.27.3}/biopipen/utils/vcf.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: biopipen
3
- Version: 0.27.1
3
+ Version: 0.27.3
4
4
  Summary: Bioinformatics processes/pipelines that can be run from `pipen run`
5
5
  License: MIT
6
6
  Author: pwwang
@@ -17,6 +17,7 @@ Requires-Dist: datar[pandas] (>=0.15.6,<0.16.0)
17
17
  Requires-Dist: pipen-board[report] (>=0.15,<0.16)
18
18
  Requires-Dist: pipen-cli-run (>=0.13,<0.14)
19
19
  Requires-Dist: pipen-filters (>=0.12,<0.13)
20
- Requires-Dist: pipen-poplog (>=0.1,<0.2)
20
+ Requires-Dist: pipen-poplog (>=0.1.2,<0.2.0)
21
21
  Requires-Dist: pipen-runinfo (>=0.6,<0.7) ; extra == "runinfo"
22
22
  Requires-Dist: pipen-verbose (>=0.11,<0.12)
23
+ Requires-Dist: pyyaml-include (==1.*)
@@ -0,0 +1 @@
1
+ __version__ = "0.27.3"
@@ -201,6 +201,13 @@ class SeuratPreparing(Proc):
201
201
  - scvi: Same as `scVIIntegration`.
202
202
  - <more>: See <https://satijalab.org/seurat/reference/integratelayers>
203
203
 
204
+ DoubletFinder (ns): Arguments to run [`DoubletFinder`](https://github.com/chris-mcginnis-ucsf/DoubletFinder).
205
+ See also <https://demultiplexing-doublet-detecting-docs.readthedocs.io/en/latest/DoubletFinder.html>.
206
+ To disable `DoubletFinder`, set `envs.DoubletFinder` to `None` or `False`; or set `pcs` to `0`.
207
+ - PCs (type=int): Number of PCs to use for 'doubletFinder' function.
208
+ - doublets (type=float): Number of expected doublets as a proportion of the pool size.
209
+ - pN (type=float): Number of doublets to simulate as a proportion of the pool size.
210
+
204
211
  Requires:
205
212
  r-seurat:
206
213
  - check: {{proc.lang}} <(echo "library(Seurat)")
@@ -227,6 +234,7 @@ class SeuratPreparing(Proc):
227
234
  "min_cells": 5,
228
235
  },
229
236
  "IntegrateLayers": {"method": "harmony"},
237
+ "DoubletFinder": {"PCs": 0, "pN": 0.25, "doublets": 0.075},
230
238
  }
231
239
  script = "file://../scripts/scrna/SeuratPreparing.R"
232
240
  plugin_opts = {
@@ -7,12 +7,15 @@ from ..core.config import config
7
7
  class PlinkSimulation(Proc):
8
8
  """Simulate SNPs using PLINK v1.9
9
9
 
10
- See also <https://www.cog-genomics.org/plink/1.9/input#simulate>.
10
+ See also <https://www.cog-genomics.org/plink/1.9/input#simulate> and
11
+ <https://pwwang.github.io/biopipen/api/biopipen.ns.snp/#biopipen.ns.snp.PlinkSimulation>
11
12
 
12
13
  Input:
13
- nsnps: Number of SNPs to simulate
14
- ncases: Number of cases to simulate
15
- nctrls: Number of controls to simulate
14
+ configfile: Configuration file containing the parameters for the simulation.
15
+ The configuration file (in toml, yaml or json format) should contain a
16
+ dictionary of parameters. The parameters are listed in `envs` except
17
+ `ncores`, which is used for parallelization. You can set parameters
18
+ in `envs` and override them in the configuration file.
16
19
 
17
20
  Output:
18
21
  outdir: Output directory containing the simulated data
@@ -21,9 +24,11 @@ class PlinkSimulation(Proc):
21
24
  SNPs and columns representing samples.
22
25
 
23
26
  Envs:
27
+ nsnps (type=int): Number of SNPs to simulate
28
+ ncases (type=int): Number of cases to simulate
29
+ nctrls (type=int): Number of controls to simulate
24
30
  plink: Path to PLINK v1.9
25
- seed (type=int): Random seed.
26
- If not set, seed will not be set.
31
+ seed (type=int): Random seed. If not set, seed will not be set.
27
32
  label: Prefix label for the SNPs.
28
33
  prevalence (type=float): Disease prevalence.
29
34
  minfreq (type=float): Minimum allele frequency.
@@ -41,19 +46,17 @@ class PlinkSimulation(Proc):
41
46
  This only affects the sample names in the genotype matrix file
42
47
  (`out.gtmat`).
43
48
  """
44
- input = "nsnps:var, ncases:var, nctrls:var"
49
+ input = "configfile:file"
45
50
  output = [
46
- (
47
- "outdir:dir:{{in.nsnps | int}}_"
48
- "{{in.ncases | int}}xcases_{{in.nctrls | int}}xctrls.plink_sim"
49
- ),
50
- (
51
- "gtmat:file:{{in.nsnps | int}}_"
52
- "{{in.ncases | int}}xcases_{{in.nctrls | int}}xctrls.plink_sim/gtmat.txt"
53
- ),
51
+ "outdir:dir:{{in.configfile | stem}}.plink_sim",
52
+ "gtmat:file:{{in.configfile | stem}}.plink_sim/"
53
+ "{{in.configfile | stem}}-gtmat.txt",
54
54
  ]
55
55
  lang = config.lang.python
56
56
  envs = {
57
+ "nsnps": None,
58
+ "ncases": None,
59
+ "nctrls": None,
57
60
  "plink": config.exe.plink,
58
61
  "seed": None,
59
62
  "label": "SNP",
@@ -983,6 +983,7 @@ class CloneResidency(Proc):
983
983
  before calculating the clone residency. For example, `Clones > 1` to filter
984
984
  out singletons.
985
985
  prefix: The prefix of the cell barcodes in the `Seurat` object.
986
+ upset_ymax: The maximum value of the y-axis in the upset bar plots.
986
987
  upset_trans: The transformation to apply to the y axis of upset bar plots.
987
988
  For example, `log10` or `sqrt`. If not specified, the y axis will be
988
989
  plotted as is. Note that the position of the bar plots will be dodged
@@ -1007,6 +1008,7 @@ class CloneResidency(Proc):
1007
1008
  "mutaters": {},
1008
1009
  "subset": None,
1009
1010
  "prefix": "{Sample}_",
1011
+ "upset_ymax": None,
1010
1012
  "upset_trans": None,
1011
1013
  "cases": {},
1012
1014
  }
@@ -1595,3 +1597,74 @@ class TESSA(Proc):
1595
1597
  }
1596
1598
  script = "file://../scripts/tcr/TESSA.R"
1597
1599
  plugin_opts = {"report": "file://../reports/tcr/TESSA.svelte"}
1600
+
1601
+
1602
+ class TCRDock(Proc):
1603
+ """Using TCRDock to predict the structure of MHC-peptide-TCR complexes
1604
+
1605
+ See <https://github.com/phbradley/TCRdock>.
1606
+
1607
+ Input:
1608
+ configfile: The config file for TCRDock
1609
+ It's should be a toml file with the keys listed in `envs`, including
1610
+ `organism`, `mhc_class`, `mhc`, `peptide`, `va`, `ja`, `vb`, `jb`,
1611
+ `cdr3a`, and `cdr3b`.
1612
+ The values will overwrite the values in `envs`.
1613
+
1614
+ Output:
1615
+ outdir: The output directory containing the results
1616
+
1617
+ Envs:
1618
+ organism: The organism of the TCR, peptide and MHC
1619
+ mhc_class (type=int): The MHC class, either `1` or `2`
1620
+ mhc: The MHC allele, e.g., `A*02:01`
1621
+ peptide: The peptide sequence
1622
+ va: The V alpha gene
1623
+ ja: The J alpha gene
1624
+ vb: The V beta gene
1625
+ jb: The J beta gene
1626
+ cdr3a: The CDR3 alpha sequence
1627
+ cdr3b: The CDR3 beta sequence
1628
+ python: The path of python with dependencies for `tcrdock` installed.
1629
+ If not provided, `TCRDock.lang` will be used (the same interpreter
1630
+ used for the wrapper script).
1631
+ It could also be a list to specify, for example, a python in a conda
1632
+ environment (e.g., `["conda", "run", "-n", "myenv", "python"]`).
1633
+ tmpdir: The temporary directory used to clone the `tcrdock` source code if
1634
+ `envs.tcrdock` is not provided.
1635
+ tcrdock: The path to the `tcrdock` source code repo.
1636
+ You need to clone the source code from the github repository.
1637
+ <https://github.com/phbradley/TCRdock> at
1638
+ revision c5a7af42eeb0c2a4492a4d4fe803f1f9aafb6193 at main branch.
1639
+ You also have to run `download_blast.py` after cloning to download the
1640
+ blast database in the directory.
1641
+ If not provided, we will clone the source code to the `envs.tmpdir`
1642
+ directory and run the `download_blast.py` script.
1643
+ model_name: The model name to use
1644
+ model_file: The model file to use.
1645
+ If provided as a relative path, it should be relative to the
1646
+ `<envs.data_dir>/params/`, otherwise, it should be the full path.
1647
+ data_dir: The data directory that contains the model files.
1648
+ The model files should be in the `params` subdirectory.
1649
+ """
1650
+ input = "configfile:file"
1651
+ output = "outdir:dir:{{in.configfile | stem}}.tcrdock"
1652
+ lang = config.lang.python
1653
+ envs = {
1654
+ "tcrdock": None,
1655
+ "organism": "human",
1656
+ "mhc_class": 1,
1657
+ "mhc": "A*02:01",
1658
+ "peptide": None,
1659
+ "va": None,
1660
+ "ja": None,
1661
+ "vb": None,
1662
+ "jb": None,
1663
+ "cdr3a": None,
1664
+ "cdr3b": None,
1665
+ "python": None,
1666
+ "model_name": "model_2_ptm_ft4",
1667
+ "model_file": "tcrpmhc_run4_af_mhc_params_891.pkl",
1668
+ "data_dir": None,
1669
+ }
1670
+ script = "file://../scripts/tcr/TCRDock.py"
@@ -120,7 +120,7 @@ expand_each <- function(name, case) {
120
120
  pull(case$each) %>% na.omit() %>% unique() %>% as.vector()
121
121
  }
122
122
  for (each in eachs) {
123
- by <- make.names(paste0(".", name, "_", case$each,"_", each))
123
+ by <- make.names(paste0("..", name, "_", case$each,"_", each))
124
124
  srtobj@meta.data <<- srtobj@meta.data %>% mutate(
125
125
  !!sym(by) := if_else(
126
126
  !!sym(case$each) == each,
@@ -364,6 +364,16 @@ add_case_report <- function(info, sigmarkers, siggenes) {
364
364
  }
365
365
  }
366
366
 
367
+ ensure_sobj <- function(expr, allow_empty) {
368
+ tryCatch({ expr }, error = function(e) {
369
+ if (allow_empty) {
370
+ log_warn(" Ignoring this case: {e$message}")
371
+ return(NULL)
372
+ } else {
373
+ stop(e)
374
+ }
375
+ })
376
+ }
367
377
 
368
378
  do_case_findall <- function(casename) {
369
379
  # casename
@@ -382,10 +392,17 @@ do_case_findall <- function(casename) {
382
392
  # args$min.cells.group <- args$min.cells.group %||% 1
383
393
  # args$min.cells.feature <- args$min.cells.feature %||% 1
384
394
  # args$min.pct <- args$min.pct %||% 0
395
+ allow_empty = startsWith(case$group.by, "..")
385
396
  if (!is.null(case$subset)) {
386
- args$object <- srtobj %>% filter(!!parse_expr(case$subset) & !is.na(!!sym(case$group.by)))
397
+ args$object <- ensure_sobj({
398
+ srtobj %>% filter(!!parse_expr(case$subset) & !is.na(!!sym(case$group.by)))
399
+ }, allow_empty)
400
+ if (is.null(args$object)) { return() }
387
401
  } else {
388
- args$object <- srtobj %>% filter(!is.na(!!sym(case$group.by)))
402
+ args$object <- ensure_sobj({
403
+ srtobj %>% filter(!is.na(!!sym(case$group.by)))
404
+ }, allow_empty)
405
+ if (is.null(args$object)) { return() }
389
406
  }
390
407
  Idents(args$object) <- case$group.by
391
408
 
@@ -486,11 +503,19 @@ do_case <- function(casename) {
486
503
  # sigmarkers
487
504
  # rest
488
505
  args <- case$rest
506
+ allow_empty = startsWith(case$group.by, "..")
489
507
  if (!is.null(case$subset)) {
490
- args$object <- srtobj %>% filter(!!parse_expr(case$subset) & !is.na(!!sym(case$group.by)))
508
+ args$object <- ensure_sobj({
509
+ srtobj %>% filter(!!parse_expr(case$subset) & !is.na(!!sym(case$group.by)))
510
+ }, allow_empty)
511
+ if (is.null(args$object)) { return() }
491
512
  } else {
492
- args$object <- srtobj %>% filter(!is.na(!!sym(case$group.by)))
513
+ args$object <- ensure_sobj({
514
+ srtobj %>% filter(!is.na(!!sym(case$group.by)))
515
+ }, allow_empty)
516
+ if (is.null(args$object)) { return() }
493
517
  }
518
+
494
519
  args$assay <- case$assay
495
520
  args$group.by <- case$group.by
496
521
  args$ident.1 <- case$ident.1
@@ -76,7 +76,7 @@ expand_each <- function(name, case) {
76
76
  pull(case$each) %>% unique() %>% na.omit()
77
77
  }
78
78
  for (each in eachs) {
79
- by = make.names(paste0(".", name, "_", case$each, "_", each))
79
+ by = make.names(paste0("..", name, "_", case$each, "_", each))
80
80
  idents <- case$idents
81
81
  if (is.null(idents) || length(idents) == 0) {
82
82
  srtobj@meta.data = srtobj@meta.data %>%
@@ -169,17 +169,31 @@ do_enrich <- function(info, markers, sig) {
169
169
  }
170
170
  }
171
171
 
172
+ ensure_sobj <- function(expr, allow_empty) {
173
+ tryCatch({ expr }, error = function(e) {
174
+ if (allow_empty) {
175
+ log_warn(" Ignoring this case: {e$message}")
176
+ return(NULL)
177
+ } else {
178
+ stop(e)
179
+ }
180
+ })
181
+ }
182
+
172
183
  do_case <- function(casename) {
173
184
  log_info("- Dealing with case: {casename} ...")
174
185
  info <- casename_info(casename, cases, outdir, create = TRUE)
175
186
  case <- cases[[casename]]
187
+ allow_empty = startsWith(case$group_by, "..")
176
188
 
177
189
  if (sum(!is.na(srtobj@meta.data[[case$group_by]])) == 0) {
178
190
  msg = "Not enough cells to run tests."
179
191
  } else {
180
- sobj <- srtobj %>% filter(!is.na(!!sym(case$group_by)))
192
+ sobj <- ensure_sobj({ srtobj %>% filter(!is.na(!!sym(case$group_by))) }, allow_empty)
193
+ if (is.null(sobj)) { return() }
181
194
  if (!is.null(case$subset)) {
182
- sobj <- srtobj %>% filter(!is.na(!!sym(case$group_by)), !!parse_expr(case$subset))
195
+ sobj <- ensure_sobj({ sobj %>% filter(!!parse_expr(case$subset)) }, allow_empty)
196
+ if (is.null(sobj)) { return() }
183
197
  }
184
198
  df <- tryCatch({
185
199
  GetAssayData(sobj, layer = "data")
@@ -74,10 +74,10 @@ expand_each <- function(name, case) {
74
74
  }
75
75
  } else {
76
76
  if (is.null(case$subset)) {
77
- eachs <- srtobj@meta.data %>%
77
+ eachs <- meta %>%
78
78
  pull(case$each) %>% unique() %>% na.omit() %>% as.vector()
79
79
  } else {
80
- eachs <- srtobj@meta.data %>% filter(!!parse_expr(case$subset)) %>%
80
+ eachs <- meta %>% filter(!!parse_expr(case$subset)) %>%
81
81
  pull(case$each) %>% unique() %>% na.omit() %>% as.vector()
82
82
  }
83
83
  for (each in eachs) {
@@ -72,7 +72,7 @@ expand_each <- function(name, case) {
72
72
  pull(case$each) %>% na.omit() %>% unique() %>% as.vector()
73
73
  }
74
74
  for (each in eachs) {
75
- by <- make.names(paste0(".", name, "_", case$each,"_", each))
75
+ by <- make.names(paste0("..", name, "_", case$each,"_", each))
76
76
  srtobj@meta.data <<- srtobj@meta.data %>%
77
77
  mutate(!!sym(by) := if_else(
78
78
  !!sym(case$each) == each,
@@ -97,18 +97,35 @@ log_info("- Expanding cases...")
97
97
  cases <- expand_cases(cases, defaults, expand_each)
98
98
 
99
99
 
100
+ ensure_sobj <- function(expr, allow_empty) {
101
+ tryCatch({ expr }, error = function(e) {
102
+ if (allow_empty) {
103
+ log_warn(" Ignoring this case: {e$message}")
104
+ return(NULL)
105
+ } else {
106
+ stop(e)
107
+ }
108
+ })
109
+ }
110
+
111
+
100
112
  do_case <- function(name, case) {
101
113
  log_info("- Handling case: {name} ...")
102
114
  info <- casename_info(name, cases, outdir, create = TRUE)
103
115
 
116
+ allow_empty = startsWith(case$group.by, "..")
104
117
  # prepare expression matrix
105
118
  log_info(" Preparing expression matrix...")
106
- sobj <- srtobj %>% filter(!is.na(!!sym(case$group.by)))
119
+ sobj <- ensure_sobj({ srtobj %>% filter(!is.na(!!sym(case$group.by))) }, allow_empty)
120
+ if (is.null(sobj)) { return() }
121
+
107
122
  if (!is.null(case$subset)) {
108
- sobj <- sobj %>% filter(!!!parse_exprs(case$subset))
123
+ sobj <- ensure_sobj({ sobj %>% filter(!!!parse_exprs(case$subset)) }, allow_empty)
124
+ if (is.null(sobj)) { return() }
109
125
  }
110
126
  if (!is.null(case$ident.2)) {
111
- sobj <- sobj %>% filter(!!sym(case$group.by) %in% c(case$ident.1, case$ident.2))
127
+ sobj <- ensure_sobj({ sobj %>% filter(!!sym(case$group.by) %in% c(case$ident.1, case$ident.2)) }, allow_empty)
128
+ if (is.null(sobj)) { return() }
112
129
  }
113
130
 
114
131
  allclasses <- sobj@meta.data[, case$group.by, drop = TRUE]
@@ -13,6 +13,7 @@ envs = {{envs | r: todot = "-", skip = 1}}
13
13
 
14
14
  set.seed(8525)
15
15
  options(future.globals.maxSize = 80000 * 1024^2)
16
+ options(future.rng.onMisuse="ignore")
16
17
  options(Seurat.object.assay.version = "v5")
17
18
  plan(strategy = "multicore", workers = envs$ncores)
18
19
 
@@ -342,7 +343,7 @@ RunPCAArgs$object <- sobj
342
343
  sobj <- do_call(RunPCA, RunPCAArgs)
343
344
 
344
345
  if (!envs$no_integration) {
345
- log_info("- Running IntegrateLayers ...")
346
+ log_info("- Running IntegrateLayers (method = {envs$IntegrateLayers$method}) ...")
346
347
  IntegrateLayersArgs <- envs$IntegrateLayers
347
348
  method <- IntegrateLayersArgs$method
348
349
  if (!is.null(IntegrateLayersArgs$reference) && is.character(IntegrateLayersArgs$reference)) {
@@ -383,6 +384,117 @@ if (!envs$use_sct) {
383
384
  sobj <- JoinLayers(sobj)
384
385
  }
385
386
 
387
+ if (!is.null(envs$DoubletFinder) && is.list(envs$DoubletFinder) && envs$DoubletFinder$PCs > 0) {
388
+ library(DoubletFinder)
389
+
390
+ log_info("Running DoubletFinder ...")
391
+ log_info("- Preparing Seurat object ...")
392
+ # More controls from envs?
393
+ sobj <- FindNeighbors(sobj, dims = 1:envs$DoubletFinder$PCs)
394
+ sobj <- FindClusters(sobj)
395
+
396
+ log_info("- pK Indentification ...")
397
+ sweep.res.list <- paramSweep(
398
+ sobj,
399
+ PCs = 1:envs$DoubletFinder$PCs,
400
+ sct = envs$use_sct,
401
+ num.cores = envs$ncores
402
+ )
403
+ sweep.stats <- summarizeSweep(sweep.res.list, GT = FALSE)
404
+ bcmvn <- find.pK(sweep.stats)
405
+
406
+ bcmvn$Selected <- bcmvn$pK == bcmvn$pK[which.max(bcmvn$BCmetric)[1]]
407
+ plot <- ggplot(bcmvn, aes(x = pK, y = BCmetric, color = Selected)) +
408
+ geom_point() +
409
+ # rotate x axis labels
410
+ theme(axis.text.x = element_text(angle = 90, hjust = 1))
411
+ ggsave(plot, filename = file.path(plotsdir, "pK_BCmetric.png"))
412
+
413
+ pK <- bcmvn$pK[which.max(bcmvn$BCmetric)[1]]
414
+ pK <- as.numeric(as.character(pK))
415
+ pN <- envs$DoubletFinder$pN
416
+ log_info("- Homotypic Doublet Proportion Estimate ...")
417
+ homotypic.prop <- modelHomotypic(Idents(sobj))
418
+ nExp_poi <- round(nrow(sobj@meta.data) * envs$DoubletFinder$doublets)
419
+ nExp_poi.adj <- round(nExp_poi * (1 - homotypic.prop))
420
+
421
+ log_info("- Running DoubletFinder ...")
422
+ sobj <- doubletFinder(
423
+ sobj,
424
+ PCs = 1:envs$DoubletFinder$PCs,
425
+ pN = pN,
426
+ pK = pK,
427
+ nExp = nExp_poi.adj,
428
+ reuse.pANN = FALSE,
429
+ sct = envs$use_sct
430
+ )
431
+ pANN_col <- paste0("pANN_", pN, "_", pK)
432
+ pANN_col <- colnames(sobj@meta.data)[grepl(pANN_col, colnames(sobj@meta.data))]
433
+ DF_col <- paste0("DF.classifications_", pN, "_", pK)
434
+ DF_col <- colnames(sobj@meta.data)[grepl(DF_col, colnames(sobj@meta.data))]
435
+ doublets <- as.data.frame(
436
+ cbind(
437
+ colnames(sobj),
438
+ sobj@meta.data[, pANN_col],
439
+ sobj@meta.data[, DF_col]
440
+ )
441
+ )
442
+ colnames(doublets) <- c("Barcode","DoubletFinder_score","DoubletFinder_DropletType")
443
+ write.table(
444
+ doublets,
445
+ file.path(joboutdir, "DoubletFinder_doublets_singlets.txt"),
446
+ row.names = FALSE,
447
+ quote = FALSE,
448
+ sep = "\t"
449
+ )
450
+
451
+ summary <- as.data.frame(table(doublets$DoubletFinder_DropletType))
452
+ colnames(summary) <- c("Classification", "Droplet_N")
453
+ write.table(
454
+ summary,
455
+ file.path(joboutdir, "DoubletFinder_summary.txt"),
456
+ row.names = FALSE,
457
+ quote = FALSE,
458
+ sep = "\t"
459
+ )
460
+
461
+ # Do a dimplot
462
+ log_info("- Plotting dimension reduction ...")
463
+ dimp <- DimPlot(
464
+ sobj, group.by = DF_col, order = "Doublet",
465
+ cols = c("#333333", "#FF3333"), pt.size = 0.8, alpha = 0.5)
466
+ ggsave(dimp, filename = file.path(plotsdir, "DoubletFinder_dimplot.png"))
467
+
468
+ log_info("- Filtering doublets ...")
469
+ sobj <- subset(sobj, cells = doublets$Barcode[doublets$DoubletFinder_DropletType == "Singlet"])
470
+
471
+ add_report(
472
+ list(
473
+ kind = "descr",
474
+ content = "The table contains the number of cells classified as singlets and doublets."
475
+ ),
476
+ list(
477
+ kind = "table",
478
+ data = list(path = file.path(joboutdir, "DoubletFinder_summary.txt"))
479
+ ),
480
+ h1 = "DoubletFinder Results",
481
+ h2 = "The DoubletFinder Summary"
482
+ )
483
+ add_report(
484
+ list(
485
+ name = "pK vs BCmetric",
486
+ src = file.path(plotsdir, "pK_BCmetric.png")
487
+ ),
488
+ list(
489
+ name = "Dimension Reduction Plot",
490
+ src = file.path(plotsdir, "DoubletFinder_dimplot.png")
491
+ ),
492
+ ui = "table_of_images",
493
+ h1 = "DoubletFinder Results",
494
+ h2 = "Plots"
495
+ )
496
+ }
497
+
386
498
  log_info("Saving filtered seurat object ...")
387
499
  saveRDS(sobj, rdsfile)
388
500
 
@@ -0,0 +1,124 @@
1
+ from pathlib import Path
2
+ from multiprocessing import Pool
3
+ from slugify import slugify
4
+ from simpleconf import Config
5
+ from biopipen.utils.misc import logger, run_command, dict_to_cli_args
6
+
7
+ configfile = {{in.configfile | repr}} # pyright: ignore # noqa: E999
8
+ outdir = {{out.outdir | repr}} # pyright: ignore
9
+ gtmatfile = {{out.gtmat | repr}} # pyright: ignore
10
+ config = Config.load(configfile)
11
+
12
+ default_nsnps = {{envs.nsnps | repr}} # pyright: ignore
13
+ default_ncases = {{envs.ncases | repr}} # pyright: ignore
14
+ default_nctrls = {{envs.nctrls | repr}} # pyright: ignore
15
+ default_plink = {{envs.plink | repr}} # pyright: ignore
16
+ default_seed = {{envs.seed | repr}} # pyright: ignore
17
+ default_label = {{envs.label | repr}} # pyright: ignore
18
+ default_prevalence = {{envs.prevalence | repr}} # pyright: ignore
19
+ default_minfreq = {{envs.minfreq | repr}} # pyright: ignore
20
+ default_maxfreq = {{envs.maxfreq | repr}} # pyright: ignore
21
+ default_hetodds = {{envs.hetodds | repr}} # pyright: ignore
22
+ default_homodds = {{envs.homodds | repr}} # pyright: ignore
23
+ default_missing = {{envs.missing | repr}} # pyright: ignore
24
+ default_args = {{envs.args | repr}} # pyright: ignore
25
+ default_transpose_gtmat = {{envs.transpose_gtmat | repr}} # pyright: ignore
26
+ default_sample_prefix = {{envs.sample_prefix | repr}} # pyright: ignore
27
+
28
+ defaults = {
29
+ "nsnps": default_nsnps,
30
+ "ncases": default_ncases,
31
+ "nctrls": default_nctrls,
32
+ "plink": default_plink,
33
+ "seed": default_seed,
34
+ "label": default_label,
35
+ "prevalence": default_prevalence,
36
+ "minfreq": default_minfreq,
37
+ "maxfreq": default_maxfreq,
38
+ "hetodds": default_hetodds,
39
+ "homodds": default_homodds,
40
+ "missing": default_missing,
41
+ # "args": default_args,
42
+ "transpose_gtmat": default_transpose_gtmat,
43
+ "sample_prefix": default_sample_prefix,
44
+ }
45
+
46
+ def do_one_simulation(confitems):
47
+ args = default_args.copy()
48
+ args.update(confitems.pop("args", {}))
49
+ confs = defaults.copy()
50
+ confs.update(confitems)
51
+ transpose_gtmat = confs.pop("transpose_gtmat")
52
+ sample_prefix = confs.pop("sample_prefix")
53
+
54
+
55
+ logger.debug(" Generating parameters file")
56
+ params_file = Path(outdir) / "params.txt"
57
+ params_file.write_text(
58
+ f"{confs['nsnps']}\t{confs['label']}\t{confs['minfreq']}\t"
59
+ f"{confs['maxfreq']}\t{confs['hetodds']}\t{confs['homodds']}\n"
60
+ )
61
+
62
+ if confs.get('seed') is not None:
63
+ args["seed"] = confs['seed']
64
+
65
+ args["simulate"] = params_file
66
+ args["out"] = Path(outdir) / "sim_snps"
67
+ args["simulate-ncases"] = confs['ncases']
68
+ args["simulate-ncontrols"] = confs['nctrls']
69
+ args["simulate-prevalence"] = confs['prevalence']
70
+ args["simulate-missing"] = confs['missing']
71
+
72
+ cmd = [confs['plink']] + dict_to_cli_args(args)
73
+
74
+ logger.debug(" Running PLINK simulation ...")
75
+ run_command(cmd, fg=True)
76
+
77
+ # Transpose the genotype matrix
78
+ # CHR SNP (C)M POS COUNTED ALT per0_per0 per1_per1 per2_per2
79
+ # 1 SNP_0 0 1 D d 1 0 1
80
+ # 1 SNP_1 0 2 d D 0 1 0
81
+ # 1 SNP_2 0 3 d D 0 0 0
82
+ # 1 SNP_3 0 4 d D 0 0 0
83
+ # 1 SNP_4 0 5 D d 1 2 1
84
+ cmd = [
85
+ confs['plink'],
86
+ "--recode",
87
+ "A" if transpose_gtmat else "A-transpose",
88
+ "tab",
89
+ "--bfile",
90
+ args["out"],
91
+ "--out",
92
+ gtmatfile + ".plink.recoded",
93
+ ]
94
+ logger.debug("- Recoding into genotype matrix ...")
95
+ run_command(cmd, fg=True)
96
+
97
+ logger.debug(" Saving genotype matrix ...")
98
+ ## transpose_gtmat = False
99
+ # SNP_COUNTED per0_per0 per1_per1 per2_per2
100
+ # SNP_0_D 1 0 1
101
+ # SNP_1_d 0 1 0
102
+ # SNP_2_d 0 0 0
103
+ # SNP_3_d 0 0 0
104
+ # SNP_4_D 1 2 1
105
+ ## transpose_gtmat = True
106
+ # FID_IID SNP_0_D SNP_1_D SNP_2_D
107
+ # per0_per0 0 1 1
108
+ # per1_per1 0 2 0
109
+ # per2_per2 0 0 0
110
+ # per3_per3 1 1 0
111
+ # per4_per4 0 0 0
112
+ if transpose_gtmat:
113
+ cmd = f"cut -f1,2,7- {gtmatfile}.plink.recoded.raw | sed 's/\\t/_/'"
114
+ else:
115
+ cmd = f"cut -f2,5,7- {gtmatfile}.plink.recoded.traw | sed 's/\\t/_/'"
116
+
117
+ if sample_prefix:
118
+ cmd = f"{cmd} | sed 's/per[0-9]\\+_per/{sample_prefix}/g'"
119
+
120
+ cmd = f"{cmd} > {gtmatfile}"
121
+ run_command(cmd, fg=True)
122
+
123
+
124
+ do_one_simulation(config)
@@ -42,21 +42,21 @@ diffcoex_score <- function(group) {
42
42
 
43
43
  gvals <- unique(gdata[, group, drop = TRUE])
44
44
  if (length(gvals) < 2) {
45
- log_warn(" Less than 2 groups in the input. Skipping ...")
45
+ log_debug(" Less than 2 groups in the input. Skipping ...")
46
46
  return(NULL)
47
47
  }
48
48
  rs <- lapply(gvals, function(gval) {
49
49
  samples <- rownames(gdata[gdata[[group]] == gval, , drop = FALSE])
50
50
  expr <- indata[samples, , drop = FALSE]
51
51
  if (length(samples) < 3) {
52
- log_warn(" Less than 3 samples in one of the groups. Skipping ...")
52
+ log_debug(" Less than 3 samples in one of the groups. Skipping ...")
53
53
  return(NULL)
54
54
  }
55
55
  cor.pairs(as.matrix(expr), cor.method = method)
56
56
  })
57
57
  rs[sapply(rs, is.null)] <- NULL
58
58
  if (length(rs) < 2) {
59
- log_warn(" Less than 2 groups with at least 3 samples. Skipping ...")
59
+ log_debug(" Less than 2 groups with at least 3 samples. Skipping ...")
60
60
  return(NULL)
61
61
  }
62
62
  N <- length(rs)