biopipen 0.21.0__py3-none-any.whl → 0.34.26__py3-none-any.whl

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 (290) hide show
  1. biopipen/__init__.py +1 -1
  2. biopipen/core/config.toml +28 -0
  3. biopipen/core/filters.py +79 -4
  4. biopipen/core/proc.py +12 -3
  5. biopipen/core/testing.py +75 -3
  6. biopipen/ns/bam.py +148 -6
  7. biopipen/ns/bed.py +75 -0
  8. biopipen/ns/cellranger.py +186 -0
  9. biopipen/ns/cellranger_pipeline.py +126 -0
  10. biopipen/ns/cnv.py +19 -3
  11. biopipen/ns/cnvkit.py +1 -1
  12. biopipen/ns/cnvkit_pipeline.py +20 -12
  13. biopipen/ns/delim.py +34 -35
  14. biopipen/ns/gene.py +68 -23
  15. biopipen/ns/gsea.py +63 -37
  16. biopipen/ns/misc.py +39 -14
  17. biopipen/ns/plot.py +304 -1
  18. biopipen/ns/protein.py +183 -0
  19. biopipen/ns/regulatory.py +290 -0
  20. biopipen/ns/rnaseq.py +142 -5
  21. biopipen/ns/scrna.py +2053 -473
  22. biopipen/ns/scrna_metabolic_landscape.py +228 -382
  23. biopipen/ns/snp.py +659 -0
  24. biopipen/ns/stats.py +484 -0
  25. biopipen/ns/tcr.py +683 -98
  26. biopipen/ns/vcf.py +236 -2
  27. biopipen/ns/web.py +97 -6
  28. biopipen/reports/bam/CNVpytor.svelte +4 -9
  29. biopipen/reports/cellranger/CellRangerCount.svelte +18 -0
  30. biopipen/reports/cellranger/CellRangerSummary.svelte +16 -0
  31. biopipen/reports/cellranger/CellRangerVdj.svelte +18 -0
  32. biopipen/reports/cnvkit/CNVkitDiagram.svelte +1 -1
  33. biopipen/reports/cnvkit/CNVkitHeatmap.svelte +1 -1
  34. biopipen/reports/cnvkit/CNVkitScatter.svelte +1 -1
  35. biopipen/reports/common.svelte +15 -0
  36. biopipen/reports/protein/ProdigySummary.svelte +16 -0
  37. biopipen/reports/scrna/CellsDistribution.svelte +4 -39
  38. biopipen/reports/scrna/DimPlots.svelte +1 -1
  39. biopipen/reports/scrna/MarkersFinder.svelte +6 -126
  40. biopipen/reports/scrna/MetaMarkers.svelte +3 -75
  41. biopipen/reports/scrna/RadarPlots.svelte +4 -20
  42. biopipen/reports/scrna_metabolic_landscape/MetabolicFeatures.svelte +61 -22
  43. biopipen/reports/scrna_metabolic_landscape/MetabolicPathwayActivity.svelte +88 -82
  44. biopipen/reports/scrna_metabolic_landscape/MetabolicPathwayHeterogeneity.svelte +70 -10
  45. biopipen/reports/snp/PlinkCallRate.svelte +24 -0
  46. biopipen/reports/snp/PlinkFreq.svelte +18 -0
  47. biopipen/reports/snp/PlinkHWE.svelte +18 -0
  48. biopipen/reports/snp/PlinkHet.svelte +18 -0
  49. biopipen/reports/snp/PlinkIBD.svelte +18 -0
  50. biopipen/reports/tcr/CDR3AAPhyschem.svelte +19 -66
  51. biopipen/reports/tcr/ClonalStats.svelte +16 -0
  52. biopipen/reports/tcr/CloneResidency.svelte +3 -93
  53. biopipen/reports/tcr/Immunarch.svelte +4 -155
  54. biopipen/reports/tcr/TCRClusterStats.svelte +3 -45
  55. biopipen/reports/tcr/TESSA.svelte +11 -28
  56. biopipen/reports/utils/misc.liq +22 -7
  57. biopipen/scripts/bam/BamMerge.py +11 -15
  58. biopipen/scripts/bam/BamSampling.py +90 -0
  59. biopipen/scripts/bam/BamSort.py +141 -0
  60. biopipen/scripts/bam/BamSplitChroms.py +10 -10
  61. biopipen/scripts/bam/BamSubsetByBed.py +38 -0
  62. biopipen/scripts/bam/CNAClinic.R +41 -5
  63. biopipen/scripts/bam/CNVpytor.py +153 -54
  64. biopipen/scripts/bam/ControlFREEC.py +13 -14
  65. biopipen/scripts/bam/SamtoolsView.py +33 -0
  66. biopipen/scripts/bed/Bed2Vcf.py +5 -5
  67. biopipen/scripts/bed/BedConsensus.py +5 -5
  68. biopipen/scripts/bed/BedLiftOver.sh +6 -4
  69. biopipen/scripts/bed/BedtoolsIntersect.py +54 -0
  70. biopipen/scripts/bed/BedtoolsMakeWindows.py +47 -0
  71. biopipen/scripts/bed/BedtoolsMerge.py +4 -4
  72. biopipen/scripts/cellranger/CellRangerCount.py +138 -0
  73. biopipen/scripts/cellranger/CellRangerSummary.R +181 -0
  74. biopipen/scripts/cellranger/CellRangerVdj.py +112 -0
  75. biopipen/scripts/cnv/AneuploidyScore.R +55 -20
  76. biopipen/scripts/cnv/AneuploidyScoreSummary.R +221 -163
  77. biopipen/scripts/cnv/TMADScore.R +25 -9
  78. biopipen/scripts/cnv/TMADScoreSummary.R +57 -86
  79. biopipen/scripts/cnvkit/CNVkitAccess.py +7 -6
  80. biopipen/scripts/cnvkit/CNVkitAutobin.py +26 -18
  81. biopipen/scripts/cnvkit/CNVkitBatch.py +6 -6
  82. biopipen/scripts/cnvkit/CNVkitCall.py +3 -3
  83. biopipen/scripts/cnvkit/CNVkitCoverage.py +4 -3
  84. biopipen/scripts/cnvkit/CNVkitDiagram.py +5 -5
  85. biopipen/scripts/cnvkit/CNVkitFix.py +3 -3
  86. biopipen/scripts/cnvkit/CNVkitGuessBaits.py +12 -8
  87. biopipen/scripts/cnvkit/CNVkitHeatmap.py +5 -5
  88. biopipen/scripts/cnvkit/CNVkitReference.py +6 -5
  89. biopipen/scripts/cnvkit/CNVkitScatter.py +5 -5
  90. biopipen/scripts/cnvkit/CNVkitSegment.py +5 -5
  91. biopipen/scripts/cnvkit/guess_baits.py +166 -93
  92. biopipen/scripts/delim/RowsBinder.R +1 -1
  93. biopipen/scripts/delim/SampleInfo.R +116 -118
  94. biopipen/scripts/gene/GeneNameConversion.R +67 -0
  95. biopipen/scripts/gene/GenePromoters.R +61 -0
  96. biopipen/scripts/gsea/Enrichr.R +5 -5
  97. biopipen/scripts/gsea/FGSEA.R +184 -50
  98. biopipen/scripts/gsea/GSEA.R +2 -2
  99. biopipen/scripts/gsea/PreRank.R +5 -5
  100. biopipen/scripts/misc/Config2File.py +2 -2
  101. biopipen/scripts/misc/Plot.R +80 -0
  102. biopipen/scripts/misc/Shell.sh +15 -0
  103. biopipen/scripts/misc/Str2File.py +2 -2
  104. biopipen/scripts/plot/Heatmap.R +3 -3
  105. biopipen/scripts/plot/Manhattan.R +147 -0
  106. biopipen/scripts/plot/QQPlot.R +146 -0
  107. biopipen/scripts/plot/ROC.R +88 -0
  108. biopipen/scripts/plot/Scatter.R +112 -0
  109. biopipen/scripts/plot/VennDiagram.R +5 -9
  110. biopipen/scripts/protein/MMCIF2PDB.py +33 -0
  111. biopipen/scripts/protein/PDB2Fasta.py +60 -0
  112. biopipen/scripts/protein/Prodigy.py +119 -0
  113. biopipen/scripts/protein/ProdigySummary.R +140 -0
  114. biopipen/scripts/protein/RMSD.py +178 -0
  115. biopipen/scripts/regulatory/MotifAffinityTest.R +102 -0
  116. biopipen/scripts/regulatory/MotifAffinityTest_AtSNP.R +127 -0
  117. biopipen/scripts/regulatory/MotifAffinityTest_MotifBreakR.R +104 -0
  118. biopipen/scripts/regulatory/MotifScan.py +159 -0
  119. biopipen/scripts/regulatory/VariantMotifPlot.R +78 -0
  120. biopipen/scripts/regulatory/motifs-common.R +324 -0
  121. biopipen/scripts/rnaseq/Simulation-ESCO.R +180 -0
  122. biopipen/scripts/rnaseq/Simulation-RUVcorr.R +45 -0
  123. biopipen/scripts/rnaseq/Simulation.R +21 -0
  124. biopipen/scripts/rnaseq/UnitConversion.R +325 -54
  125. biopipen/scripts/scrna/AnnData2Seurat.R +40 -0
  126. biopipen/scripts/scrna/CCPlotR-patch.R +161 -0
  127. biopipen/scripts/scrna/CellCellCommunication.py +150 -0
  128. biopipen/scripts/scrna/CellCellCommunicationPlots.R +93 -0
  129. biopipen/scripts/scrna/CellSNPLite.py +30 -0
  130. biopipen/scripts/scrna/CellTypeAnnotation-celltypist.R +185 -0
  131. biopipen/scripts/scrna/CellTypeAnnotation-direct.R +68 -31
  132. biopipen/scripts/scrna/CellTypeAnnotation-hitype.R +27 -22
  133. biopipen/scripts/scrna/CellTypeAnnotation-sccatch.R +28 -20
  134. biopipen/scripts/scrna/CellTypeAnnotation-sctype.R +48 -25
  135. biopipen/scripts/scrna/CellTypeAnnotation.R +37 -1
  136. biopipen/scripts/scrna/CellsDistribution.R +456 -167
  137. biopipen/scripts/scrna/DimPlots.R +1 -1
  138. biopipen/scripts/scrna/ExprImputation-alra.R +109 -0
  139. biopipen/scripts/scrna/ExprImputation-rmagic.R +256 -0
  140. biopipen/scripts/scrna/{ExprImpution-scimpute.R → ExprImputation-scimpute.R} +8 -5
  141. biopipen/scripts/scrna/ExprImputation.R +7 -0
  142. biopipen/scripts/scrna/LoomTo10X.R +51 -0
  143. biopipen/scripts/scrna/MQuad.py +25 -0
  144. biopipen/scripts/scrna/MarkersFinder.R +679 -400
  145. biopipen/scripts/scrna/MetaMarkers.R +265 -161
  146. biopipen/scripts/scrna/ModuleScoreCalculator.R +66 -11
  147. biopipen/scripts/scrna/PseudoBulkDEG.R +678 -0
  148. biopipen/scripts/scrna/RadarPlots.R +355 -134
  149. biopipen/scripts/scrna/ScFGSEA.R +298 -100
  150. biopipen/scripts/scrna/ScSimulation.R +65 -0
  151. biopipen/scripts/scrna/ScVelo.py +617 -0
  152. biopipen/scripts/scrna/Seurat2AnnData.R +7 -0
  153. biopipen/scripts/scrna/SeuratClusterStats-clustree.R +87 -0
  154. biopipen/scripts/scrna/SeuratClusterStats-dimplots.R +36 -30
  155. biopipen/scripts/scrna/SeuratClusterStats-features.R +138 -187
  156. biopipen/scripts/scrna/SeuratClusterStats-ngenes.R +81 -0
  157. biopipen/scripts/scrna/SeuratClusterStats-stats.R +78 -89
  158. biopipen/scripts/scrna/SeuratClusterStats.R +47 -10
  159. biopipen/scripts/scrna/SeuratClustering.R +36 -233
  160. biopipen/scripts/scrna/SeuratLoading.R +2 -2
  161. biopipen/scripts/scrna/SeuratMap2Ref.R +84 -113
  162. biopipen/scripts/scrna/SeuratMetadataMutater.R +16 -6
  163. biopipen/scripts/scrna/SeuratPreparing.R +223 -173
  164. biopipen/scripts/scrna/SeuratSubClustering.R +64 -0
  165. biopipen/scripts/scrna/SeuratTo10X.R +27 -0
  166. biopipen/scripts/scrna/Slingshot.R +65 -0
  167. biopipen/scripts/scrna/Subset10X.R +2 -2
  168. biopipen/scripts/scrna/TopExpressingGenes.R +169 -135
  169. biopipen/scripts/scrna/celltypist-wrapper.py +195 -0
  170. biopipen/scripts/scrna/scvelo_paga.py +313 -0
  171. biopipen/scripts/scrna/seurat_anndata_conversion.py +98 -0
  172. biopipen/scripts/scrna_metabolic_landscape/MetabolicFeatures.R +447 -82
  173. biopipen/scripts/scrna_metabolic_landscape/MetabolicPathwayActivity.R +348 -241
  174. biopipen/scripts/scrna_metabolic_landscape/MetabolicPathwayHeterogeneity.R +188 -166
  175. biopipen/scripts/snp/MatrixEQTL.R +217 -0
  176. biopipen/scripts/snp/Plink2GTMat.py +148 -0
  177. biopipen/scripts/snp/PlinkCallRate.R +199 -0
  178. biopipen/scripts/snp/PlinkFilter.py +100 -0
  179. biopipen/scripts/snp/PlinkFreq.R +291 -0
  180. biopipen/scripts/snp/PlinkFromVcf.py +81 -0
  181. biopipen/scripts/snp/PlinkHWE.R +85 -0
  182. biopipen/scripts/snp/PlinkHet.R +96 -0
  183. biopipen/scripts/snp/PlinkIBD.R +196 -0
  184. biopipen/scripts/snp/PlinkSimulation.py +124 -0
  185. biopipen/scripts/snp/PlinkUpdateName.py +124 -0
  186. biopipen/scripts/stats/ChowTest.R +146 -0
  187. biopipen/scripts/stats/DiffCoexpr.R +152 -0
  188. biopipen/scripts/stats/LiquidAssoc.R +135 -0
  189. biopipen/scripts/stats/Mediation.R +108 -0
  190. biopipen/scripts/stats/MetaPvalue.R +130 -0
  191. biopipen/scripts/stats/MetaPvalue1.R +74 -0
  192. biopipen/scripts/tcgamaf/Maf2Vcf.py +2 -2
  193. biopipen/scripts/tcgamaf/MafAddChr.py +2 -2
  194. biopipen/scripts/tcr/Attach2Seurat.R +3 -2
  195. biopipen/scripts/tcr/CDR3AAPhyschem.R +211 -143
  196. biopipen/scripts/tcr/CDR3Clustering.R +343 -0
  197. biopipen/scripts/tcr/ClonalStats.R +526 -0
  198. biopipen/scripts/tcr/CloneResidency.R +255 -131
  199. biopipen/scripts/tcr/CloneSizeQQPlot.R +4 -4
  200. biopipen/scripts/tcr/GIANA/GIANA.py +1356 -797
  201. biopipen/scripts/tcr/GIANA/GIANA4.py +1362 -789
  202. biopipen/scripts/tcr/GIANA/query.py +164 -162
  203. biopipen/scripts/tcr/Immunarch-basic.R +31 -9
  204. biopipen/scripts/tcr/Immunarch-clonality.R +25 -5
  205. biopipen/scripts/tcr/Immunarch-diversity.R +352 -134
  206. biopipen/scripts/tcr/Immunarch-geneusage.R +45 -5
  207. biopipen/scripts/tcr/Immunarch-kmer.R +68 -8
  208. biopipen/scripts/tcr/Immunarch-overlap.R +84 -4
  209. biopipen/scripts/tcr/Immunarch-spectratyping.R +35 -6
  210. biopipen/scripts/tcr/Immunarch-tracking.R +38 -6
  211. biopipen/scripts/tcr/Immunarch-vjjunc.R +165 -0
  212. biopipen/scripts/tcr/Immunarch.R +63 -11
  213. biopipen/scripts/tcr/Immunarch2VDJtools.R +2 -2
  214. biopipen/scripts/tcr/ImmunarchFilter.R +4 -4
  215. biopipen/scripts/tcr/ImmunarchLoading.R +38 -29
  216. biopipen/scripts/tcr/SampleDiversity.R +1 -1
  217. biopipen/scripts/tcr/ScRepCombiningExpression.R +40 -0
  218. biopipen/scripts/tcr/ScRepLoading.R +166 -0
  219. biopipen/scripts/tcr/TCRClusterStats.R +176 -22
  220. biopipen/scripts/tcr/TCRDock.py +110 -0
  221. biopipen/scripts/tcr/TESSA.R +102 -118
  222. biopipen/scripts/tcr/VJUsage.R +5 -5
  223. biopipen/scripts/tcr/immunarch-patched.R +142 -0
  224. biopipen/scripts/tcr/vdjtools-patch.sh +1 -1
  225. biopipen/scripts/vcf/BcftoolsAnnotate.py +91 -0
  226. biopipen/scripts/vcf/BcftoolsFilter.py +90 -0
  227. biopipen/scripts/vcf/BcftoolsMerge.py +31 -0
  228. biopipen/scripts/vcf/BcftoolsSort.py +113 -0
  229. biopipen/scripts/vcf/BcftoolsView.py +73 -0
  230. biopipen/scripts/vcf/TruvariBench.sh +14 -7
  231. biopipen/scripts/vcf/TruvariBenchSummary.R +16 -13
  232. biopipen/scripts/vcf/TruvariConsistency.R +1 -1
  233. biopipen/scripts/vcf/Vcf2Bed.py +2 -2
  234. biopipen/scripts/vcf/VcfAnno.py +11 -11
  235. biopipen/scripts/vcf/VcfDownSample.sh +22 -10
  236. biopipen/scripts/vcf/VcfFilter.py +5 -5
  237. biopipen/scripts/vcf/VcfFix.py +7 -7
  238. biopipen/scripts/vcf/VcfFix_utils.py +13 -4
  239. biopipen/scripts/vcf/VcfIndex.py +3 -3
  240. biopipen/scripts/vcf/VcfIntersect.py +3 -3
  241. biopipen/scripts/vcf/VcfLiftOver.sh +5 -0
  242. biopipen/scripts/vcf/VcfSplitSamples.py +4 -4
  243. biopipen/scripts/vcf/bcftools_utils.py +52 -0
  244. biopipen/scripts/web/Download.py +8 -4
  245. biopipen/scripts/web/DownloadList.py +5 -5
  246. biopipen/scripts/web/GCloudStorageDownloadBucket.py +82 -0
  247. biopipen/scripts/web/GCloudStorageDownloadFile.py +23 -0
  248. biopipen/scripts/web/gcloud_common.py +49 -0
  249. biopipen/utils/gene.py +108 -60
  250. biopipen/utils/misc.py +146 -20
  251. biopipen/utils/reference.py +64 -20
  252. biopipen/utils/reporter.py +177 -0
  253. biopipen/utils/vcf.py +1 -1
  254. biopipen-0.34.26.dist-info/METADATA +27 -0
  255. biopipen-0.34.26.dist-info/RECORD +292 -0
  256. {biopipen-0.21.0.dist-info → biopipen-0.34.26.dist-info}/WHEEL +1 -1
  257. {biopipen-0.21.0.dist-info → biopipen-0.34.26.dist-info}/entry_points.txt +6 -2
  258. biopipen/ns/bcftools.py +0 -111
  259. biopipen/ns/scrna_basic.py +0 -255
  260. biopipen/reports/delim/SampleInfo.svelte +0 -36
  261. biopipen/reports/scrna/GeneExpressionInvistigation.svelte +0 -32
  262. biopipen/reports/scrna/ScFGSEA.svelte +0 -35
  263. biopipen/reports/scrna/SeuratClusterStats.svelte +0 -82
  264. biopipen/reports/scrna/SeuratMap2Ref.svelte +0 -20
  265. biopipen/reports/scrna/SeuratPreparing.svelte +0 -38
  266. biopipen/reports/scrna/TopExpressingGenes.svelte +0 -55
  267. biopipen/reports/scrna_metabolic_landscape/MetabolicFeaturesIntraSubset.svelte +0 -31
  268. biopipen/reports/utils/gsea.liq +0 -110
  269. biopipen/scripts/bcftools/BcftoolsAnnotate.py +0 -42
  270. biopipen/scripts/bcftools/BcftoolsFilter.py +0 -79
  271. biopipen/scripts/bcftools/BcftoolsSort.py +0 -19
  272. biopipen/scripts/gene/GeneNameConversion.py +0 -66
  273. biopipen/scripts/scrna/ExprImpution-alra.R +0 -32
  274. biopipen/scripts/scrna/ExprImpution-rmagic.R +0 -29
  275. biopipen/scripts/scrna/ExprImpution.R +0 -7
  276. biopipen/scripts/scrna/GeneExpressionInvistigation.R +0 -132
  277. biopipen/scripts/scrna/Write10X.R +0 -11
  278. biopipen/scripts/scrna_metabolic_landscape/MetabolicFeaturesIntraSubset.R +0 -150
  279. biopipen/scripts/tcr/TCRClustering.R +0 -280
  280. biopipen/utils/common_docstrs.py +0 -61
  281. biopipen/utils/gene.R +0 -49
  282. biopipen/utils/gsea.R +0 -193
  283. biopipen/utils/io.R +0 -20
  284. biopipen/utils/misc.R +0 -114
  285. biopipen/utils/mutate_helpers.R +0 -433
  286. biopipen/utils/plot.R +0 -173
  287. biopipen/utils/rnaseq.R +0 -48
  288. biopipen/utils/single_cell.R +0 -115
  289. biopipen-0.21.0.dist-info/METADATA +0 -22
  290. biopipen-0.21.0.dist-info/RECORD +0 -218
@@ -1,9 +1,7 @@
1
- library(ggplot2)
2
- library(ggprism)
3
1
  library(dplyr)
4
2
  library(tidyr)
5
3
  library(tibble)
6
- library(patchwork)
4
+ library(plotthis)
7
5
 
8
6
  tmadfiles = {{in.tmadfiles | r}}
9
7
  metafile = {{in.metafile | r}}
@@ -47,10 +45,14 @@ if (!is.null(group_cols)) {
47
45
  }
48
46
 
49
47
  data = data.frame(Sample = sams, tMAD = tmads)
50
- if (file.exists(metafile) && length(meta_cols) > 0) {
48
+ if (is.character(metafile) && file.exists(metafile) && length(meta_cols) > 0) {
51
49
  metadf = read.table(metafile, header=T, row.names=NULL, sep="\t", stringsAsFactors=F)
52
- sample_col = colnames(metadf)[1]
53
- meta = metadf[, c(sample_col, meta_cols), drop=FALSE]
50
+ if (!is.null(metadf$Sample)) {
51
+ metadf$Sample = as.character(metadf$Sample)
52
+ } else {
53
+ colnames(metadf)[1] = "Sample"
54
+ }
55
+ meta = metadf[, c("Sample", meta_cols), drop=FALSE]
54
56
  colnames(meta) = c("Sample", meta_cols)
55
57
  data = data %>% left_join(meta, by="Sample")
56
58
  }
@@ -59,20 +61,12 @@ if (file.exists(metafile) && length(meta_cols) > 0) {
59
61
  write.table(data, file=file.path(outdir, "tMAD.txt"), sep="\t", quote=F, row.names=F)
60
62
 
61
63
  # bar plot for all samples without grouping
62
- p = ggplot(data, aes(x=Sample, y=tMAD)) +
63
- geom_bar(stat="identity", fill="steelblue") +
64
- theme_prism() +
65
- theme(
66
- axis.text.x = element_text(angle=90, hjust=1, vjust=0.5),
67
- axis.title.x = element_blank(),
68
- axis.title.y = element_text(size=12),
69
- axis.text.y = element_text(size=12),
70
- legend.position = "none",
71
- ) +
72
- labs(
73
- x = NULL,
74
- y = "tMAD",
75
- )
64
+ p <- BarPlot(
65
+ data = data,
66
+ x = "Sample",
67
+ y = "tMAD",
68
+ x_text_angle = 90
69
+ )
76
70
 
77
71
  png(file.path(outdir, "tMAD.png"), width=400 + length(sams) * 12, height=800, res=100)
78
72
  print(p)
@@ -84,41 +78,30 @@ if (!is.null(group_cols)) {
84
78
  if (!grepl(",", group_col, fixed = TRUE)) {
85
79
  # Bar plot with this group_col, but with different fill colors
86
80
  # for each group, and samples from the same group are next to each other
87
- p = ggplot(
88
- data %>% arrange(!!sym(group_col)) %>% mutate(Sample=factor(Sample, levels=Sample)),
89
- aes(x=Sample, y=tMAD, fill=!!sym(group_col))
90
- ) +
91
- geom_bar(stat="identity") +
92
- theme_prism() +
93
- theme(
94
- axis.text.x = element_text(angle=90, hjust=1, vjust=0.5),
95
- axis.title.x = element_blank(),
96
- axis.title.y = element_text(size=12),
97
- axis.text.y = element_text(size=12),
98
- ) +
99
- labs(
100
- x = NULL,
101
- y = "tMAD",
102
- )
81
+ gdata <- data %>% arrange(!!sym(group_col)) %>% mutate(Sample=factor(Sample, levels=unique(Sample)))
82
+ p <- BarPlot(
83
+ data = gdata,
84
+ x = "Sample",
85
+ y = "tMAD",
86
+ fill = group_col,
87
+ x_text_angle = 90
88
+ )
103
89
 
104
90
  png(file.path(outdir, paste0("tMAD_", group_col, "_bar.png")), width=400 + length(sams) * 12, height=600, res=100)
105
91
  print(p)
106
92
  dev.off()
107
93
 
108
94
  # Box plot overlays with violin plot with this group_col
109
- p = ggplot(data, aes(x=!!sym(group_col), y=tMAD)) +
110
- geom_boxplot(outlier.shape=NA, fill="white", color="black") +
111
- geom_violin(fill="steelblue", alpha=0.5) +
112
- theme_prism() +
113
- theme(
114
- axis.title.x = element_text(size=12),
115
- axis.title.y = element_text(size=12),
116
- axis.text.y = element_text(size=12),
117
- ) +
118
- labs(
119
- x = group_col,
120
- y = "tMAD",
121
- )
95
+ p <- ViolinPlot(
96
+ data = gdata,
97
+ x = group_col,
98
+ y = "tMAD",
99
+ x_text_angle = 90,
100
+ add_box = TRUE,
101
+ add_point = TRUE,
102
+ comparisons = TRUE,
103
+ sig_label = "p.format"
104
+ )
122
105
 
123
106
  png(file.path(outdir, paste0("tMAD_", group_col, "_box_violin.png")), width=1000, height=600, res=100)
124
107
  print(p)
@@ -133,25 +116,17 @@ if (!is.null(group_cols)) {
133
116
  # concatenate them together using patch work, with ncol=2
134
117
  # calcuate the height and width of the plot based on the number of
135
118
  # groups
136
- ps = data %>%
137
- group_by(!!sym(group_col1)) %>%
138
- group_map(function(.x, .y) {
139
- p = ggplot(
140
- .x %>% arrange(!!sym(group_col2)) %>% mutate(Sample=factor(Sample, levels=Sample)),
141
- aes(x=Sample, y=tMAD, fill=!!sym(group_col2))
142
- ) +
143
- geom_bar(stat="identity") +
144
- theme_prism() +
145
- theme(
146
- axis.text.x = element_text(angle=90, hjust=1, vjust=0.5),
147
- axis.title.x = element_blank(),
148
- axis.title.y = element_text(size=12),
149
- axis.text.y = element_text(size=12),
150
- ) +
151
- labs(x = NULL, y = "tMAD") +
152
- ggtitle(.y[[group_col1]][1])
153
- p
154
- })
119
+ gdata <- data %>% arrange(!!sym(group_col1), !!sym(group_col2)) %>%
120
+ mutate(Sample=factor(Sample, levels=unique(Sample)))
121
+ p <- BarPlot(
122
+ data = gdata,
123
+ x = "Sample",
124
+ y = "tMAD",
125
+ split_by = group_col1,
126
+ fill = group_col2,
127
+ x_text_angle = 90,
128
+ ncol = 2
129
+ )
155
130
 
156
131
  png(
157
132
  file.path(outdir, paste0("tMAD_", group_col, "_bar.png")),
@@ -159,26 +134,22 @@ if (!is.null(group_cols)) {
159
134
  height=length(unique(data[[group_col1]])) * 200,
160
135
  res=100
161
136
  )
162
- print(wrap_plots(ps, ncol=2))
137
+ print(p)
163
138
  dev.off()
164
139
 
165
140
  # Do the same for Voilin + boxplot
166
- ps = data %>%
167
- group_by(!!sym(group_col1)) %>%
168
- group_map(function(.x, .y) {
169
- p = ggplot(.x, aes(x=!!sym(group_col2), y=tMAD)) +
170
- geom_boxplot(outlier.shape=NA, fill="white", color="black") +
171
- geom_violin(fill="steelblue", alpha=0.5) +
172
- theme_prism() +
173
- theme(
174
- axis.title.x = element_text(size=12),
175
- axis.title.y = element_text(size=12),
176
- axis.text.y = element_text(size=12),
177
- ) +
178
- labs(x = group_col2, y = "tMAD") +
179
- ggtitle(.y[[group_col1]][1])
180
- p
181
- })
141
+ p <- ViolinPlot(
142
+ data = gdata,
143
+ x = group_col2,
144
+ y = "tMAD",
145
+ split_by = group_col1,
146
+ x_text_angle = 90,
147
+ add_box = TRUE,
148
+ add_point = TRUE,
149
+ comparisons = TRUE,
150
+ sig_label = "p.format",
151
+ ncol = 2
152
+ )
182
153
 
183
154
  png(
184
155
  file.path(outdir, paste0("tMAD_", group_col, "_box_violin.png")),
@@ -186,7 +157,7 @@ if (!is.null(group_cols)) {
186
157
  height=length(unique(data[[group_col1]])) * 200,
187
158
  res=100
188
159
  )
189
- print(wrap_plots(ps, ncol=2))
160
+ print(p)
190
161
  dev.off()
191
162
  }
192
163
  }
@@ -1,10 +1,11 @@
1
+ from pathlib import Path, PosixPath # noqa: F401
1
2
  from biopipen.utils.misc import run_command, dict_to_cli_args
2
3
 
3
- excfiles = {{in.excfiles | repr}} # pyright: ignore
4
- outfile = {{out.outfile | quote}} # pyright: ignore
5
- reffile = {{envs.ref | quote}} # pyright: ignore
6
- cnvkit = {{envs.cnvkit | quote}} # pyright: ignore
7
- min_gap_size = {{envs.min_gap_size | quote}} # pyright: ignore
4
+ excfiles: list[Path] = {{in.excfiles | each: as_path}} # pyright: ignore # noqa
5
+ outfile: str = {{out.outfile | quote}} # pyright: ignore
6
+ reffile: str = {{envs.ref | quote}} # pyright: ignore
7
+ cnvkit: str = {{envs.cnvkit | quote}} # pyright: ignore
8
+ min_gap_size: str = {{envs.min_gap_size | quote}} # pyright: ignore
8
9
 
9
10
 
10
11
  def main():
@@ -12,7 +13,7 @@ def main():
12
13
  "": [cnvkit, "access"],
13
14
  "s": min_gap_size,
14
15
  "o": outfile,
15
- "_": reffile,
16
+ "_": Path(reffile).expanduser(),
16
17
  }
17
18
  if excfiles:
18
19
  other_args["exclude"] = excfiles
@@ -1,26 +1,34 @@
1
+ from __future__ import annotations
2
+
3
+ from pathlib import Path, PosixPath # noqa: F401
1
4
  from biopipen.utils.misc import run_command, dict_to_cli_args
2
5
 
3
- bamfiles = {{in.bamfiles | repr}} # pyright: ignore
4
- accfile = {{in.accfile | quote}} # pyright: ignore
5
- baitfile = {{in.baitfile | repr}} # pyright: ignore
6
- target_file = {{out.target_file | quote}} # pyright: ignore
7
- antitarget_file = {{out.antitarget_file | quote}} # pyright: ignore
8
- reffile = {{envs.ref | quote}} # pyright: ignore
9
- cnvkit = {{envs.cnvkit | quote}} # pyright: ignore
10
- method = {{envs.method | quote}} # pyright: ignore
11
- bp_per_bin = {{envs.bp_per_bin | repr}} # pyright: ignore
12
- target_max_size = {{envs.target_max_size | repr}} # pyright: ignore
13
- target_min_size = {{envs.target_min_size | repr}} # pyright: ignore
14
- antitarget_max_size = {{envs.antitarget_max_size | repr}} # pyright: ignore
15
- antitarget_min_size = {{envs.antitarget_min_size | repr}} # pyright: ignore
16
- annotate = {{envs.annotate | repr}} # pyright: ignore
17
- short_names = {{envs.short_names | repr}} # pyright: ignore
6
+ bamfiles: list[Path] = {{in.bamfiles | each: as_path}} # pyright: ignore # noqa
7
+ accfile: str | None = {{in.accfile | quote}} # pyright: ignore
8
+ baitfile: str | None = {{in.baitfile | quote}} # pyright: ignore
9
+ target_file: str | None = {{out.target_file | quote}} # pyright: ignore
10
+ antitarget_file: str | None = {{out.antitarget_file | quote}} # pyright: ignore
11
+ reffile: str = {{envs.ref | quote}} # pyright: ignore
12
+ cnvkit: str = {{envs.cnvkit | quote}} # pyright: ignore
13
+ method: str = {{envs.method | quote}} # pyright: ignore
14
+ bp_per_bin: int = {{envs.bp_per_bin | repr}} # pyright: ignore
15
+ target_max_size: int = {{envs.target_max_size | repr}} # pyright: ignore
16
+ target_min_size: int = {{envs.target_min_size | repr}} # pyright: ignore
17
+ antitarget_max_size: int = {{envs.antitarget_max_size | repr}} # pyright: ignore
18
+ antitarget_min_size: int = {{envs.antitarget_min_size | repr}} # pyright: ignore
19
+ annotate: str | None = {{envs.annotate | quote}} # pyright: ignore
20
+ short_names: bool = {{envs.short_names | repr}} # pyright: ignore
21
+
22
+ if baitfile == "None":
23
+ baitfile = None
24
+ if accfile == "None":
25
+ accfile = None
18
26
 
19
27
 
20
28
  def main():
21
29
 
22
- args = dict(
23
- f=reffile,
30
+ args: dict = dict(
31
+ f=Path(reffile).expanduser(),
24
32
  m=method,
25
33
  g=accfile,
26
34
  t=baitfile,
@@ -29,7 +37,7 @@ def main():
29
37
  target_min_size=target_min_size,
30
38
  antitarget_max_size=antitarget_max_size,
31
39
  antitarget_min_size=antitarget_min_size,
32
- annotate=annotate,
40
+ annotate=False if annotate is None else Path(annotate).expanduser(),
33
41
  short_names=short_names,
34
42
  target_output_bed=target_file,
35
43
  antitarget_output_bed=antitarget_file,
@@ -3,8 +3,8 @@ from pathlib import Path
3
3
  import pandas
4
4
  from biopipen.utils.misc import run_command, dict_to_cli_args
5
5
 
6
- metafile = {{in.cnsfile | quote}} # pyright: ignore
7
- outdir = {{out.outdir | quote}} # pyright: ignore
6
+ metafile: str = {{in.cnsfile | quote}} # pyright: ignore # noqa
7
+ outdir: str = {{out.outdir | quote}} # pyright: ignore
8
8
  cnvkit = {{envs.cnvkit | quote}} # pyright: ignore
9
9
  method = {{envs.method | quote}} # pyright: ignore
10
10
  segment_method = {{envs.segment_method | quote}} # pyright: ignore
@@ -13,7 +13,7 @@ count_reads = {{envs.count_reads | repr}} # pyright: ignore
13
13
  drop_low_coverage = {{envs.drop_low_coverage | repr}} # pyright: ignore
14
14
  ncores = {{envs.ncores | repr}} # pyright: ignore
15
15
  rscript = {{envs.rscript | quote}} # pyright: ignore
16
- ref = {{envs.ref | quote}} # pyright: ignore
16
+ ref: str = {{envs.ref | quote}} # pyright: ignore
17
17
  targets = {{envs.targets | repr}} # pyright: ignore
18
18
  antitargets = {{envs.antitargets | repr}} # pyright: ignore
19
19
  annotate = {{envs.annotate | repr}} # pyright: ignore
@@ -30,7 +30,7 @@ scatter = {{envs.scatter | repr}} # pyright: ignore
30
30
  diagram = {{envs.diagram | repr}} # pyright: ignore
31
31
  type_tumor = {{envs.type_tumor | repr}} # pyright: ignore
32
32
  type_normal = {{envs.type_normal | repr}} # pyright: ignore
33
- type_col = {{envs.type_col | quote}} # pyright: ignore
33
+ type_col: str = {{envs.type_col | quote}} # pyright: ignore
34
34
 
35
35
 
36
36
  def gen_access():
@@ -38,11 +38,11 @@ def gen_access():
38
38
  return access
39
39
 
40
40
  accessfile = Path(outdir) / "access.bed"
41
- args = dict(
41
+ args: dict = dict(
42
42
  exclude=access_excludes or False,
43
43
  s=access_min_gap_size or False,
44
44
  o=accessfile,
45
- _=ref,
45
+ _=Path(ref).expanduser(),
46
46
  )
47
47
  args[""] = [cnvkit, "access"]
48
48
  run_command(dict_to_cli_args(args, dashify=True), fg=True)
@@ -1,14 +1,14 @@
1
1
  from pathlib import Path
2
2
  from biopipen.utils.misc import run_command
3
3
 
4
- cnsfile = {{in.cnsfile | quote}} # pyright: ignore
5
- cnrfile = {{in.cnrfile | quote}} # pyright: ignore
4
+ cnsfile: str = {{in.cnsfile | quote}} # pyright: ignore # noqa
5
+ cnrfile: str = {{in.cnrfile | quote}} # pyright: ignore
6
6
  vcf = {{in.vcf | repr}} # pyright: ignore
7
7
  sample_id = {{in.sample_id | repr}} # pyright: ignore
8
8
  normal_id = {{in.normal_id | repr}} # pyright: ignore
9
9
  sample_sex = {{in.sample_sex | repr}} # pyright: ignore
10
10
  purity = {{in.purity | repr}} # pyright: ignore
11
- outdir = {{out.outdir | quote}} # pyright: ignore
11
+ outdir: str = {{out.outdir | quote}} # pyright: ignore
12
12
  cnvkit = {{envs.cnvkit | quote}} # pyright: ignore
13
13
  center = {{envs.center | repr}} # pyright: ignore
14
14
  center_at = {{envs.center_at | repr}} # pyright: ignore
@@ -1,9 +1,10 @@
1
+ from pathlib import Path
1
2
  from biopipen.utils.misc import run_command, dict_to_cli_args
2
3
 
3
- bamfile = {{in.bamfile | quote}} # pyright: ignore
4
+ bamfile: str = {{in.bamfile | quote}} # pyright: ignore # noqa
4
5
  target_file = {{in.target_file | quote}} # pyright: ignore
5
6
  outfile = {{out.outfile | quote}} # pyright: ignore
6
- reffile = {{envs.reffile | quote}} # pyright: ignore
7
+ reffile: str = {{envs.reffile | quote}} # pyright: ignore
7
8
  cnvkit = {{envs.cnvkit | quote}} # pyright: ignore
8
9
  count = {{envs.count | repr}} # pyright: ignore
9
10
  min_mapq = {{envs.min_mapq | repr}} # pyright: ignore
@@ -13,7 +14,7 @@ ncores = {{envs.ncores | repr}} # pyright: ignore
13
14
  def main():
14
15
 
15
16
  args = dict(
16
- f=reffile,
17
+ f=Path(reffile).expanduser(),
17
18
  c=count,
18
19
  q=min_mapq,
19
20
  p=ncores,
@@ -4,10 +4,10 @@ from diot import Diot
4
4
  from biopipen.utils.misc import run_command, dict_to_cli_args
5
5
 
6
6
 
7
- cnrfile = {{in.cnrfile | quote}} # pyright: ignore
7
+ cnrfile = {{in.cnrfile | quote}} # pyright: ignore # noqa
8
8
  cnsfile = {{in.cnsfile | quote}} # pyright: ignore
9
9
  sample_sex = {{in.sample_sex | repr}} # pyright: ignore
10
- outdir = {{out.outdir | quote}} # pyright: ignore
10
+ outdir: str = {{out.outdir | quote}} # pyright: ignore
11
11
  cnvkit = {{envs.cnvkit | quote}} # pyright: ignore
12
12
  convert = {{envs.convert | quote}} # pyright: ignore
13
13
  convert_args = {{envs.convert_args | repr}} # pyright: ignore
@@ -16,7 +16,7 @@ min_probes = {{envs.min_probes | repr}} # pyright: ignore
16
16
  male_reference = {{envs.male_reference | repr}} # pyright: ignore
17
17
  no_shift_xy = {{envs.no_shift_xy | repr}} # pyright: ignore
18
18
  title = {{envs.title | repr}} # pyright: ignore
19
- cases = {{envs.cases | repr}} # pyright: ignore
19
+ cases: dict | None = {{envs.cases | repr}} # pyright: ignore
20
20
 
21
21
 
22
22
  def do_case(name, case):
@@ -35,7 +35,7 @@ def do_case(name, case):
35
35
  pdffile = Path(outdir).joinpath(f"{name}.heatmap.pdf")
36
36
  pngfile = Path(outdir).joinpath(f"{name}.heatmap.png")
37
37
 
38
- args = dict(
38
+ args: dict = dict(
39
39
  **case,
40
40
  s=cnsfile,
41
41
  o=pdffile,
@@ -44,7 +44,7 @@ def do_case(name, case):
44
44
  args[""] = [cnvkit, "diagram"]
45
45
  run_command(dict_to_cli_args(args, dashify=True), fg=True)
46
46
 
47
- conv_args = dict(**conv_args, _=[pdffile, pngfile])
47
+ conv_args: dict = dict(**conv_args, _=[pdffile, pngfile])
48
48
  conv_args[""] = [convert]
49
49
  run_command(
50
50
  dict_to_cli_args(conv_args, prefix="-", dashify=True),
@@ -2,11 +2,11 @@ from pathlib import Path
2
2
 
3
3
  from biopipen.utils.misc import run_command, dict_to_cli_args
4
4
 
5
- target_file = {{in.target_file | quote}} # pyright: ignore
5
+ target_file = {{in.target_file | quote}} # pyright: ignore # noqa
6
6
  antitarget_file = {{in.antitarget_file | quote}} # pyright: ignore
7
7
  reference_file = {{in.reference | quote}} # pyright: ignore
8
8
  sample_id = {{in.sample_id | repr}} # pyright: ignore
9
- outfile = {{out.outfile | quote}} # pyright: ignore
9
+ outfile: str = {{out.outfile | quote}} # pyright: ignore
10
10
  cnvkit = {{envs.cnvkit | quote}} # pyright: ignore
11
11
  cluster = {{envs.cluster | repr}} # pyright: ignore
12
12
  no_gc = {{envs.no_gc | repr}} # pyright: ignore
@@ -18,7 +18,7 @@ emptyfile.touch()
18
18
 
19
19
  def main():
20
20
 
21
- args = dict(
21
+ args: dict = dict(
22
22
  i=sample_id,
23
23
  o=outfile,
24
24
  c=cluster,
@@ -5,16 +5,16 @@ from pathlib import Path, PosixPath # for as_path
5
5
 
6
6
  from biopipen.utils.misc import run_command, dict_to_cli_args
7
7
 
8
- bamfiles = {{in.bamfiles | repr}} # pyright: ignore
9
- atfile = {{in.atfile | repr}} # pyright: ignore
8
+ bamfiles = {{in.bamfiles | each: str | repr}} # pyright: ignore # noqa
9
+ atfile = {{in.atfile | quote}} # pyright: ignore
10
10
 
11
- targetfile = {{out.targetfile | repr}} # pyright: ignore
11
+ targetfile = {{out.targetfile | quote}} # pyright: ignore
12
12
  covfile = {{out.targetfile | as_path | attr: "with_suffix" | call: ".cnn" | repr}} # pyright: ignore
13
13
 
14
- cnvkit = {{envs.cnvkit | repr}} # pyright: ignore
14
+ cnvkit: str = {{envs.cnvkit | repr}} # pyright: ignore
15
15
  samtools = {{envs.samtools | repr}} # pyright: ignore
16
16
  ncores = {{envs.ncores | repr}} # pyright: ignore
17
- ref = {{envs.ref | repr}} # pyright: ignore
17
+ ref: str = {{envs.ref | repr}} # pyright: ignore
18
18
  guided = {{envs.guided | repr}} # pyright: ignore
19
19
  min_depth = {{envs.min_depth | repr}} # pyright: ignore
20
20
  min_gap = {{envs.min_gap | repr}} # pyright: ignore
@@ -32,10 +32,14 @@ else:
32
32
  params["min-gap"] = min_gap
33
33
  params["min-length"] = min_length
34
34
 
35
- biopipen_dir = {{biopipen_dir | repr}} # pyright: ignore
35
+ biopipen_dir: str = {{biopipen_dir | quote}} # pyright: ignore
36
36
 
37
37
  # get the python path from cnvkit.py
38
- cnvkit_path = Path(which(cnvkit))
38
+ cnvkit_found = which(cnvkit)
39
+ if cnvkit_found is None:
40
+ raise ValueError(f"cnvkit executable not found: {cnvkit}")
41
+
42
+ cnvkit_path = Path(cnvkit_found)
39
43
  # Modify cnvkit.py to a unique tmp path, named with timestamp
40
44
  # to find the python path
41
45
  tmp_cnvkit_path = Path("/tmp/cnvkit-{}.py".format(time.time()))
@@ -60,7 +64,7 @@ params.update({
60
64
  "o": targetfile,
61
65
  "c": covfile,
62
66
  "p": ncores,
63
- "f": ref,
67
+ "f": Path(ref).expanduser(),
64
68
  "s": samtools,
65
69
  "_": bamfiles,
66
70
  })
@@ -1,12 +1,12 @@
1
1
  from pathlib import Path
2
2
 
3
- from diot import Diot
3
+ from diot import Diot # type: ignore[import]
4
4
 
5
5
  from biopipen.utils.misc import run_command, dict_to_cli_args
6
6
 
7
- segfiles = {{in.segfiles | repr}} # pyright: ignore
7
+ segfiles = {{in.segfiles | default: [] | each: str | repr}} # pyright: ignore # noqa # noqa
8
8
  sample_sex = {{in.sample_sex | repr}} # pyright: ignore
9
- outdir = {{out.outdir | repr}} # pyright: ignore
9
+ outdir: str = {{out.outdir | quote}} # pyright: ignore
10
10
  cnvkit = {{envs.cnvkit | quote}} # pyright: ignore
11
11
  convert = {{envs.convert | quote}} # pyright: ignore
12
12
  convert_args = {{envs.convert_args | repr}} # pyright: ignore
@@ -16,7 +16,7 @@ desaturate= {{ envs.desaturate | repr}} # pyright: ignore
16
16
  male_reference= {{ envs.male_reference | repr}} # pyright: ignore
17
17
  no_shift_xy= {{ envs.no_shift_xy | repr}} # pyright: ignore
18
18
  order = {{envs.order | repr}} # pyright: ignore
19
- cases = {{envs.cases | repr}} # pyright: ignore
19
+ cases: dict | None = {{envs.cases | repr}} # pyright: ignore
20
20
 
21
21
 
22
22
  def parse_order(files, orderfile):
@@ -70,7 +70,7 @@ def do_case(name, case):
70
70
  args[""] = [cnvkit, "heatmap"]
71
71
  run_command(dict_to_cli_args(args, dashify=True), fg=True)
72
72
 
73
- conv_args = dict(**conv_args, _=[pdffile, pngfile])
73
+ conv_args: dict = dict(**conv_args, _=[pdffile, pngfile])
74
74
  conv_args[""] = [convert]
75
75
  run_command(
76
76
  dict_to_cli_args(conv_args, dashify=True, prefix="-"),
@@ -1,11 +1,12 @@
1
+ from pathlib import Path
1
2
  from biopipen.utils.misc import run_command, dict_to_cli_args
2
3
 
3
- covfiles = {{in.covfiles | repr}} # pyright: ignore
4
- target_file = {{in.target_file | repr}} # pyright: ignore
5
- antitarget_file = {{in.antitarget_file | repr}} # pyright: ignore
4
+ covfiles = {{in.covfiles | default: [] | each: str | repr}} # pyright: ignore # noqa
5
+ target_file = {{in.target_file | quote: quote_none=False}} # pyright: ignore
6
+ antitarget_file = {{in.antitarget_file | quote: quote_none=False}} # pyright: ignore
6
7
  sample_sex = {{in.sample_sex | repr}} # pyright: ignore
7
8
  outfile = {{out.outfile | quote}} # pyright: ignore
8
- reffile = {{envs.ref | repr}} # pyright: ignore
9
+ reffile: str = {{envs.ref | quote}} # pyright: ignore
9
10
  cnvkit = {{envs.cnvkit | quote}} # pyright: ignore
10
11
  cluster = {{envs.cluster | repr}} # pyright: ignore
11
12
  min_cluster_size = {{envs.min_cluster_size | repr}} # pyright: ignore
@@ -18,7 +19,7 @@ no_rmask = {{envs.no_rmask | repr}} # pyright: ignore
18
19
  def main():
19
20
 
20
21
  args = dict(
21
- f=reffile,
22
+ f=Path(reffile).expanduser(),
22
23
  o=outfile,
23
24
  c=cluster,
24
25
  min_cluster_size=min_cluster_size,
@@ -4,14 +4,14 @@ from diot import Diot
4
4
 
5
5
  from biopipen.utils.misc import run_command, dict_to_cli_args
6
6
 
7
- cnrfile = {{in.cnrfile | quote}} # pyright: ignore
7
+ cnrfile = {{in.cnrfile | quote}} # pyright: ignore # noqa
8
8
  cnsfile = {{in.cnsfile | quote}} # pyright: ignore
9
9
  convert = {{envs.convert | quote}} # pyright: ignore
10
10
  convert_args = {{envs.convert_args | repr}} # pyright: ignore
11
11
  vcf = {{in.vcf | repr}} # pyright: ignore
12
12
  sample_id = {{in.sample_id | repr}} # pyright: ignore
13
13
  normal_id = {{in.normal_id | repr}} # pyright: ignore
14
- outdir = {{out.outdir | quote}} # pyright: ignore
14
+ outdir: str = {{out.outdir | quote}} # pyright: ignore
15
15
  cnvkit = {{envs.cnvkit | quote}} # pyright: ignore
16
16
  chromosome = {{envs.chromosome | repr}} # pyright: ignore
17
17
  gene = {{envs.gene | repr}} # pyright: ignore
@@ -25,7 +25,7 @@ y_min = {{envs.y_min | repr}} # pyright: ignore
25
25
  min_variant_depth = {{envs.min_variant_depth | repr}} # pyright: ignore
26
26
  zygosity_freq = {{envs.zygosity_freq | repr}} # pyright: ignore
27
27
  title = {{envs.title | repr}} # pyright: ignore
28
- cases = {{envs.cases | repr}} # pyright: ignore
28
+ cases: dict | None = {{envs.cases | repr}} # pyright: ignore
29
29
 
30
30
 
31
31
  def do_case(name, case):
@@ -50,7 +50,7 @@ def do_case(name, case):
50
50
  pdffile = Path(outdir).joinpath(f"{name}.heatmap.pdf")
51
51
  pngfile = Path(outdir).joinpath(f"{name}.heatmap.png")
52
52
 
53
- args = dict(
53
+ args: dict = dict(
54
54
  **case,
55
55
  s=cnsfile,
56
56
  o=pdffile,
@@ -62,7 +62,7 @@ def do_case(name, case):
62
62
  args[""] = [cnvkit, "scatter"]
63
63
  run_command(dict_to_cli_args(args, dashify=True), fg=True)
64
64
 
65
- conv_args = dict(**conv_args, _=[pdffile, pngfile])
65
+ conv_args: dict = dict(**conv_args, _=[pdffile, pngfile])
66
66
  conv_args[""] = [convert]
67
67
  run_command(
68
68
  dict_to_cli_args(conv_args, dashify=True, prefix="-"),
@@ -2,11 +2,11 @@ from pathlib import Path
2
2
 
3
3
  from biopipen.utils.misc import run_command, dict_to_cli_args
4
4
 
5
- cnrfile = {{in.cnrfile | quote}} # pyright: ignore
5
+ cnrfile = {{in.cnrfile | quote}} # pyright: ignore # noqa
6
6
  vcf = {{in.vcf | repr}} # pyright: ignore
7
7
  sample_id = {{in.sample_id | repr}} # pyright: ignore
8
8
  normal_id = {{in.normal_id | repr}} # pyright: ignore
9
- outfile = {{out.outfile | quote}} # pyright: ignore
9
+ outfile: str = {{out.outfile | quote}} # pyright: ignore
10
10
  cnvkit = {{envs.cnvkit | quote}} # pyright: ignore
11
11
  method = {{envs.method | quote}} # pyright: ignore
12
12
  threshold = {{envs.threshold | repr}} # pyright: ignore
@@ -21,7 +21,7 @@ zygosity_freq = {{envs.zygosity_freq | repr}} # pyright: ignore
21
21
 
22
22
  def main():
23
23
 
24
- args = dict(
24
+ args: dict = dict(
25
25
  o=outfile,
26
26
  d=Path(outfile).parent / "intermediate.rds",
27
27
  m=method,
@@ -39,8 +39,8 @@ def main():
39
39
  _=cnrfile,
40
40
  )
41
41
  args[""] = [cnvkit, "segment"]
42
- args = dict_to_cli_args(args, dashify=True)
43
- run_command(args, fg=True)
42
+ cmd_args = dict_to_cli_args(args, dashify=True)
43
+ run_command(cmd_args, fg=True)
44
44
 
45
45
 
46
46
  if __name__ == "__main__":