biopipen 0.24.1__tar.gz → 1.1.4__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.
Files changed (380) hide show
  1. biopipen-1.1.4/PKG-INFO +27 -0
  2. biopipen-1.1.4/biopipen/__init__.py +1 -0
  3. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/core/config.toml +22 -0
  4. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/core/filters.py +36 -137
  5. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/core/proc.py +5 -3
  6. biopipen-1.1.4/biopipen/core/testing.py +122 -0
  7. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/ns/bam.py +148 -6
  8. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/ns/bed.py +75 -0
  9. biopipen-1.1.4/biopipen/ns/cellranger.py +186 -0
  10. biopipen-1.1.4/biopipen/ns/cellranger_pipeline.py +126 -0
  11. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/ns/cnv.py +19 -3
  12. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/ns/cnvkit.py +1 -1
  13. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/ns/cnvkit_pipeline.py +20 -12
  14. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/ns/delim.py +34 -28
  15. biopipen-1.1.4/biopipen/ns/gene.py +99 -0
  16. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/ns/gsea.py +63 -37
  17. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/ns/misc.py +39 -14
  18. biopipen-1.1.4/biopipen/ns/plot.py +419 -0
  19. biopipen-1.1.4/biopipen/ns/protein.py +183 -0
  20. biopipen-1.1.4/biopipen/ns/regulatory.py +290 -0
  21. biopipen-1.1.4/biopipen/ns/rnaseq.py +158 -0
  22. biopipen-1.1.4/biopipen/ns/scrna.py +3444 -0
  23. biopipen-1.1.4/biopipen/ns/scrna_metabolic_landscape.py +517 -0
  24. biopipen-1.1.4/biopipen/ns/snp.py +659 -0
  25. biopipen-1.1.4/biopipen/ns/stats.py +484 -0
  26. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/ns/tcr.py +614 -88
  27. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/ns/vcf.py +236 -2
  28. biopipen-1.1.4/biopipen/ns/web.py +169 -0
  29. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/reports/bam/CNVpytor.svelte +4 -9
  30. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/reports/cellranger/CellRangerCount.svelte +5 -2
  31. biopipen-0.24.1/biopipen/reports/scrna/SeuratPreparing.svelte → biopipen-1.1.4/biopipen/reports/cellranger/CellRangerSummary.svelte +3 -2
  32. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/reports/cellranger/CellRangerVdj.svelte +5 -2
  33. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/reports/cnvkit/CNVkitDiagram.svelte +1 -1
  34. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/reports/cnvkit/CNVkitHeatmap.svelte +1 -1
  35. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/reports/cnvkit/CNVkitScatter.svelte +1 -1
  36. biopipen-1.1.4/biopipen/reports/common.svelte +15 -0
  37. biopipen-0.24.1/biopipen/reports/delim/SampleInfo.svelte → biopipen-1.1.4/biopipen/reports/protein/ProdigySummary.svelte +3 -3
  38. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/reports/scrna/DimPlots.svelte +1 -1
  39. biopipen-1.1.4/biopipen/reports/scrna/MQuad.svelte +72 -0
  40. biopipen-1.1.4/biopipen/reports/scrna/VireoSNP.svelte +47 -0
  41. biopipen-1.1.4/biopipen/reports/scrna_metabolic_landscape/MetabolicFeatures.svelte +70 -0
  42. biopipen-1.1.4/biopipen/reports/scrna_metabolic_landscape/MetabolicPathwayActivity.svelte +103 -0
  43. biopipen-1.1.4/biopipen/reports/scrna_metabolic_landscape/MetabolicPathwayHeterogeneity.svelte +81 -0
  44. biopipen-1.1.4/biopipen/reports/snp/PlinkCallRate.svelte +24 -0
  45. biopipen-1.1.4/biopipen/reports/snp/PlinkFreq.svelte +18 -0
  46. biopipen-1.1.4/biopipen/reports/snp/PlinkHWE.svelte +18 -0
  47. biopipen-1.1.4/biopipen/reports/snp/PlinkHet.svelte +18 -0
  48. biopipen-1.1.4/biopipen/reports/snp/PlinkIBD.svelte +18 -0
  49. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/reports/tcr/CDR3AAPhyschem.svelte +1 -1
  50. biopipen-1.1.4/biopipen/reports/tcr/ClonalStats.svelte +16 -0
  51. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/reports/utils/misc.liq +22 -7
  52. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/scripts/bam/BamMerge.py +11 -15
  53. biopipen-1.1.4/biopipen/scripts/bam/BamSampling.py +90 -0
  54. biopipen-1.1.4/biopipen/scripts/bam/BamSort.py +141 -0
  55. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/scripts/bam/BamSplitChroms.py +10 -10
  56. biopipen-1.1.4/biopipen/scripts/bam/BamSubsetByBed.py +38 -0
  57. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/scripts/bam/CNAClinic.R +41 -5
  58. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/scripts/bam/CNVpytor.py +153 -54
  59. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/scripts/bam/ControlFREEC.py +13 -14
  60. biopipen-1.1.4/biopipen/scripts/bam/SamtoolsView.py +33 -0
  61. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/scripts/bed/Bed2Vcf.py +5 -5
  62. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/scripts/bed/BedConsensus.py +6 -4
  63. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/scripts/bed/BedLiftOver.sh +6 -4
  64. biopipen-1.1.4/biopipen/scripts/bed/BedtoolsIntersect.py +54 -0
  65. biopipen-1.1.4/biopipen/scripts/bed/BedtoolsMakeWindows.py +47 -0
  66. biopipen-1.1.4/biopipen/scripts/bed/BedtoolsMerge.py +11 -0
  67. biopipen-1.1.4/biopipen/scripts/cellranger/CellRangerCount.py +139 -0
  68. biopipen-1.1.4/biopipen/scripts/cellranger/CellRangerSummary.R +181 -0
  69. biopipen-1.1.4/biopipen/scripts/cellranger/CellRangerVdj.py +113 -0
  70. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/scripts/cnv/AneuploidyScore.R +55 -20
  71. biopipen-1.1.4/biopipen/scripts/cnv/AneuploidyScoreSummary.R +397 -0
  72. biopipen-1.1.4/biopipen/scripts/cnv/TMADScore.R +51 -0
  73. biopipen-1.1.4/biopipen/scripts/cnv/TMADScoreSummary.R +164 -0
  74. biopipen-1.1.4/biopipen/scripts/cnvkit/CNVkitAccess.py +26 -0
  75. biopipen-1.1.4/biopipen/scripts/cnvkit/CNVkitAutobin.py +53 -0
  76. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/scripts/cnvkit/CNVkitBatch.py +6 -6
  77. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/scripts/cnvkit/CNVkitCall.py +3 -3
  78. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/scripts/cnvkit/CNVkitCoverage.py +4 -3
  79. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/scripts/cnvkit/CNVkitDiagram.py +5 -5
  80. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/scripts/cnvkit/CNVkitFix.py +3 -3
  81. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/scripts/cnvkit/CNVkitGuessBaits.py +13 -8
  82. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/scripts/cnvkit/CNVkitHeatmap.py +5 -5
  83. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/scripts/cnvkit/CNVkitReference.py +6 -5
  84. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/scripts/cnvkit/CNVkitScatter.py +5 -5
  85. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/scripts/cnvkit/CNVkitSegment.py +5 -5
  86. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/scripts/cnvkit/guess_baits.py +166 -93
  87. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/scripts/delim/RowsBinder.R +1 -1
  88. biopipen-1.1.4/biopipen/scripts/delim/SampleInfo.R +160 -0
  89. biopipen-1.1.4/biopipen/scripts/gene/GeneNameConversion.R +67 -0
  90. biopipen-1.1.4/biopipen/scripts/gene/GenePromoters.R +61 -0
  91. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/scripts/gsea/Enrichr.R +5 -5
  92. biopipen-1.1.4/biopipen/scripts/gsea/FGSEA.R +192 -0
  93. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/scripts/gsea/GSEA.R +2 -2
  94. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/scripts/gsea/PreRank.R +5 -5
  95. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/scripts/misc/Config2File.py +2 -2
  96. biopipen-1.1.4/biopipen/scripts/misc/Plot.R +80 -0
  97. biopipen-1.1.4/biopipen/scripts/misc/Shell.sh +15 -0
  98. biopipen-1.1.4/biopipen/scripts/misc/Str2File.py +6 -0
  99. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/scripts/plot/Heatmap.R +3 -3
  100. biopipen-1.1.4/biopipen/scripts/plot/Manhattan.R +147 -0
  101. biopipen-1.1.4/biopipen/scripts/plot/QQPlot.R +146 -0
  102. biopipen-1.1.4/biopipen/scripts/plot/ROC.R +88 -0
  103. biopipen-1.1.4/biopipen/scripts/plot/Scatter.R +112 -0
  104. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/scripts/plot/VennDiagram.R +5 -9
  105. biopipen-1.1.4/biopipen/scripts/protein/MMCIF2PDB.py +33 -0
  106. biopipen-1.1.4/biopipen/scripts/protein/PDB2Fasta.py +60 -0
  107. biopipen-1.1.4/biopipen/scripts/protein/Prodigy.py +119 -0
  108. biopipen-1.1.4/biopipen/scripts/protein/ProdigySummary.R +140 -0
  109. biopipen-1.1.4/biopipen/scripts/protein/RMSD.py +178 -0
  110. biopipen-1.1.4/biopipen/scripts/regulatory/MotifAffinityTest.R +102 -0
  111. biopipen-1.1.4/biopipen/scripts/regulatory/MotifAffinityTest_AtSNP.R +127 -0
  112. biopipen-1.1.4/biopipen/scripts/regulatory/MotifAffinityTest_MotifBreakR.R +104 -0
  113. biopipen-1.1.4/biopipen/scripts/regulatory/MotifScan.py +159 -0
  114. biopipen-1.1.4/biopipen/scripts/regulatory/VariantMotifPlot.R +78 -0
  115. biopipen-1.1.4/biopipen/scripts/regulatory/motifs-common.R +324 -0
  116. biopipen-1.1.4/biopipen/scripts/rnaseq/Simulation-ESCO.R +180 -0
  117. biopipen-1.1.4/biopipen/scripts/rnaseq/Simulation-RUVcorr.R +45 -0
  118. biopipen-1.1.4/biopipen/scripts/rnaseq/Simulation.R +21 -0
  119. biopipen-1.1.4/biopipen/scripts/rnaseq/UnitConversion.R +344 -0
  120. biopipen-1.1.4/biopipen/scripts/scrna/AnnData2Seurat.R +44 -0
  121. biopipen-1.1.4/biopipen/scripts/scrna/CCPlotR-patch.R +161 -0
  122. biopipen-1.1.4/biopipen/scripts/scrna/CellCellCommunication.py +150 -0
  123. biopipen-1.1.4/biopipen/scripts/scrna/CellCellCommunicationPlots.R +93 -0
  124. biopipen-1.1.4/biopipen/scripts/scrna/CellSNPLite.py +253 -0
  125. biopipen-1.1.4/biopipen/scripts/scrna/CellTypeAnnotation-celltypist.R +234 -0
  126. biopipen-1.1.4/biopipen/scripts/scrna/CellTypeAnnotation-direct.R +69 -0
  127. biopipen-1.1.4/biopipen/scripts/scrna/CellTypeAnnotation-hitype.R +59 -0
  128. biopipen-1.1.4/biopipen/scripts/scrna/CellTypeAnnotation-sccatch.R +53 -0
  129. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/scripts/scrna/CellTypeAnnotation-sctype.R +29 -33
  130. biopipen-1.1.4/biopipen/scripts/scrna/CellTypeAnnotation.R +59 -0
  131. biopipen-1.1.4/biopipen/scripts/scrna/CellsDistribution.R +557 -0
  132. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/scripts/scrna/DimPlots.R +1 -1
  133. biopipen-1.1.4/biopipen/scripts/scrna/ExprImputation-alra.R +109 -0
  134. biopipen-1.1.4/biopipen/scripts/scrna/ExprImputation-rmagic.R +256 -0
  135. biopipen-0.24.1/biopipen/scripts/scrna/ExprImpution-scimpute.R → biopipen-1.1.4/biopipen/scripts/scrna/ExprImputation-scimpute.R +8 -5
  136. biopipen-1.1.4/biopipen/scripts/scrna/ExprImputation.R +7 -0
  137. biopipen-1.1.4/biopipen/scripts/scrna/LoomTo10X.R +51 -0
  138. biopipen-1.1.4/biopipen/scripts/scrna/MQuad.py +57 -0
  139. biopipen-1.1.4/biopipen/scripts/scrna/MQuadMerge.py +106 -0
  140. biopipen-1.1.4/biopipen/scripts/scrna/MarkersFinder.R +748 -0
  141. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/scripts/scrna/MetaMarkers.R +108 -116
  142. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/scripts/scrna/ModuleScoreCalculator.R +23 -13
  143. biopipen-1.1.4/biopipen/scripts/scrna/PseudoBulkDEG.R +679 -0
  144. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/scripts/scrna/RadarPlots.R +143 -136
  145. biopipen-1.1.4/biopipen/scripts/scrna/ScFGSEA.R +346 -0
  146. biopipen-1.1.4/biopipen/scripts/scrna/ScSimulation.R +65 -0
  147. biopipen-1.1.4/biopipen/scripts/scrna/ScVelo.py +617 -0
  148. biopipen-1.1.4/biopipen/scripts/scrna/Seurat2AnnData.R +7 -0
  149. biopipen-1.1.4/biopipen/scripts/scrna/SeuratClusterStats-clustree.R +87 -0
  150. biopipen-1.1.4/biopipen/scripts/scrna/SeuratClusterStats-dimplots.R +50 -0
  151. biopipen-1.1.4/biopipen/scripts/scrna/SeuratClusterStats-features.R +188 -0
  152. biopipen-1.1.4/biopipen/scripts/scrna/SeuratClusterStats-ngenes.R +81 -0
  153. biopipen-1.1.4/biopipen/scripts/scrna/SeuratClusterStats-stats.R +97 -0
  154. biopipen-1.1.4/biopipen/scripts/scrna/SeuratClusterStats.R +58 -0
  155. biopipen-1.1.4/biopipen/scripts/scrna/SeuratClustering.R +43 -0
  156. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/scripts/scrna/SeuratLoading.R +2 -2
  157. biopipen-1.1.4/biopipen/scripts/scrna/SeuratMap2Ref.R +110 -0
  158. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/scripts/scrna/SeuratMetadataMutater.R +12 -7
  159. biopipen-1.1.4/biopipen/scripts/scrna/SeuratPreparing.R +259 -0
  160. biopipen-1.1.4/biopipen/scripts/scrna/SeuratSubClustering.R +64 -0
  161. biopipen-1.1.4/biopipen/scripts/scrna/SeuratTo10X.R +27 -0
  162. biopipen-1.1.4/biopipen/scripts/scrna/Slingshot.R +65 -0
  163. biopipen-0.24.1/biopipen/scripts/scrna/SeuratTo10X.R → biopipen-1.1.4/biopipen/scripts/scrna/Subset10X.R +2 -2
  164. biopipen-1.1.4/biopipen/scripts/scrna/TopExpressingGenes.R +209 -0
  165. biopipen-1.1.4/biopipen/scripts/scrna/VireoSNP.py +401 -0
  166. biopipen-1.1.4/biopipen/scripts/scrna/celltypist-wrapper.py +195 -0
  167. biopipen-1.1.4/biopipen/scripts/scrna/mquad_cli.py +501 -0
  168. biopipen-1.1.4/biopipen/scripts/scrna/scvelo_paga.py +313 -0
  169. biopipen-1.1.4/biopipen/scripts/scrna/seurat_anndata_conversion.py +98 -0
  170. biopipen-1.1.4/biopipen/scripts/scrna_metabolic_landscape/MetabolicFeatures.R +477 -0
  171. biopipen-1.1.4/biopipen/scripts/scrna_metabolic_landscape/MetabolicPathwayActivity.R +498 -0
  172. biopipen-1.1.4/biopipen/scripts/scrna_metabolic_landscape/MetabolicPathwayHeterogeneity.R +264 -0
  173. biopipen-1.1.4/biopipen/scripts/snp/MatrixEQTL.R +217 -0
  174. biopipen-1.1.4/biopipen/scripts/snp/Plink2GTMat.py +148 -0
  175. biopipen-1.1.4/biopipen/scripts/snp/PlinkCallRate.R +199 -0
  176. biopipen-1.1.4/biopipen/scripts/snp/PlinkFilter.py +100 -0
  177. biopipen-1.1.4/biopipen/scripts/snp/PlinkFreq.R +291 -0
  178. biopipen-1.1.4/biopipen/scripts/snp/PlinkFromVcf.py +81 -0
  179. biopipen-1.1.4/biopipen/scripts/snp/PlinkHWE.R +85 -0
  180. biopipen-1.1.4/biopipen/scripts/snp/PlinkHet.R +96 -0
  181. biopipen-1.1.4/biopipen/scripts/snp/PlinkIBD.R +196 -0
  182. biopipen-1.1.4/biopipen/scripts/snp/PlinkSimulation.py +124 -0
  183. biopipen-1.1.4/biopipen/scripts/snp/PlinkUpdateName.py +124 -0
  184. biopipen-1.1.4/biopipen/scripts/stats/ChowTest.R +146 -0
  185. biopipen-1.1.4/biopipen/scripts/stats/DiffCoexpr.R +152 -0
  186. biopipen-1.1.4/biopipen/scripts/stats/LiquidAssoc.R +135 -0
  187. biopipen-1.1.4/biopipen/scripts/stats/Mediation.R +108 -0
  188. biopipen-1.1.4/biopipen/scripts/stats/MetaPvalue.R +130 -0
  189. biopipen-1.1.4/biopipen/scripts/stats/MetaPvalue1.R +74 -0
  190. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/scripts/tcgamaf/Maf2Vcf.py +2 -2
  191. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/scripts/tcgamaf/MafAddChr.py +2 -2
  192. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/scripts/tcr/Attach2Seurat.R +1 -1
  193. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/scripts/tcr/CDR3AAPhyschem.R +110 -155
  194. biopipen-1.1.4/biopipen/scripts/tcr/CDR3Clustering.R +344 -0
  195. biopipen-1.1.4/biopipen/scripts/tcr/ClonalStats.R +526 -0
  196. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/scripts/tcr/CloneResidency.R +118 -114
  197. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/scripts/tcr/CloneSizeQQPlot.R +4 -4
  198. biopipen-1.1.4/biopipen/scripts/tcr/GIANA/GIANA.py +1817 -0
  199. biopipen-1.1.4/biopipen/scripts/tcr/GIANA/GIANA4.py +1781 -0
  200. biopipen-1.1.4/biopipen/scripts/tcr/GIANA/query.py +226 -0
  201. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/scripts/tcr/Immunarch-basic.R +9 -6
  202. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/scripts/tcr/Immunarch-clonality.R +5 -4
  203. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/scripts/tcr/Immunarch-diversity.R +30 -31
  204. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/scripts/tcr/Immunarch-geneusage.R +15 -3
  205. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/scripts/tcr/Immunarch-kmer.R +15 -4
  206. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/scripts/tcr/Immunarch-overlap.R +15 -3
  207. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/scripts/tcr/Immunarch-spectratyping.R +12 -5
  208. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/scripts/tcr/Immunarch-tracking.R +6 -2
  209. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/scripts/tcr/Immunarch-vjjunc.R +34 -3
  210. biopipen-1.1.4/biopipen/scripts/tcr/Immunarch.R +142 -0
  211. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/scripts/tcr/Immunarch2VDJtools.R +2 -2
  212. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/scripts/tcr/ImmunarchFilter.R +4 -4
  213. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/scripts/tcr/ImmunarchLoading.R +7 -7
  214. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/scripts/tcr/SampleDiversity.R +1 -1
  215. biopipen-1.1.4/biopipen/scripts/tcr/ScRepCombiningExpression.R +40 -0
  216. biopipen-1.1.4/biopipen/scripts/tcr/ScRepLoading.R +166 -0
  217. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/scripts/tcr/TCRClusterStats.R +60 -19
  218. biopipen-1.1.4/biopipen/scripts/tcr/TCRDock.py +110 -0
  219. biopipen-1.1.4/biopipen/scripts/tcr/TESSA.R +187 -0
  220. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/scripts/tcr/TESSA_source/BriseisEncoder.py +52 -3
  221. biopipen-1.1.4/biopipen/scripts/tcr/TESSA_source/KERAS_MIGRATION.md +106 -0
  222. biopipen-1.1.4/biopipen/scripts/tcr/TESSA_source/migrate_keras_model.py +124 -0
  223. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/scripts/tcr/VJUsage.R +5 -5
  224. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/scripts/tcr/vdjtools-patch.sh +1 -1
  225. biopipen-1.1.4/biopipen/scripts/vcf/BcftoolsAnnotate.py +91 -0
  226. biopipen-1.1.4/biopipen/scripts/vcf/BcftoolsFilter.py +90 -0
  227. biopipen-1.1.4/biopipen/scripts/vcf/BcftoolsMerge.py +32 -0
  228. biopipen-1.1.4/biopipen/scripts/vcf/BcftoolsSort.py +113 -0
  229. biopipen-1.1.4/biopipen/scripts/vcf/BcftoolsView.py +73 -0
  230. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/scripts/vcf/TruvariBench.sh +14 -7
  231. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/scripts/vcf/TruvariBenchSummary.R +16 -13
  232. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/scripts/vcf/TruvariConsistency.R +1 -1
  233. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/scripts/vcf/Vcf2Bed.py +2 -2
  234. biopipen-1.1.4/biopipen/scripts/vcf/VcfAnno.py +26 -0
  235. biopipen-1.1.4/biopipen/scripts/vcf/VcfDownSample.sh +37 -0
  236. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/scripts/vcf/VcfFilter.py +5 -5
  237. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/scripts/vcf/VcfFix.py +7 -7
  238. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/scripts/vcf/VcfFix_utils.py +13 -4
  239. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/scripts/vcf/VcfIndex.py +3 -3
  240. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/scripts/vcf/VcfIntersect.py +3 -3
  241. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/scripts/vcf/VcfLiftOver.sh +5 -0
  242. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/scripts/vcf/VcfSplitSamples.py +4 -4
  243. biopipen-1.1.4/biopipen/scripts/vcf/bcftools_utils.py +52 -0
  244. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/scripts/web/Download.py +8 -4
  245. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/scripts/web/DownloadList.py +5 -5
  246. biopipen-1.1.4/biopipen/scripts/web/GCloudStorageDownloadBucket.py +82 -0
  247. biopipen-1.1.4/biopipen/scripts/web/GCloudStorageDownloadFile.py +23 -0
  248. biopipen-1.1.4/biopipen/scripts/web/gcloud_common.py +49 -0
  249. biopipen-1.1.4/biopipen/utils/gene.py +134 -0
  250. biopipen-1.1.4/biopipen/utils/misc.py +254 -0
  251. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/utils/reference.py +64 -20
  252. biopipen-1.1.4/biopipen/utils/reporter.py +177 -0
  253. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/utils/vcf.py +1 -1
  254. {biopipen-0.24.1 → biopipen-1.1.4}/pyproject.toml +24 -14
  255. {biopipen-0.24.1 → biopipen-1.1.4}/setup.py +27 -16
  256. biopipen-0.24.1/PKG-INFO +0 -23
  257. biopipen-0.24.1/biopipen/__init__.py +0 -1
  258. biopipen-0.24.1/biopipen/core/testing.py +0 -50
  259. biopipen-0.24.1/biopipen/ns/bcftools.py +0 -111
  260. biopipen-0.24.1/biopipen/ns/cellranger.py +0 -101
  261. biopipen-0.24.1/biopipen/ns/gene.py +0 -54
  262. biopipen-0.24.1/biopipen/ns/plot.py +0 -116
  263. biopipen-0.24.1/biopipen/ns/rnaseq.py +0 -21
  264. biopipen-0.24.1/biopipen/ns/scrna.py +0 -1998
  265. biopipen-0.24.1/biopipen/ns/scrna_metabolic_landscape.py +0 -670
  266. biopipen-0.24.1/biopipen/ns/web.py +0 -78
  267. biopipen-0.24.1/biopipen/reports/scrna/ScFGSEA.svelte +0 -16
  268. biopipen-0.24.1/biopipen/reports/scrna/SeuratClusterStats.svelte +0 -16
  269. biopipen-0.24.1/biopipen/reports/scrna/SeuratMap2Ref.svelte +0 -20
  270. biopipen-0.24.1/biopipen/reports/scrna/TopExpressingGenes.svelte +0 -17
  271. biopipen-0.24.1/biopipen/reports/scrna_metabolic_landscape/MetabolicFeatures.svelte +0 -32
  272. biopipen-0.24.1/biopipen/reports/scrna_metabolic_landscape/MetabolicFeaturesIntraSubset.svelte +0 -28
  273. biopipen-0.24.1/biopipen/reports/scrna_metabolic_landscape/MetabolicPathwayActivity.svelte +0 -89
  274. biopipen-0.24.1/biopipen/reports/scrna_metabolic_landscape/MetabolicPathwayHeterogeneity.svelte +0 -15
  275. biopipen-0.24.1/biopipen/reports/utils/gsea.liq +0 -110
  276. biopipen-0.24.1/biopipen/scripts/bcftools/BcftoolsAnnotate.py +0 -42
  277. biopipen-0.24.1/biopipen/scripts/bcftools/BcftoolsFilter.py +0 -79
  278. biopipen-0.24.1/biopipen/scripts/bcftools/BcftoolsSort.py +0 -19
  279. biopipen-0.24.1/biopipen/scripts/bed/BedtoolsMerge.py +0 -11
  280. biopipen-0.24.1/biopipen/scripts/cellranger/CellRangerCount.py +0 -79
  281. biopipen-0.24.1/biopipen/scripts/cellranger/CellRangerVdj.py +0 -79
  282. biopipen-0.24.1/biopipen/scripts/cnv/AneuploidyScoreSummary.R +0 -339
  283. biopipen-0.24.1/biopipen/scripts/cnv/TMADScore.R +0 -35
  284. biopipen-0.24.1/biopipen/scripts/cnv/TMADScoreSummary.R +0 -193
  285. biopipen-0.24.1/biopipen/scripts/cnvkit/CNVkitAccess.py +0 -24
  286. biopipen-0.24.1/biopipen/scripts/cnvkit/CNVkitAutobin.py +0 -44
  287. biopipen-0.24.1/biopipen/scripts/delim/SampleInfo.R +0 -196
  288. biopipen-0.24.1/biopipen/scripts/gene/GeneNameConversion.py +0 -66
  289. biopipen-0.24.1/biopipen/scripts/gsea/FGSEA.R +0 -58
  290. biopipen-0.24.1/biopipen/scripts/misc/Str2File.py +0 -6
  291. biopipen-0.24.1/biopipen/scripts/rnaseq/UnitConversion.R +0 -73
  292. biopipen-0.24.1/biopipen/scripts/scrna/CellTypeAnnotation-direct.R +0 -59
  293. biopipen-0.24.1/biopipen/scripts/scrna/CellTypeAnnotation-hitype.R +0 -69
  294. biopipen-0.24.1/biopipen/scripts/scrna/CellTypeAnnotation-sccatch.R +0 -58
  295. biopipen-0.24.1/biopipen/scripts/scrna/CellTypeAnnotation.R +0 -13
  296. biopipen-0.24.1/biopipen/scripts/scrna/CellsDistribution.R +0 -478
  297. biopipen-0.24.1/biopipen/scripts/scrna/ExprImpution-alra.R +0 -33
  298. biopipen-0.24.1/biopipen/scripts/scrna/ExprImpution-rmagic.R +0 -30
  299. biopipen-0.24.1/biopipen/scripts/scrna/ExprImpution.R +0 -7
  300. biopipen-0.24.1/biopipen/scripts/scrna/MarkersFinder.R +0 -828
  301. biopipen-0.24.1/biopipen/scripts/scrna/ScFGSEA.R +0 -228
  302. biopipen-0.24.1/biopipen/scripts/scrna/SeuratClusterStats-dimplots.R +0 -70
  303. biopipen-0.24.1/biopipen/scripts/scrna/SeuratClusterStats-features.R +0 -444
  304. biopipen-0.24.1/biopipen/scripts/scrna/SeuratClusterStats-hists.R +0 -138
  305. biopipen-0.24.1/biopipen/scripts/scrna/SeuratClusterStats-ngenes.R +0 -69
  306. biopipen-0.24.1/biopipen/scripts/scrna/SeuratClusterStats-stats.R +0 -177
  307. biopipen-0.24.1/biopipen/scripts/scrna/SeuratClusterStats.R +0 -45
  308. biopipen-0.24.1/biopipen/scripts/scrna/SeuratClustering.R +0 -174
  309. biopipen-0.24.1/biopipen/scripts/scrna/SeuratMap2Ref.R +0 -155
  310. biopipen-0.24.1/biopipen/scripts/scrna/SeuratPreparing.R +0 -386
  311. biopipen-0.24.1/biopipen/scripts/scrna/SeuratSubClustering.R +0 -169
  312. biopipen-0.24.1/biopipen/scripts/scrna/TopExpressingGenes.R +0 -268
  313. biopipen-0.24.1/biopipen/scripts/scrna/Write10X.R +0 -11
  314. biopipen-0.24.1/biopipen/scripts/scrna_metabolic_landscape/MetabolicFeatures.R +0 -152
  315. biopipen-0.24.1/biopipen/scripts/scrna_metabolic_landscape/MetabolicFeaturesIntraSubset.R +0 -186
  316. biopipen-0.24.1/biopipen/scripts/scrna_metabolic_landscape/MetabolicPathwayActivity.R +0 -397
  317. biopipen-0.24.1/biopipen/scripts/scrna_metabolic_landscape/MetabolicPathwayHeterogeneity.R +0 -255
  318. biopipen-0.24.1/biopipen/scripts/tcr/GIANA/GIANA.py +0 -1258
  319. biopipen-0.24.1/biopipen/scripts/tcr/GIANA/GIANA4.py +0 -1208
  320. biopipen-0.24.1/biopipen/scripts/tcr/GIANA/query.py +0 -224
  321. biopipen-0.24.1/biopipen/scripts/tcr/Immunarch.R +0 -110
  322. biopipen-0.24.1/biopipen/scripts/tcr/TCRClustering.R +0 -283
  323. biopipen-0.24.1/biopipen/scripts/tcr/TESSA.R +0 -230
  324. biopipen-0.24.1/biopipen/scripts/vcf/VcfAnno.py +0 -26
  325. biopipen-0.24.1/biopipen/scripts/vcf/VcfDownSample.sh +0 -25
  326. biopipen-0.24.1/biopipen/utils/caching.R +0 -44
  327. biopipen-0.24.1/biopipen/utils/common_docstrs.py +0 -94
  328. biopipen-0.24.1/biopipen/utils/gene.R +0 -49
  329. biopipen-0.24.1/biopipen/utils/gene.py +0 -86
  330. biopipen-0.24.1/biopipen/utils/gsea.R +0 -239
  331. biopipen-0.24.1/biopipen/utils/io.R +0 -20
  332. biopipen-0.24.1/biopipen/utils/misc.R +0 -209
  333. biopipen-0.24.1/biopipen/utils/misc.py +0 -103
  334. biopipen-0.24.1/biopipen/utils/mutate_helpers.R +0 -581
  335. biopipen-0.24.1/biopipen/utils/plot.R +0 -173
  336. biopipen-0.24.1/biopipen/utils/rnaseq.R +0 -48
  337. biopipen-0.24.1/biopipen/utils/single_cell.R +0 -115
  338. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/core/__init__.py +0 -0
  339. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/core/config.py +0 -0
  340. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/core/defaults.py +0 -0
  341. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/ns/__init__.py +0 -0
  342. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/ns/tcgamaf.py +0 -0
  343. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/reports/bam/CNAClinic.svelte +0 -0
  344. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/reports/bam/ControlFREEC.svelte +0 -0
  345. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/reports/cnv/AneuploidyScore.svelte +0 -0
  346. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/reports/cnv/AneuploidyScoreSummary.svelte +0 -0
  347. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/reports/cnv/TMADScoreSummary.svelte +0 -0
  348. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/reports/gsea/FGSEA.svelte +0 -0
  349. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/reports/gsea/GSEA.svelte +0 -0
  350. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/reports/scrna/CellsDistribution.svelte +0 -0
  351. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/reports/scrna/MarkersFinder.svelte +0 -0
  352. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/reports/scrna/MetaMarkers.svelte +0 -0
  353. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/reports/scrna/RadarPlots.svelte +0 -0
  354. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/reports/tcr/CloneResidency.svelte +0 -0
  355. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/reports/tcr/Immunarch.svelte +0 -0
  356. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/reports/tcr/SampleDiversity.svelte +0 -0
  357. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/reports/tcr/TCRClusterStats.svelte +0 -0
  358. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/reports/tcr/TESSA.svelte +0 -0
  359. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/reports/tcr/VJUsage.svelte +0 -0
  360. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/reports/vcf/TruvariBenchSummary.svelte +0 -0
  361. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/reports/vcf/TruvariConsistency.svelte +0 -0
  362. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/scripts/scrna/SCImpute.R +0 -0
  363. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/scripts/scrna/SeuratFilter.R +0 -0
  364. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/scripts/scrna/SeuratSplit.R +0 -0
  365. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/scripts/scrna/SeuratSubset.R +0 -0
  366. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/scripts/scrna/sctype.R +0 -0
  367. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/scripts/tcgamaf/maf2vcf.pl +0 -0
  368. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/scripts/tcr/GIANA/Imgt_Human_TRBV.fasta +0 -0
  369. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/scripts/tcr/ImmunarchSplitIdents.R +0 -0
  370. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/scripts/tcr/TESSA_source/Atchley_factors.csv +0 -0
  371. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/scripts/tcr/TESSA_source/MCMC_control.R +0 -0
  372. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/scripts/tcr/TESSA_source/TrainedEncoder.h5 +0 -0
  373. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/scripts/tcr/TESSA_source/fixed_b.csv +0 -0
  374. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/scripts/tcr/TESSA_source/initialization.R +0 -0
  375. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/scripts/tcr/TESSA_source/post_analysis.R +0 -0
  376. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/scripts/tcr/TESSA_source/real_data.R +0 -0
  377. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/scripts/tcr/TESSA_source/update.R +0 -0
  378. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/scripts/tcr/TESSA_source/utility.R +0 -0
  379. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/scripts/tcr/immunarch-patched.R +0 -0
  380. {biopipen-0.24.1 → biopipen-1.1.4}/biopipen/utils/__init__.py +0 -0
@@ -0,0 +1,27 @@
1
+ Metadata-Version: 2.4
2
+ Name: biopipen
3
+ Version: 1.1.4
4
+ Summary: Bioinformatics processes/pipelines that can be run from `pipen run`
5
+ License: MIT
6
+ Author: pwwang
7
+ Author-email: pwwang@pwwang.com
8
+ Requires-Python: >=3.9,<4.0
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Programming Language :: Python :: 3.9
12
+ Classifier: Programming Language :: Python :: 3.10
13
+ Classifier: Programming Language :: Python :: 3.11
14
+ Classifier: Programming Language :: Python :: 3.12
15
+ Classifier: Programming Language :: Python :: 3.13
16
+ Classifier: Programming Language :: Python :: 3.14
17
+ Provides-Extra: log2file
18
+ Provides-Extra: runinfo
19
+ Requires-Dist: datar[pandas] (>=0.15.8,<0.16.0)
20
+ Requires-Dist: pipen-board[report] (>=1.1,<2.0)
21
+ Requires-Dist: pipen-cli-run (>=1.0,<2.0)
22
+ Requires-Dist: pipen-deprecated (>=1.0,<2.0)
23
+ Requires-Dist: pipen-filters (>=1.1.2,<2.0.0)
24
+ Requires-Dist: pipen-log2file (>=1.1,<2.0) ; extra == "log2file"
25
+ Requires-Dist: pipen-poplog (>=1.1,<2.0)
26
+ Requires-Dist: pipen-runinfo (>=1.1,<2.0) ; extra == "runinfo"
27
+ Requires-Dist: pipen-verbose (>=1.1,<2.0)
@@ -0,0 +1 @@
1
+ __version__ = "1.1.4"
@@ -1,11 +1,17 @@
1
1
  # Executables or binaries
2
2
  [exe]
3
+ # BeEM: https://github.com/kad-ecoli/BeEM
4
+ beem = "BeEM"
3
5
  # bedtools to handle bed files
4
6
  bedtools = "bedtools"
5
7
  # bcftools to handle bcf/vcf files
6
8
  bcftools = "bcftools"
9
+ # calculate_rmsd: https://github.com/charnley/rmsd
10
+ calculate_rmsd = "calculate_rmsd"
7
11
  # cellranger
8
12
  cellranger = "cellranger"
13
+ # cellsnp-lite
14
+ cellsnp_lite = "cellsnp-lite"
9
15
  # Control-FREEC to call cnvs
10
16
  freec = "freec"
11
17
  # liftover coordinates across genomes
@@ -13,6 +19,8 @@ liftover = "liftOver"
13
19
  # gatk, installed via conda
14
20
  gatk = "gatk"
15
21
  gatk4 = "gatk"
22
+ # google cloud sdk
23
+ gcloud = "gcloud"
16
24
  # vdjtools, installed via conda
17
25
  vdjtools = "vdjtools"
18
26
  # cnvkit.py
@@ -23,10 +31,20 @@ cnvpytor = "cnvpytor"
23
31
  cnvnator2vcf = "cnvnator2VCF.pl"
24
32
  # convert
25
33
  convert = "convert"
34
+ # fimo from meme
35
+ fimo = "fimo"
36
+ # MAXIT: https://sw-tools.rcsb.org/apps/MAXIT/
37
+ maxit = "maxit"
38
+ # MQuad: https://github.com/single-cell-genetics/MQuad
39
+ mquad = "mquad"
26
40
  # wget
27
41
  wget = "wget"
28
42
  # aria2c
29
43
  aria2c = "aria2c"
44
+ # plink
45
+ plink = "plink"
46
+ # plink2
47
+ plink2 = "plink2"
30
48
  # tabix
31
49
  tabix = "tabix"
32
50
  # sambamba
@@ -84,6 +102,10 @@ genome = ""
84
102
  # Database file for scType
85
103
  # https://github.com/IanevskiAleksandr/sc-type/
86
104
  sctype_db = ""
105
+ # TF Motif database
106
+ tf_motifdb = ""
107
+ # TF motif pairs
108
+ tf_motifs = ""
87
109
 
88
110
  [misc]
89
111
  # Number of cores used for each job
@@ -1,13 +1,16 @@
1
1
  """Additional filters for pipen"""
2
2
  from __future__ import annotations
3
3
 
4
+ import re
4
5
  import shlex
5
6
  from pathlib import Path
6
7
  from typing import Any, List, Mapping
7
8
 
8
- from argx import Namespace
9
+ from argx import Namespace # pyright: ignore[reportPrivateImportUsage]
9
10
  from liquid.filters.manager import FilterManager
10
- from pipen_report.filters import register_component, render_ui, _tag
11
+ from pipen_report.filters import register_component, _tag
12
+
13
+ # from .defaults import BIOPIPEN_DIR
11
14
 
12
15
  filtermanager = FilterManager()
13
16
 
@@ -15,7 +18,7 @@ filtermanager = FilterManager()
15
18
  @filtermanager.register
16
19
  def dict_to_cli_args(
17
20
  dic: Mapping[str, Any],
18
- exclude: List[str] = None,
21
+ exclude: List[str] | None = None,
19
22
  prefix: str | None = None,
20
23
  sep: str | None = " ",
21
24
  dup_key: bool = True,
@@ -28,7 +31,7 @@ def dict_to_cli_args(
28
31
 
29
32
  Args:
30
33
  dic: The dict to convert
31
- exclude: The keys to exclude
34
+ exclude: The keys to exclude before conversion (e.g. dashify)
32
35
  prefix: The prefix of the keys after conversion
33
36
  Defaults to `None`, mean `-` for short keys and `--` for long keys
34
37
  sep: The separator between key and value
@@ -118,7 +121,7 @@ def dict_to_cli_args(
118
121
  def r(
119
122
  obj: Any,
120
123
  ignoreintkey: bool = True,
121
- todot: str = None,
124
+ todot: str | None = None,
122
125
  sortkeys: bool = False,
123
126
  skip: int = 0,
124
127
  _i: int = 0,
@@ -169,8 +172,10 @@ def r(
169
172
  return "TRUE"
170
173
  if obj.upper() == "FALSE":
171
174
  return "FALSE"
172
- if obj.upper() == "NA" or obj.upper() == "NULL":
175
+ if obj.upper() == "NA" or obj.upper() == "NULL" or obj == "None":
173
176
  return obj.upper()
177
+ if re.match(r"^\d+:\d+$", obj):
178
+ return obj
174
179
  if obj.startswith("r:") or obj.startswith("R:"):
175
180
  return str(obj)[2:]
176
181
  return repr(str(obj))
@@ -221,68 +226,31 @@ def r(
221
226
  return repr(obj)
222
227
 
223
228
 
224
- @register_component("fgsea")
225
- def _render_fgsea(
226
- cont: Mapping[str, Any],
227
- job: Mapping[str, Any],
228
- level: int,
229
- na_arg: str = "10",
230
- ) -> str:
231
- """Render fgsea report"""
232
- # cont["dir"] is required
233
- n_pathways = int(na_arg)
234
- pathways = []
235
- with Path(cont["dir"]).joinpath("fgsea.txt").open() as f:
236
- next(f) # skip header
237
- for line in f:
238
- pathway, _ = line.split("\t", 1)
239
- pathways.append(pathway)
240
- if len(pathways) >= n_pathways:
241
- break
242
-
243
- components = [
244
- # Summary
245
- {
246
- "title": "Enrichment Analysis Summary",
247
- "ui": "tabs",
248
- "contents": [
249
- {
250
- "title": "Plot",
251
- "ui": "flat",
252
- "contents": [
253
- {
254
- "kind": "image",
255
- "src": str(Path(cont["dir"]).joinpath("gsea_table.png")),
256
- }
257
- ],
258
- },
259
- {
260
- "title": "Table",
261
- "ui": "flat",
262
- "contents": [
263
- {
264
- "kind": "table",
265
- "src": str(Path(cont["dir"]).joinpath("fgsea.txt")),
266
- }
267
- ],
268
- },
269
- ]
270
- },
271
- # Pathways
272
- {
273
- "title": f"Enriched Pathways (Top {n_pathways})",
274
- "ui": "table_of_images",
275
- "contents": [
276
- {
277
- "src": str(Path(cont["dir"]) / f"fgsea_{pw.replace('/', '-')}.png"),
278
- "title": pw,
279
- }
280
- for pw in pathways
281
- ]
282
- },
283
- ]
284
-
285
- return render_ui(components, "accordion", job, level)
229
+ @filtermanager.register
230
+ def source_r(path: str | Path, chdir: bool = False) -> str:
231
+ """Source an R script.
232
+
233
+ In addition to generating `source(path)`, we also include the mtime for the script
234
+ to trigger the job not cached when the script is updated.
235
+
236
+ If your process is used in a cloud environment, it is recommended to
237
+ use the `read` filter to load the script content instead of sourcing it using
238
+ the `source` function in R to void the path issue (path could be different
239
+ in different environments).
240
+
241
+ Args:
242
+ path: The path to the R script
243
+
244
+ Returns:
245
+ The R code to source the script
246
+ """
247
+ path = Path(path)
248
+ mtime = int(path.stat().st_mtime)
249
+ return (
250
+ f"# Last modified: {mtime}\n"
251
+ # f"biopipen_dir = {r(BIOPIPEN_DIR)}\n"
252
+ f"source('{path}', chdir = {r(chdir)})"
253
+ )
286
254
 
287
255
 
288
256
  @register_component("pdf")
@@ -312,72 +280,3 @@ def _render_gsea(
312
280
  """Render gsea report"""
313
281
  # cont["dir"] is required
314
282
  raise NotImplementedError()
315
-
316
-
317
- @register_component("enrichr")
318
- def _render_enrichr(
319
- cont: Mapping[str, Any],
320
- job: Mapping[str, Any],
321
- level: int,
322
- ) -> str:
323
- """Render enrichr report"""
324
- # cont["dir"] is required
325
- dbs = [sumfile.stem[8:] for sumfile in Path(cont["dir"]).glob("Enrichr-*.txt")]
326
- components = []
327
-
328
- for db in dbs:
329
- enrichr_plot = Path(cont["dir"]).joinpath(f"Enrichr-{db}.png")
330
- if enrichr_plot.exists():
331
- components.append(
332
- {
333
- "title": db,
334
- "ui": "tabs",
335
- "contents": [
336
- {
337
- "title": "Plot",
338
- "ui": "flat",
339
- "contents": [
340
- {
341
- "kind": "image",
342
- "src": str(
343
- Path(cont["dir"]).joinpath(f"Enrichr-{db}.png")
344
- ),
345
- }
346
- ],
347
- },
348
- {
349
- "title": "Table",
350
- "ui": "flat",
351
- "contents": [
352
- {
353
- "kind": "table",
354
- "src": str(
355
- Path(cont["dir"]).joinpath(f"Enrichr-{db}.txt")
356
- ),
357
- }
358
- ],
359
- },
360
- ],
361
- }
362
- )
363
- else:
364
- components.append(
365
- {
366
- "title": db,
367
- "ui": "tabs",
368
- "contents": [
369
- {
370
- "title": "Error",
371
- "ui": "flat",
372
- "contents": [
373
- {
374
- "kind": "error",
375
- "content": "No enriched terms found.",
376
- }
377
- ],
378
- },
379
- ],
380
- }
381
- )
382
-
383
- return render_ui(components, "accordion", job, level)
@@ -1,7 +1,9 @@
1
1
  """Provides a base class for the processes to subclass"""
2
- from diot import Diot
2
+ from __future__ import annotations
3
+
4
+ from diot import Diot # type: ignore
3
5
  from liquid.defaults import SEARCH_PATHS
4
- from pipen import Proc as PipenProc
6
+ from pipen import Proc as PipenProc # type: ignore
5
7
  from pipen_filters.filters import FILTERS
6
8
 
7
9
  from .filters import filtermanager
@@ -23,7 +25,7 @@ class Proc(PipenProc):
23
25
  template_opts = {
24
26
  "globals": {**FILTERS, "biopipen_dir": str(BIOPIPEN_DIR)},
25
27
  "filters": {**FILTERS, **filtermanager.filters},
26
- "search_paths": SEARCH_PATHS + [str(REPORT_DIR)],
28
+ "search_paths": SEARCH_PATHS + [str(REPORT_DIR)], # type: ignore
27
29
  }
28
30
 
29
31
  plugin_opts = {
@@ -0,0 +1,122 @@
1
+ """Provide utilities for testing."""
2
+ import tempfile
3
+ from functools import wraps
4
+ from pathlib import Path
5
+
6
+ from pipen import Pipen
7
+
8
+ TESTING_INDEX_INIT = 1
9
+ TESTING_PARENT_DIR = Path(__file__).parent.parent.parent.joinpath("tests", "running")
10
+ TESTING_PARENT_DIR.mkdir(parents=True, exist_ok=True)
11
+ TESTING_DIR = str(TESTING_PARENT_DIR.joinpath("biopipen-tests-%(index)s"))
12
+ RSCRIPT_DIR = TESTING_PARENT_DIR.joinpath("biopipen-tests-rscripts")
13
+ RSCRIPT_DIR.mkdir(exist_ok=True)
14
+
15
+
16
+ def _find_testing_index(new):
17
+ """Find the next available testing index"""
18
+ index = TESTING_INDEX_INIT
19
+ while True:
20
+ dir = TESTING_DIR % {"index": index}
21
+ if not Path(dir).exists():
22
+ if new:
23
+ break
24
+ else:
25
+ return max(index - 1, TESTING_INDEX_INIT)
26
+ index += 1
27
+ return index
28
+
29
+
30
+ def _get_test_dirs(testfile, new):
31
+ """Get the workdir and outdir for a test pipeline"""
32
+ index = _find_testing_index(new)
33
+ workdir = TESTING_DIR % {"index": index}
34
+ procname = Path(testfile).parent.stem
35
+ nsname = Path(testfile).parent.parent.stem
36
+ name = f"{nsname}.{procname}"
37
+ outdir = f"{workdir}/{nsname}/output"
38
+ workdir = f"{workdir}/{procname}/pipen"
39
+ Path(workdir).mkdir(parents=True, exist_ok=True)
40
+ Path(outdir).mkdir(parents=True, exist_ok=True)
41
+ return name, workdir, outdir
42
+
43
+
44
+ def get_pipeline(testfile, loglevel="debug", enable_report=False, **kwargs):
45
+ """Get a pipeline for a test file"""
46
+ name, workdir, outdir = _get_test_dirs(testfile, False)
47
+ report_plugin_prefix = "+" if enable_report else "-"
48
+ plugins = kwargs.pop("plugins", [])
49
+ if any("report" in p for p in plugins if isinstance(p, str)):
50
+ raise ValueError(
51
+ "Do not pass `report` plugin to `get_pipeline(plugins=[...])`, "
52
+ "use `enable_report` instead."
53
+ )
54
+ plugins.append(f"{report_plugin_prefix}report")
55
+ kws = {
56
+ "name": name,
57
+ "workdir": workdir,
58
+ "outdir": outdir,
59
+ "loglevel": loglevel,
60
+ "plugins": plugins,
61
+ }
62
+ kws.update(kwargs)
63
+ return Pipen(**kws)
64
+
65
+
66
+ def _run_rcode(rcode: str) -> str:
67
+ """Run R code and return the output"""
68
+ import hashlib
69
+ import textwrap
70
+ import subprocess as sp
71
+
72
+ # Use sha256 of rcode to name the file
73
+ rcode_hash = hashlib.sha256(rcode.encode()).hexdigest()
74
+ script_file = RSCRIPT_DIR.joinpath(f"rcode-{rcode_hash}.R")
75
+ script_file.write_text(rcode)
76
+ p = sp.Popen(["Rscript", str(script_file)], stdout=sp.PIPE, stderr=sp.PIPE)
77
+ out, err = p.communicate()
78
+ if p.returncode != 0:
79
+ out = (
80
+ f"R codefile:\n {script_file}\n"
81
+ f"Error:\n{textwrap.indent(err.decode(), ' ')}"
82
+ )
83
+ return out
84
+
85
+ return out.decode().strip()
86
+
87
+
88
+ def r_test(mem: callable) -> callable:
89
+ """A decorator to test R code"""
90
+ @wraps(mem)
91
+ def decorator(self, *args, **kwargs):
92
+ rcode = mem(self, *args, **kwargs)
93
+ source = getattr(self, "SOURCE_FILE", None)
94
+ expect = (
95
+ "expect <- function(expr, ...) {\n"
96
+ " if (!expr) {\n"
97
+ " msg <- lapply(\n"
98
+ " list(...),\n"
99
+ " function(x) { ifelse(is.null(x), 'NULL', x) }\n"
100
+ " )\n"
101
+ " stop(paste0(unlist(msg), collapse = ' '))\n"
102
+ " }\n"
103
+ "}\n"
104
+ )
105
+ rcode = f"{expect}\n\n{rcode}\n\ncat('PASSED')\n"
106
+ if source is not None:
107
+ if not isinstance(source, (list, tuple)):
108
+ source = [source]
109
+
110
+ libs = "\n".join([f"suppressWarnings(source('{s}'))" for s in source])
111
+ rcode = f'{libs}\n\n{rcode}'
112
+
113
+ out = _run_rcode(rcode)
114
+ self.assertEqual(
115
+ out,
116
+ "PASSED",
117
+ "\n-----------------------------\n"
118
+ f"{out}"
119
+ "\n-----------------------------\n"
120
+ )
121
+
122
+ return decorator
@@ -4,6 +4,9 @@ from ..core.proc import Proc
4
4
  from ..core.config import config
5
5
 
6
6
 
7
+ # +-------------------------------------------------------------------+
8
+ # | CNV callers |
9
+ # +-------------------------------------------------------------------+
7
10
  class CNVpytor(Proc):
8
11
  """Detect CNV using CNVpytor
9
12
 
@@ -17,7 +20,6 @@ class CNVpytor(Proc):
17
20
 
18
21
  Envs:
19
22
  cnvpytor: Path to cnvpytor
20
- cnvnator2vcf: Path to CNVnator2VCF.pl to convert the result to VCF file
21
23
  samtools: Path to samtools, used to index bam file in case it's not
22
24
  ncores: Number of cores to use (`-j` for cnvpytor)
23
25
  refdir: The directory containing the fasta file for each chromosome
@@ -27,21 +29,19 @@ class CNVpytor(Proc):
27
29
  binsizes: The binsizes
28
30
  snp: How to read snp data
29
31
  filters: The filters to filter the result
30
- See - https://github.com/abyzovlab/CNVpytor/blob/master
31
- /GettingStarted.md#predicting-cnv-regions
32
+ See - https://github.com/abyzovlab/CNVpytor/blob/master/GettingStarted.md#predicting-cnv-regions
32
33
  mask_snps: Whether mask 1000 Genome snps
33
34
  baf_nomask: Do not use P mask in BAF histograms
34
35
 
35
36
  Requires:
36
37
  cnvpytor:
37
38
  - check: {{proc.envs.cnvpytor}} --version
38
- """
39
+ """ # noqa: E501
39
40
  input = "bamfile:file, snpfile:file"
40
41
  output = "outdir:dir:{{in.bamfile | stem}}.cnvpytor"
41
42
  lang = config.lang.python
42
43
  envs = {
43
44
  "cnvpytor": config.exe.cnvpytor,
44
- "cnvnator2vcf": config.exe.cnvnator2vcf,
45
45
  "samtools": config.exe.samtools,
46
46
  "ncores": config.misc.ncores,
47
47
  "refdir": config.ref.refdir,
@@ -152,7 +152,7 @@ class CNAClinic(Proc):
152
152
  A list of sample names
153
153
  A float number (0 < x <= 1), the fraction of samples to use
154
154
  A integer number (x > 1), the number of samples to use
155
- binsize: Directly use this binsize for CNAClinic, in kbp.
155
+ binsize: Directly use this binsize for CNAClinic, in bp.
156
156
  genome: The genome assembly
157
157
  run_args: The arguments for CNAClinic::runSegmentation
158
158
  plot_args: The arguments for CNAClinic::plotSampleData
@@ -183,6 +183,9 @@ class CNAClinic(Proc):
183
183
  }
184
184
 
185
185
 
186
+ # +-------------------------------------------------------------------+
187
+ # | Bam processing tools |
188
+ # +-------------------------------------------------------------------+
186
189
  class BamSplitChroms(Proc):
187
190
  """Split bam file by chromosomes
188
191
 
@@ -262,3 +265,142 @@ class BamMerge(Proc):
262
265
  "sort_args": [],
263
266
  }
264
267
  script = "file://../scripts/bam/BamMerge.py"
268
+
269
+
270
+ class BamSampling(Proc):
271
+ """Keeping only a fraction of read pairs from a bam file
272
+
273
+ Input:
274
+ bamfile: The bam file
275
+
276
+ Output:
277
+ outfile: The output bam file
278
+
279
+ Envs:
280
+ ncores: Number of cores to use
281
+ samtools: Path to samtools executable
282
+ tool: The tool to use, currently only "samtools" is supported
283
+ fraction (type=float): The fraction of reads to keep.
284
+ If `0 < fraction <= 1`, it's the fraction of reads to keep.
285
+ If `fraction > 1`, it's the number of reads to keep.
286
+ Note that when fraction > 1, you may not get the exact number
287
+ of reads specified but a close number.
288
+ seed: The seed for random number generator
289
+ index: Whether to index the output bam file
290
+ sort: Whether to sort the output bam file
291
+ sort_args: The arguments for sorting bam file using `samtools sort`.
292
+ These keys are not allowed: `-o`, `-@`,
293
+ and `--threads`, as they are managed by the script.
294
+ """
295
+ input = "bamfile:file"
296
+ output = "outfile:file:{{in.bamfile | stem}}.sampled{{envs.fraction}}.bam"
297
+ lang = config.lang.python
298
+ envs = {
299
+ "ncores": config.misc.ncores,
300
+ "samtools": config.exe.samtools,
301
+ "tool": "samtools",
302
+ "fraction": None,
303
+ "seed": 8525,
304
+ "index": True,
305
+ "sort": True,
306
+ "sort_args": [],
307
+ }
308
+ script = "file://../scripts/bam/BamSampling.py"
309
+
310
+
311
+ class BamSubsetByBed(Proc):
312
+ """Subset bam file by the regions in a bed file
313
+
314
+ Input:
315
+ bamfile: The bam file
316
+ bedfile: The bed file
317
+
318
+ Output:
319
+ outfile: The output bam file
320
+
321
+ Envs:
322
+ ncores: Number of cores to use
323
+ samtools: Path to samtools executable
324
+ tool: The tool to use, currently only "samtools" is supported
325
+ index: Whether to index the output bam file
326
+ """
327
+ input = "bamfile:file, bedfile:file"
328
+ output = "outfile:file:{{in.bamfile | stem}}-subset.bam"
329
+ lang = config.lang.python
330
+ envs = {
331
+ "ncores": config.misc.ncores,
332
+ "samtools": config.exe.samtools,
333
+ "tool": "samtools",
334
+ "index": True,
335
+ }
336
+ script = "file://../scripts/bam/BamSubsetByBed.py"
337
+
338
+
339
+ class BamSort(Proc):
340
+ """Sort bam file
341
+
342
+ Input:
343
+ bamfile: The bam file
344
+
345
+ Output:
346
+ outfile: The output bam file
347
+
348
+ Envs:
349
+ tool (choice): The tool to use.
350
+ - samtools: Use `samtools`
351
+ - sambamba: Use `sambamba`
352
+ ncores (type=int): Number of cores to use
353
+ samtools: Path to samtools executable
354
+ sambamba: Path to sambamba executable
355
+ tmpdir: The temporary directory to use
356
+ byname (flag): Whether to sort by read name
357
+ index (flag): Whether to index the output bam file
358
+ The index file will be created in the same directory as the output
359
+ bam file
360
+ <more>: Other arguments passed to the sorting tool
361
+ See `samtools sort` or `sambamba sort`
362
+ """
363
+ input = "bamfile:file"
364
+ output = "outfile:file:{{in.bamfile | stem}}.sorted.bam"
365
+ lang = config.lang.python
366
+ envs = {
367
+ "tool": "samtools",
368
+ "ncores": config.misc.ncores,
369
+ "samtools": config.exe.samtools,
370
+ "sambamba": config.exe.sambamba,
371
+ "tmpdir": config.path.tmpdir,
372
+ "byname": False,
373
+ "index": True,
374
+ }
375
+ script = "file://../scripts/bam/BamSort.py"
376
+
377
+
378
+ class SamtoolsView(Proc):
379
+ """View bam file using samtools, mostly used for filtering
380
+
381
+ This is a wrapper for `samtools view` command.
382
+ It will create a new bam file with the same name as the input bam file.
383
+
384
+ Input:
385
+ bamfile: The bam file
386
+
387
+ Output:
388
+ outfile: The output bam file
389
+
390
+ Envs:
391
+ ncores: Number of cores to use
392
+ samtools: Path to samtools executable
393
+ index: Whether to index the output bam file
394
+ Requires the input bam file to be sorted.
395
+ <more>: Other arguments passed to the view tool
396
+ See `samtools view` or `sambamba view`.
397
+ """
398
+ input = "bamfile:file"
399
+ output = "outfile:file:{{in.bamfile | stem}}.bam"
400
+ lang = config.lang.python
401
+ envs = {
402
+ "ncores": config.misc.ncores,
403
+ "samtools": config.exe.samtools,
404
+ "index": True,
405
+ }
406
+ script = "file://../scripts/bam/SamtoolsView.py"