biopipen 0.28.1__py3-none-any.whl → 0.29.0__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.

Potentially problematic release.


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

Files changed (82) hide show
  1. biopipen/__init__.py +1 -1
  2. biopipen/core/config.toml +8 -0
  3. biopipen/ns/bam.py +0 -2
  4. biopipen/ns/bed.py +35 -0
  5. biopipen/ns/cellranger_pipeline.py +5 -5
  6. biopipen/ns/cnv.py +18 -2
  7. biopipen/ns/cnvkit_pipeline.py +16 -11
  8. biopipen/ns/gene.py +68 -23
  9. biopipen/ns/misc.py +2 -15
  10. biopipen/ns/plot.py +146 -0
  11. biopipen/ns/regulation.py +214 -0
  12. biopipen/ns/scrna.py +15 -3
  13. biopipen/ns/snp.py +516 -8
  14. biopipen/ns/stats.py +74 -2
  15. biopipen/ns/vcf.py +196 -0
  16. biopipen/reports/snp/PlinkCallRate.svelte +24 -0
  17. biopipen/reports/snp/PlinkFreq.svelte +18 -0
  18. biopipen/reports/snp/PlinkHWE.svelte +18 -0
  19. biopipen/reports/snp/PlinkHet.svelte +18 -0
  20. biopipen/reports/snp/PlinkIBD.svelte +18 -0
  21. biopipen/scripts/bam/CNVpytor.py +144 -46
  22. biopipen/scripts/bed/BedtoolsIntersect.py +54 -0
  23. biopipen/scripts/bed/BedtoolsMerge.py +1 -1
  24. biopipen/scripts/cnv/AneuploidyScore.R +30 -7
  25. biopipen/scripts/cnv/AneuploidyScoreSummary.R +5 -2
  26. biopipen/scripts/cnv/TMADScore.R +21 -5
  27. biopipen/scripts/cnv/TMADScoreSummary.R +6 -2
  28. biopipen/scripts/cnvkit/CNVkitAccess.py +2 -1
  29. biopipen/scripts/cnvkit/CNVkitAutobin.py +3 -2
  30. biopipen/scripts/cnvkit/CNVkitBatch.py +1 -1
  31. biopipen/scripts/cnvkit/CNVkitCoverage.py +2 -1
  32. biopipen/scripts/cnvkit/CNVkitGuessBaits.py +1 -1
  33. biopipen/scripts/cnvkit/CNVkitHeatmap.py +1 -1
  34. biopipen/scripts/cnvkit/CNVkitReference.py +2 -1
  35. biopipen/scripts/gene/GeneNameConversion.R +65 -0
  36. biopipen/scripts/gene/GenePromoters.R +61 -0
  37. biopipen/scripts/misc/Shell.sh +15 -0
  38. biopipen/scripts/plot/Manhattan.R +140 -0
  39. biopipen/scripts/plot/QQPlot.R +62 -0
  40. biopipen/scripts/regulation/MotifAffinityTest.R +226 -0
  41. biopipen/scripts/regulation/MotifAffinityTest_AtSNP.R +126 -0
  42. biopipen/scripts/regulation/MotifAffinityTest_MotifBreakR.R +96 -0
  43. biopipen/scripts/regulation/MotifScan.py +159 -0
  44. biopipen/scripts/regulation/atSNP.R +33 -0
  45. biopipen/scripts/regulation/motifBreakR.R +1594 -0
  46. biopipen/scripts/scrna/MarkersFinder.R +59 -67
  47. biopipen/scripts/scrna/SeuratClustering.R +63 -29
  48. biopipen/scripts/scrna/SeuratMap2Ref.R +20 -0
  49. biopipen/scripts/scrna/SeuratSubClustering.R +76 -27
  50. biopipen/scripts/snp/MatrixEQTL.R +84 -43
  51. biopipen/scripts/snp/Plink2GTMat.py +133 -0
  52. biopipen/scripts/snp/PlinkCallRate.R +190 -0
  53. biopipen/scripts/snp/PlinkFilter.py +100 -0
  54. biopipen/scripts/snp/PlinkFreq.R +298 -0
  55. biopipen/scripts/snp/PlinkFromVcf.py +78 -0
  56. biopipen/scripts/snp/PlinkHWE.R +80 -0
  57. biopipen/scripts/snp/PlinkHet.R +92 -0
  58. biopipen/scripts/snp/PlinkIBD.R +197 -0
  59. biopipen/scripts/snp/PlinkUpdateName.py +124 -0
  60. biopipen/scripts/stats/MetaPvalue.R +2 -1
  61. biopipen/scripts/stats/MetaPvalue1.R +70 -0
  62. biopipen/scripts/tcr/TCRClusterStats.R +12 -7
  63. biopipen/scripts/vcf/BcftoolsAnnotate.py +91 -0
  64. biopipen/scripts/vcf/BcftoolsFilter.py +90 -0
  65. biopipen/scripts/vcf/BcftoolsSort.py +113 -0
  66. biopipen/scripts/vcf/BcftoolsView.py +73 -0
  67. biopipen/scripts/vcf/VcfFix_utils.py +1 -1
  68. biopipen/scripts/vcf/bcftools_utils.py +52 -0
  69. biopipen/utils/gene.R +83 -37
  70. biopipen/utils/gene.py +108 -60
  71. biopipen/utils/misc.R +56 -0
  72. biopipen/utils/misc.py +5 -2
  73. biopipen/utils/reference.py +54 -10
  74. {biopipen-0.28.1.dist-info → biopipen-0.29.0.dist-info}/METADATA +2 -2
  75. {biopipen-0.28.1.dist-info → biopipen-0.29.0.dist-info}/RECORD +77 -49
  76. {biopipen-0.28.1.dist-info → biopipen-0.29.0.dist-info}/entry_points.txt +1 -1
  77. biopipen/ns/bcftools.py +0 -111
  78. biopipen/scripts/bcftools/BcftoolsAnnotate.py +0 -42
  79. biopipen/scripts/bcftools/BcftoolsFilter.py +0 -79
  80. biopipen/scripts/bcftools/BcftoolsSort.py +0 -19
  81. biopipen/scripts/gene/GeneNameConversion.py +0 -66
  82. {biopipen-0.28.1.dist-info → biopipen-0.29.0.dist-info}/WHEEL +0 -0
biopipen/__init__.py CHANGED
@@ -1 +1 @@
1
- __version__ = "0.28.1"
1
+ __version__ = "0.29.0"
biopipen/core/config.toml CHANGED
@@ -23,12 +23,16 @@ cnvpytor = "cnvpytor"
23
23
  cnvnator2vcf = "cnvnator2VCF.pl"
24
24
  # convert
25
25
  convert = "convert"
26
+ # fimo from meme
27
+ fimo = "fimo"
26
28
  # wget
27
29
  wget = "wget"
28
30
  # aria2c
29
31
  aria2c = "aria2c"
30
32
  # plink
31
33
  plink = "plink"
34
+ # plink2
35
+ plink2 = "plink2"
32
36
  # tabix
33
37
  tabix = "tabix"
34
38
  # sambamba
@@ -86,6 +90,10 @@ genome = ""
86
90
  # Database file for scType
87
91
  # https://github.com/IanevskiAleksandr/sc-type/
88
92
  sctype_db = ""
93
+ # TF Motif database
94
+ tf_motifdb = ""
95
+ # TF motif pairs
96
+ tf_motifs = ""
89
97
 
90
98
  [misc]
91
99
  # Number of cores used for each job
biopipen/ns/bam.py CHANGED
@@ -17,7 +17,6 @@ class CNVpytor(Proc):
17
17
 
18
18
  Envs:
19
19
  cnvpytor: Path to cnvpytor
20
- cnvnator2vcf: Path to CNVnator2VCF.pl to convert the result to VCF file
21
20
  samtools: Path to samtools, used to index bam file in case it's not
22
21
  ncores: Number of cores to use (`-j` for cnvpytor)
23
22
  refdir: The directory containing the fasta file for each chromosome
@@ -41,7 +40,6 @@ class CNVpytor(Proc):
41
40
  lang = config.lang.python
42
41
  envs = {
43
42
  "cnvpytor": config.exe.cnvpytor,
44
- "cnvnator2vcf": config.exe.cnvnator2vcf,
45
43
  "samtools": config.exe.samtools,
46
44
  "ncores": config.misc.ncores,
47
45
  "refdir": config.ref.refdir,
biopipen/ns/bed.py CHANGED
@@ -163,3 +163,38 @@ class BedtoolsMerge(Proc):
163
163
  "bedtools": config.exe.bedtools,
164
164
  }
165
165
  script = "file://../scripts/bed/BedtoolsMerge.py"
166
+
167
+
168
+ class BedtoolsIntersect(Proc):
169
+ """Find the intersection of two BED files, using `bedtools intersect`
170
+
171
+ See <https://bedtools.readthedocs.io/en/latest/content/tools/intersect.html>
172
+
173
+ Input:
174
+ afile: The first BED file
175
+ bfile: The second BED file
176
+
177
+ Output:
178
+ outfile: The output BED file
179
+
180
+ Envs:
181
+ bedtools: The path to bedtools
182
+ sort: Sort `afile` and `bfile` before intersecting.
183
+ By default, `-sorted` is used, assuming the input files are sorted.
184
+ If error occurs, try to set `sort` to `True`.
185
+ chrsize: Alias for `g` in `bedtools intersect`.
186
+ postcmd: The command to be executed for the output file after intersecting.
187
+ You can use `$infile`, `$outfile`, and `$outdir` to refer to the input,
188
+ output, and output directory, respectively.
189
+ <more>: Other options to be passed to `bedtools intersect`
190
+ """ # noqa: E501
191
+ input = "afile:file", "bfile:file"
192
+ output = "outfile:file:{{in.afile | stem0}}_{{in.bfile | stem0}}-intersect.bt"
193
+ lang = config.lang.python
194
+ envs = {
195
+ "bedtools": config.exe.bedtools,
196
+ "sort": False,
197
+ "chrsize": config.ref.chrsize,
198
+ "postcmd": None,
199
+ }
200
+ script = "file://../scripts/bed/BedtoolsIntersect.py"
@@ -7,7 +7,7 @@ from __future__ import annotations
7
7
  from typing import TYPE_CHECKING
8
8
 
9
9
  from diot import Diot
10
- from pipen.utils import mark, is_loading_pipeline
10
+ from pipen.utils import is_loading_pipeline
11
11
  from pipen_args.procgroup import ProcGroup
12
12
 
13
13
  if TYPE_CHECKING:
@@ -20,9 +20,9 @@ class CellRangerCountPipeline(ProcGroup):
20
20
  Run cellranger count for multiple samples and summarize the metrics.
21
21
 
22
22
  Args:
23
- input (type=list): The list of lists of fastq files.
23
+ input (list): The list of lists of fastq files.
24
24
  or the list of comma-separated string of fastq files.
25
- ids (type=list): The list of ids for the samples.
25
+ ids (list): The list of ids for the samples.
26
26
  """
27
27
  DEFAULTS = Diot(input=None, ids=None)
28
28
 
@@ -76,9 +76,9 @@ class CellRangerVdjPipeline(ProcGroup):
76
76
  Run cellranger vdj for multiple samples and summarize the metrics.
77
77
 
78
78
  Args:
79
- input (type=list): The list of lists of fastq files.
79
+ input (list): The list of lists of fastq files.
80
80
  or the list of comma-separated string of fastq files.
81
- ids (type=list): The list of ids for the samples.
81
+ ids (list): The list of ids for the samples.
82
82
  """
83
83
  DEFAULTS = Diot(input=None, ids=None)
84
84
 
biopipen/ns/cnv.py CHANGED
@@ -12,7 +12,15 @@ class AneuploidyScore(Proc):
12
12
 
13
13
  Input:
14
14
  segfile: The seg file, generally including chrom, start, end and
15
- seg.mean (the log2 ratio)
15
+ seg.mean (the log2 ratio).
16
+ It is typically a tab-delimited file or a BED file.
17
+ If so, envs.chrom_col, envs.start_col, envs.end_col and envs.seg_col
18
+ are the 1st, 2nd, 3rd and 5th columns, respectively.
19
+ It can also be a VCF file. If so, envs.chrom_col and envs.start_col
20
+ are not required.
21
+ `end_col` and `envs.seg_col` will be a field in the INFO column.
22
+ [`VariantAnnotation`](https://rdrr.io/bioc/VariantAnnotation/)
23
+ is required to extract the INFO field.
16
24
 
17
25
  Output:
18
26
  outdir: The output directory containing the CAAs, AS and a histogram
@@ -122,7 +130,15 @@ class TMADScore(Proc):
122
130
  Input:
123
131
  segfile: The seg file, two columns are required:
124
132
  * chrom: The chromosome name, used for filtering
125
- * seg.mean: The log2 ratio
133
+ * seg.mean: The log2 ratio.
134
+ It is typically a tab-delimited file or a BED file.
135
+ If so, envs.chrom_col and envs.seg_col
136
+ are the 1st and 5th columns, respectively.
137
+ It can also be a VCF file. If so, envs.chrom_col and envs.start_col
138
+ are not required.
139
+ `end_col` and `envs.seg_col` will be a field in the INFO column.
140
+ [`VariantAnnotation`](https://rdrr.io/bioc/VariantAnnotation/)
141
+ is required to extract the INFO field.
126
142
 
127
143
  Output:
128
144
  outfile: The output file containing the TMAD score
@@ -487,7 +487,8 @@ class CNVkitPipeline(ProcGroup):
487
487
  target_file = None
488
488
  antitarget_file = None
489
489
  if self.col.sex in metadf:
490
- sample_sex = ",".join(metadf[self.col.sex][control_masks])
490
+ all_sex = metadf[self.col.sex][control_masks].unique()
491
+ sample_sex = [None] if len(all_sex) > 1 else all_sex[0]
491
492
  else:
492
493
  sample_sex = [None]
493
494
  else:
@@ -774,13 +775,15 @@ class CNVkitPipeline(ProcGroup):
774
775
  else:
775
776
  tumor_masks = metadf[self.col.group] == self.opts.case
776
777
 
778
+ if self.col.sex in metadf:
779
+ all_sex = metadf[self.col.sex][tumor_masks].unique()
780
+ sample_sex = [None] if len(all_sex) > 1 else all_sex[0]
781
+ else:
782
+ sample_sex = [None]
783
+
777
784
  return tibble(
778
785
  segfiles=[ch2.outfile.tolist()],
779
- sample_sex=(
780
- ",".join(metadf[self.col.sex][tumor_masks])
781
- if self.col.sex in metadf
782
- else [None]
783
- ),
786
+ sample_sex=sample_sex,
784
787
  )
785
788
 
786
789
  @annotate.format_doc(indent=3)
@@ -823,13 +826,15 @@ class CNVkitPipeline(ProcGroup):
823
826
  else:
824
827
  tumor_masks = metadf[self.col.group] == self.opts.case
825
828
 
829
+ if self.col.sex in metadf:
830
+ all_sex = metadf[self.col.sex][tumor_masks].unique()
831
+ sample_sex = [None] if len(all_sex) > 1 else all_sex[0]
832
+ else:
833
+ sample_sex = [None]
834
+
826
835
  return tibble(
827
836
  segfiles=[ch2.outfile.tolist()],
828
- sample_sex=(
829
- ",".join(metadf[self.col.sex][tumor_masks])
830
- if self.col.sex in metadf
831
- else [None]
832
- ),
837
+ sample_sex=sample_sex,
833
838
  )
834
839
 
835
840
  @annotate.format_doc(indent=3)
biopipen/ns/gene.py CHANGED
@@ -9,46 +9,91 @@ class GeneNameConversion(Proc):
9
9
 
10
10
  Input:
11
11
  infile: The input file with original gene names
12
+ It should be a tab-separated file with header
12
13
 
13
14
  Output:
14
15
  outfile: The output file with converted gene names
15
16
 
16
17
  Envs:
17
- inopts: Options to read `in.infile` for `pandas.read_csv()`
18
- See https://pandas.pydata.org/docs/reference/api/pandas.read_csv.html
19
- outopts: Options to write `out.outfile` for `pandas.to_csv()`
20
- See https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.to_csv.html
21
- notfound: What to do if a conversion cannot be done.
22
- use-query: Ignore the conversion and use the original name
23
- skip: Ignore the conversion and skip the entire row in input file
24
- error: Report error
25
- genecol: The index (0-based) or name of the column where
26
- genes are present
27
- output: How to output
28
- keep: Keep the original name column and add new converted columns
29
- drop: Drop the original name column, and add the converted names
30
- replace: Drop the original name column, and insert
31
- the converted names at the original position
32
- only: Only keep the query and the converted name columns
18
+ notfound (choice): What to do if a conversion cannot be done.
19
+ - use-query: Ignore the conversion and use the original name
20
+ - skip: Ignore the conversion and skip the entire row in input file
21
+ - ignore: Same as skip
22
+ - error: Report error
23
+ - na: Use NA
24
+ dup (choice): What to do if a conversion results in multiple names.
25
+ - first: Use the first name, sorted by matching score descendingly (default)
26
+ - last: Use the last name, sorted by matching score descendingly
27
+ - combine: Combine all names using `;` as separator
28
+ genecol: The index (1-based) or name of the column where genes are present
29
+ output (choice): How to output.
30
+ - append: Add the converted names as new columns at the end using `envs.outfmt`
31
+ as the column name.
32
+ - replace: Drop the original name column, and insert
33
+ the converted names at the original position.
34
+ - converted: Only keep the converted names.
35
+ - with-query: Output 2 columns with original and converted names.
33
36
  infmt: What's the original gene name format
34
37
  Available fields
35
38
  https://docs.mygene.info/en/latest/doc/query_service.html#available-fields
36
- outfmt: What's the target gene name format
39
+ outfmt: What's the target gene name format. Currently only a single format
40
+ is supported.
37
41
  species: Limit gene query to certain species.
38
42
  Supported: human, mouse, rat, fruitfly, nematode, zebrafish,
39
43
  thale-cress, frog and pig
40
44
  """ # noqa: E501
41
45
  input = "infile:file"
42
46
  output = "outfile:file:{{in.infile | basename}}"
43
- lang = config.lang.python
47
+ lang = config.lang.rscript
44
48
  envs = {
45
- "inopts": {"sep": "\t", "index_col": False},
46
- "outopts": {"sep": "\t", "index": False},
47
49
  "notfound": "error",
48
- "genecol": 0,
49
- "output": "keep",
50
+ "genecol": 1,
51
+ "dup": "first",
52
+ "output": "append",
50
53
  "infmt": ["symbol", "alias"],
51
54
  "outfmt": "symbol",
52
55
  "species": "human",
53
56
  }
54
- script = "file://../scripts/gene/GeneNameConversion.py"
57
+ script = "file://../scripts/gene/GeneNameConversion.R"
58
+
59
+
60
+ class GenePromoters(Proc):
61
+ """Get gene promoter regions by specifying the flanking regions of TSS
62
+
63
+ Input:
64
+ infile: The input file with gene ids/names
65
+
66
+ Output:
67
+ outfile: The output file with promoter regions in BED format
68
+
69
+ Envs:
70
+ up (type=int): The upstream distance from TSS
71
+ down (type=int): The downstream distance from TSS
72
+ If not specified, the default is `envs.up`
73
+ notfound (choice): What to do if a gene is not found.
74
+ - skip: Skip the gene
75
+ - error: Report error
76
+ refgene: The reference gene annotation file in GTF format
77
+ header (flag): Whether the input file has a header
78
+ genecol (type=int): The index (1-based) of the gene column
79
+ match_id (flag): Should we match the genes in `in.infile` by `gene_id`
80
+ instead of `gene_name` in `envs.refgene`
81
+ sort (flag): Sort the output by chromosome and start position
82
+ chrsize: The chromosome size file, from which the chromosome order is
83
+ used to sort the output
84
+ """
85
+ input = "infile:file"
86
+ output = "outfile:file:{{in.infile | stem}}-promoters.bed"
87
+ lang = config.lang.rscript
88
+ envs = {
89
+ "up": 2000,
90
+ "down": None,
91
+ "notfound": "error",
92
+ "refgene": config.ref.refgene,
93
+ "header": True,
94
+ "genecol": 1,
95
+ "match_id": False,
96
+ "sort": False,
97
+ "chrsize": config.ref.chrsize,
98
+ }
99
+ script = "file://../scripts/gene/GenePromoters.R"
biopipen/ns/misc.py CHANGED
@@ -80,7 +80,7 @@ class Str2File(Proc):
80
80
  name: The name of the output file
81
81
  """
82
82
  input = "str, name"
83
- output = "outfile:file:{{in.name}}"
83
+ output = "outfile:file:{{in.name | default: 'unnamed.txt'}}"
84
84
  lang = config.lang.python
85
85
  envs = {"name": None}
86
86
  script = "file://../scripts/misc/Str2File.py"
@@ -105,17 +105,4 @@ class Shell(Proc):
105
105
  output = "outfile:file:{{in.infile | basename}}"
106
106
  envs = {"cmd": "", "outdir": False}
107
107
  lang = config.lang.bash
108
- script = """
109
- infile={{in.infile | quote}}
110
- outfile={{out.outfile | quote}}
111
- is_outdir={{envs.outdir | int}}
112
- cmd={{envs.cmd | quote}}
113
- if [[ -z "$cmd" ]]; then
114
- echo "No command given." 1>&2
115
- exit 1
116
- fi
117
- if [[ $is_outdir -eq 1 ]]; then
118
- mkdir -p "$outfile"
119
- fi
120
- eval "$cmd"
121
- """
108
+ script = "file://../scripts/misc/Shell.sh"
biopipen/ns/plot.py CHANGED
@@ -150,3 +150,149 @@ class ROC(Proc):
150
150
  "show_auc": True,
151
151
  }
152
152
  script = "file://../scripts/plot/ROC.R"
153
+
154
+
155
+ class Manhattan(Proc):
156
+ """Plot Manhattan plot.
157
+
158
+ Using the [`ggmanh`](https://bioconductor.org/packages/devel/bioc/vignettes/ggmanh/inst/doc/ggmanh.html) package.
159
+ Requires `ggmanh` v1.9.6 or later.
160
+
161
+ Input:
162
+ infile: The input file for data
163
+ It should contain at least three columns, the chromosome, the position
164
+ and the p-value of the SNPs.
165
+ Header is required.
166
+
167
+ Output:
168
+ outfile: The output figure file
169
+
170
+ Envs:
171
+ chrom_col: The column for chromosome
172
+ An integer (1-based) or a string indicating the column name.
173
+ pos_col: The column for position
174
+ An integer (1-based) or a string indicating the column name.
175
+ pval_col: The column for p-value
176
+ An integer (1-based) or a string indicating the column name.
177
+ label_col: The column for label.
178
+ Once specified, the significant SNPs will be labeled on the plot.
179
+ devpars (ns): The parameters for `png()`
180
+ - res (type=int): The resolution
181
+ - width (type=int): The width
182
+ - height (type=int): The height
183
+ title: The title of the plot
184
+ ylabel: The y-axis label
185
+ rescale (flag): Whether to rescale the p-values
186
+ rescale_ratio_threshold (type=float): Threshold of that triggers the rescale
187
+ signif (auto): A single value or a list of values to indicate the significance levels
188
+ Multiple values should be also separated by comma (`,`).
189
+ The minimum value will be used as the cutoff to determine if the SNPs are significant.
190
+ hicolors (auto): The colors for significant and non-significant SNPs
191
+ If a single color is given, the non-significant SNPs will be in grey.
192
+ Set it to None to disable the highlighting.
193
+ thin_n (type=int): Number of max points per horizontal partitions of the plot.
194
+ `0` or `None` to disable thinning.
195
+ thin_bins (type=int): Number of bins to partition the data.
196
+ zoom (auto): Chromosomes to zoom in
197
+ Each chromosome should be separated by comma (`,`) or in a list. Single chromosome is also accepted.
198
+ Ranges are also accepted, see `envs.chroms`.
199
+ Each chromosome will be saved in a separate file.
200
+ zoom_devpars (ns): The parameters for the zoomed plot
201
+ - width (type=int): The width
202
+ - height (type=int): The height, inherited from `devpars` by default
203
+ - res (type=int): The resolution, inherited from `devpars` by default
204
+ chroms (auto): The chromosomes and order to plot
205
+ A hyphen (`-`) can be used to indicate a range.
206
+ For example `chr1-22,chrX,chrY,chrM` will plot all autosomes, X, Y and M.
207
+ if `auto`, only the chromosomes in the data will be plotted in the order
208
+ they appear in the data.
209
+ args (ns): Additional arguments for `manhattan_plot()`.
210
+ See <https://rdrr.io/github/leejs-abv/ggmanh/man/manhattan_plot.html>.
211
+ Note that `-` will be replaced by `.` in the argument names.
212
+ - <more>: Additional arguments for `manhattan_plot()`
213
+ """ # noqa: E501
214
+ input = "infile:file"
215
+ output = "outfile:file:{{in.infile | stem0}}.manhattan.png"
216
+ lang = config.lang.rscript
217
+ envs = {
218
+ "chrom_col": 1,
219
+ "pos_col": 2,
220
+ "pval_col": 3,
221
+ "label_col": None,
222
+ "devpars": {"res": 100, "width": 1000, "height": 500},
223
+ "zoom_devpars": {"width": 500, "height": None, "res": None},
224
+ "title": "Manhattan Plot",
225
+ "ylabel": "-log10(p-value)",
226
+ "rescale": True,
227
+ "rescale_ratio_threshold": 5,
228
+ "signif": [5e-8, 1e-5],
229
+ "hicolors": None,
230
+ "thin_n": None,
231
+ "thin_bins": 200,
232
+ "zoom": None,
233
+ "chroms": "auto",
234
+ "args": {},
235
+ }
236
+ script = "file://../scripts/plot/Manhattan.R"
237
+
238
+
239
+ class QQPlot(Proc):
240
+ """Generate QQ-plot or PP-plot using qqplotr.
241
+
242
+ See <https://cran.r-project.org/web/packages/qqplotr/vignettes/introduction.html>.
243
+
244
+ Input:
245
+ infile: The input file for data
246
+ It should contain at least one column of p-values or the values to be
247
+ plotted. Header is required.
248
+
249
+ Output:
250
+ outfile: The output figure file
251
+
252
+ Envs:
253
+ val_col: The column for values to be plotted
254
+ An integer (1-based) or a string indicating the column name.
255
+ devpars (ns): The parameters for `png()`
256
+ - res (type=int): The resolution
257
+ - width (type=int): The width
258
+ - height (type=int): The height
259
+ xlabel: The x-axis label
260
+ ylabel: The y-axis label
261
+ title: The title of the plot
262
+ trans: The transformation of the values
263
+ You can use `-log10` to transform the values to `-log10(values)`.
264
+ Otherwise you can a direct R function or a custom R function.
265
+ For example `function(x) -log10(x)`.
266
+ kind (choice): The kind of the plot, `qq` or `pp`
267
+ - qq: QQ-plot
268
+ - pp: PP-plot
269
+ band (ns): The arguments for `stat_qq_band()` or `stat_pp_band()`
270
+ See <https://rdrr.io/cran/qqplotr/man/stat_qq_band.html> and
271
+ <https://rdrr.io/cran/qqplotr/man/stat_pp_band.html>.
272
+ - <more>: Additional arguments for `stat_qq_band()` or `stat_pp_band()`
273
+ line (ns): The arguments for `stat_qq_line()` or `stat_pp_line()`
274
+ See <https://rdrr.io/cran/qqplot/man/stat_qq_line.html> and
275
+ <https://rdrr.io/cran/qqplot/man/stat_pp_line.html>.
276
+ - <more>: Additional arguments for `stat_qq_line()` or `stat_pp_line()`
277
+ point (ns): The arguments for `geom_qq_point()` or `geom_pp_point()`
278
+ See <https://rdrr.io/cran/qqplot/man/stat_qq_point.html> and
279
+ <https://rdrr.io/cran/qqplot/man/stat_pp_point.html>.
280
+ ggs (list): Additional ggplot expression to adjust the plot.
281
+ """
282
+ input = "infile:file"
283
+ output = "outfile:file:{{in.infile | stem}}.{{envs.kind}}.png"
284
+ lang = config.lang.rscript
285
+ envs = {
286
+ "val_col": 1,
287
+ "devpars": {"res": 100, "width": 1000, "height": 1000},
288
+ "xlabel": "Theoretical Quantiles",
289
+ "ylabel": "Observed Quantiles",
290
+ "title": "QQ-plot",
291
+ "trans": None,
292
+ "kind": "qq",
293
+ "band": {},
294
+ "line": {},
295
+ "point": {},
296
+ "ggs": None,
297
+ }
298
+ script = "file://../scripts/plot/QQPlot.R"