biopipen 0.21.2__py3-none-any.whl → 0.22.1__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 (62) hide show
  1. biopipen/__init__.py +1 -1
  2. biopipen/core/filters.py +142 -0
  3. biopipen/ns/scrna.py +19 -1
  4. biopipen/ns/tcr.py +30 -10
  5. biopipen/reports/delim/SampleInfo.svelte +2 -22
  6. biopipen/reports/scrna/CellsDistribution.svelte +4 -39
  7. biopipen/reports/scrna/MarkersFinder.svelte +6 -126
  8. biopipen/reports/scrna/MetaMarkers.svelte +3 -75
  9. biopipen/reports/scrna/RadarPlots.svelte +4 -20
  10. biopipen/reports/scrna/ScFGSEA.svelte +4 -23
  11. biopipen/reports/scrna/SeuratClusterStats.svelte +3 -69
  12. biopipen/reports/scrna/SeuratPreparing.svelte +3 -26
  13. biopipen/reports/scrna/TopExpressingGenes.svelte +3 -41
  14. biopipen/reports/scrna_metabolic_landscape/MetabolicFeatures.svelte +17 -16
  15. biopipen/reports/scrna_metabolic_landscape/MetabolicFeaturesIntraSubset.svelte +13 -16
  16. biopipen/reports/scrna_metabolic_landscape/MetabolicPathwayActivity.svelte +44 -52
  17. biopipen/reports/scrna_metabolic_landscape/MetabolicPathwayHeterogeneity.svelte +2 -8
  18. biopipen/reports/tcr/CDR3AAPhyschem.svelte +18 -65
  19. biopipen/reports/tcr/CloneResidency.svelte +3 -93
  20. biopipen/reports/tcr/Immunarch.svelte +4 -168
  21. biopipen/reports/tcr/TCRClusterStats.svelte +3 -45
  22. biopipen/reports/tcr/TESSA.svelte +11 -28
  23. biopipen/scripts/delim/SampleInfo.R +41 -7
  24. biopipen/scripts/scrna/CellsDistribution.R +127 -16
  25. biopipen/scripts/scrna/MarkersFinder.R +245 -100
  26. biopipen/scripts/scrna/MetaMarkers.R +163 -82
  27. biopipen/scripts/scrna/RadarPlots.R +163 -110
  28. biopipen/scripts/scrna/ScFGSEA.R +51 -11
  29. biopipen/scripts/scrna/SeuratClusterStats-dimplots.R +26 -13
  30. biopipen/scripts/scrna/SeuratClusterStats-features.R +58 -53
  31. biopipen/scripts/scrna/SeuratClusterStats-stats.R +39 -21
  32. biopipen/scripts/scrna/SeuratClusterStats.R +4 -2
  33. biopipen/scripts/scrna/SeuratClustering.R +73 -26
  34. biopipen/scripts/scrna/SeuratMetadataMutater.R +13 -1
  35. biopipen/scripts/scrna/SeuratPreparing.R +93 -19
  36. biopipen/scripts/scrna/TopExpressingGenes.R +100 -18
  37. biopipen/scripts/scrna_metabolic_landscape/MetabolicFeatures.R +21 -8
  38. biopipen/scripts/scrna_metabolic_landscape/MetabolicFeaturesIntraSubset.R +25 -3
  39. biopipen/scripts/scrna_metabolic_landscape/MetabolicPathwayActivity.R +1 -0
  40. biopipen/scripts/scrna_metabolic_landscape/MetabolicPathwayHeterogeneity.R +14 -3
  41. biopipen/scripts/tcr/Attach2Seurat.R +2 -1
  42. biopipen/scripts/tcr/CDR3AAPhyschem.R +123 -10
  43. biopipen/scripts/tcr/CloneResidency.R +114 -34
  44. biopipen/scripts/tcr/Immunarch-basic.R +18 -4
  45. biopipen/scripts/tcr/Immunarch-clonality.R +14 -0
  46. biopipen/scripts/tcr/Immunarch-diversity.R +123 -18
  47. biopipen/scripts/tcr/Immunarch-geneusage.R +23 -1
  48. biopipen/scripts/tcr/Immunarch-kmer.R +45 -3
  49. biopipen/scripts/tcr/Immunarch-overlap.R +62 -0
  50. biopipen/scripts/tcr/Immunarch-spectratyping.R +18 -2
  51. biopipen/scripts/tcr/Immunarch-tracking.R +24 -1
  52. biopipen/scripts/tcr/Immunarch-vjjunc.R +17 -2
  53. biopipen/scripts/tcr/Immunarch.R +7 -0
  54. biopipen/scripts/tcr/ImmunarchLoading.R +22 -23
  55. biopipen/scripts/tcr/TCRClusterStats.R +124 -11
  56. biopipen/scripts/tcr/TCRClustering.R +8 -9
  57. biopipen/scripts/tcr/TESSA.R +66 -41
  58. biopipen/utils/misc.R +96 -1
  59. {biopipen-0.21.2.dist-info → biopipen-0.22.1.dist-info}/METADATA +1 -1
  60. {biopipen-0.21.2.dist-info → biopipen-0.22.1.dist-info}/RECORD +62 -62
  61. {biopipen-0.21.2.dist-info → biopipen-0.22.1.dist-info}/WHEEL +0 -0
  62. {biopipen-0.21.2.dist-info → biopipen-0.22.1.dist-info}/entry_points.txt +0 -0
@@ -1,105 +1,15 @@
1
1
  {% from "utils/misc.liq" import report_jobs, table_of_images -%}
2
2
  <script>
3
- import { Image, DataTable } from "$libs";
4
- import { Dropdown } from "$ccs";
3
+ import { Image, DataTable, Descr } from "$libs";
4
+ import { Dropdown, UnorderedList, ListItem } from "$ccs";
5
5
 
6
6
  let count_subject;
7
7
 
8
8
  </script>
9
9
 
10
- {%- macro report_case(casename, h=2) -%}
11
- <h{{h}}>Count table</h{{h}}>
12
- <Dropdown
13
- selectedId="-1"
14
- items={[
15
- { id: "-1", text: "Select a subject" },
16
- {% for i, countfile in job.out.outdir | glob: casename, "counts", "*.txt" | enumerate -%}
17
- { id: "{{i}}", text: "{{countfile | stem}}" },
18
- {% endfor %}
19
- ]}
20
- on:select={({ detail }) => {
21
- count_subject = `{{casename}}-${detail.selectedItem.text}`;
22
- }}
23
- />
24
- {% for countfile in job.out.outdir | glob: casename, "counts", "*.txt" -%}
25
- {#if count_subject == {{ countfile | stem | prepend: casename + '-' | quote }} }
26
- <DataTable src={{
27
- job.out.outdir
28
- | joinpaths: casename, "counts", stem(countfile) + ".txt"
29
- | quote
30
- }} data={ {{
31
- job.out.outdir
32
- | joinpaths: casename, "counts", stem(countfile) + ".txt"
33
- | datatable: sep="\t", nrows=20, index_col=None
34
- }} } />
35
- {/if}
36
- {%- endfor %}
37
-
38
- <h{{h}}>Residency plots</h{{h}}>
39
-
40
- {% if job.out.outdir | joinpaths: casename, "section" | exists %}
41
- {% for groupfile in job.out.outdir | glob: casename, "section", "*.txt" %}
42
- {% set group = groupfile | stem %}
43
- <h{{h+1}}>{{group}}</h{{h+1}}>
44
- {% set scatter_pngs = [] %}
45
- {% for sample in groupfile | readlines %}
46
- {% set spngs = job.out.outdir | glob: casename, "scatter", "scatter_" + sample + "_*.png" %}
47
- {% set _ = scatter_pngs.extend(spngs) %}
48
- {% endfor %}
49
- {{ table_of_images(scatter_pngs, col=3, caps=false) }}
50
- {% endfor %}
51
- {% else %}
52
- {% assign scatter_pngs = job.out.outdir | joinpaths: casename, "scatter", "scatter_*.png" | glob %}
53
- {{ table_of_images(scatter_pngs, col=3, caps=false) }}
54
- {% endif %}
55
-
56
- <h{{h}}>Clonotype overlapping (Venn plots)</h{{h}}>
57
-
58
- {% if job.out.outdir | joinpaths: casename, "section" | exists %}
59
- {% for groupfile in job.out.outdir | glob: casename, "section", "*.txt" %}
60
- {% set group = groupfile | stem %}
61
- <h{{h+1}}>{{group}}</h{{h+1}}>
62
- {% set venn_pngs = [] %}
63
- {% for sample in groupfile | readlines %}
64
- {% set spng = job.out.outdir | glob0: casename, "venn", "venn_" + sample + ".png" %}
65
- {% set _ = venn_pngs.append(spng) %}
66
- {% endfor %}
67
- {{ table_of_images(venn_pngs, col=3) }}
68
- {% endfor %}
69
- {% else %}
70
- {% assign venn_pngs = job.out.outdir | joinpaths: casename, "venn", "*.png" | glob %}
71
- {{ table_of_images(venn_pngs, col=3) }}
72
- {% endif %}
73
-
74
- <h{{h}}>Clonotype overlapping (Upset plots)</h{{h}}>
75
-
76
- {% if job.out.outdir | joinpaths: casename, "section" | exists %}
77
- {% for groupfile in job.out.outdir | glob: casename, "section", "*.txt" %}
78
- {% set group = groupfile | stem %}
79
- <h{{h+1}}>{{group}}</h{{h+1}}>
80
- {% set venn_pngs = [] %}
81
- {% for sample in groupfile | readlines %}
82
- {% set spng = job.out.outdir | glob0: casename, "upset", "upset_" + sample + ".png" %}
83
- {% set _ = venn_pngs.append(spng) %}
84
- {% endfor %}
85
- {{ table_of_images(venn_pngs, col=3) }}
86
- {% endfor %}
87
- {% else %}
88
- {% assign venn_pngs = job.out.outdir | joinpaths: casename, "upset", "*.png" | glob %}
89
- {{ table_of_images(venn_pngs, col=3) }}
90
- {% endif %}
91
- {%- endmacro -%}
92
10
 
93
11
  {%- macro report_job(job, h=1) -%}
94
- {% set casedirs = job.out.outdir | glob: "*" %}
95
- {% if len(casedirs) == 1 %}
96
- {{ report_case(stem(casedirs[0]), h) }}
97
- {% else %}
98
- {% for casedir in casedirs %}
99
- <h{{h}}>{{casedir | stem}}</h{{h}}>
100
- {{ report_case(stem(casedir), h+1) }}
101
- {% endfor %}
102
- {% endif %}
12
+ {{ job | render_job: h=h }}
103
13
  {%- endmacro -%}
104
14
 
105
15
  {%- macro head_job(job) -%}
@@ -1,180 +1,16 @@
1
1
  {% from "utils/misc.liq" import report_jobs, table_of_images -%}
2
2
  <script>
3
- import { Image, DataTable } from "$libs";
4
- import { Tabs, Tab, TabContent, Accordion, AccordionItem } from "$ccs";
3
+ import { Image, DataTable, Descr } from "$libs";
4
+ import { Tabs, Tab, TabContent } from "$ccs";
5
5
  </script>
6
6
 
7
7
  {%- macro report_job(job, h=1) -%}
8
-
9
- <h{{h}}>Exploratory analysis</h{{h}}>
10
-
11
- <h{{h+1}}>CDR3 length distribution</h{{h+1}}>
12
-
13
- {% assign lenpngs = job.out.outdir | glob: "len", "*.png" %}
14
- {{ table_of_images(lenpngs) }}
15
-
16
- <h{{h+1}}>Clonotype volume (# clonotypes)</h{{h+1}}>
17
-
18
- {% assign volpngs = job.out.outdir | glob: "volume", "*.png" %}
19
- {{ table_of_images(volpngs) }}
20
-
21
- <h{{h+1}}>Clonotype abundances</h{{h+1}}>
22
-
23
- {% assign cntpngs = job.out.outdir | glob: "count", "*.png" %}
24
- {{ table_of_images(cntpngs) }}
25
-
26
- <h{{h}}>Clonality</h{{h}}>
27
-
28
- <h{{h+1}}>Top clones</h{{h+1}}>
29
-
30
- {% assign tcpngs = job.out.outdir | glob: "top_clones", "*.png" %}
31
- {{ table_of_images(tcpngs) }}
32
-
33
- <h{{h+1}}>Rare clones</h{{h+1}}>
34
-
35
- {% assign rcpngs = job.out.outdir | glob: "rare_clones", "*.png" %}
36
- {{ table_of_images(rcpngs) }}
37
-
38
- <h{{h+1}}>Clonal space homeostasis</h{{h+1}}>
39
-
40
- <p>The proportion of the repertoire occupied by the clones of a given size</p>
41
-
42
- {% assign hcpngs = job.out.outdir | glob: "homeo_clones", "*.png" %}
43
- {{ table_of_images(hcpngs) }}
44
-
45
- <h{{h}}>Repertoire overlaps</h{{h}}>
46
-
47
- {% if job.index == 0 %}
48
- <Accordion>
49
- <AccordionItem title="Overlapping methods">
50
- <p>
51
- Repertoire overlap is the most common approach to measure repertoire similarity.
52
- Immunarch provides several indices:
53
- </p>
54
- <p>
55
- - number of public clonotypes (.method = "public") - a classic measure of overlap similarity.
56
- </p>
57
- <p>
58
- - overlap coefficient (.method = "overlap") - a normalised measure of overlap
59
- similarity. It is defined as the size of the intersection divided by the smaller of the size of the two sets.
60
- </p>
61
- <p>
62
- - Jaccard index (.method = "jaccard") - it measures similarity between finite
63
- sample sets, and is defined as the size of the intersection divided by the size of the union of the sample sets.
64
- </p>
65
- <p>
66
- - Tversky index (.method = "tversky") - an asymmetric similarity measure on sets
67
- that compares a variant to a prototype. If using default arguments, it’s similar to Dice’s coefficient.
68
- </p>
69
- <p>
70
- - cosine similarity (.method = "cosine") - a measure of similarity between two non-zero vectors
71
- </p>
72
- <p>
73
- - Morisita’s overlap index (.method = "morisita") - a statistical measure of dispersion of individuals in a population.
74
- It is used to compare overlap among samples.
75
- </p>
76
- <p>
77
- - incremental overlap - overlaps of the N most abundant clonotypes with incrementally growing N
78
- (.method = "inc+METHOD", e.g., "inc+public" or "inc+morisita").
79
- </p>
80
- </AccordionItem>
81
- </Accordion>
82
- {% endif %}
83
-
84
- {% for ovdir in job.out.outdir | glob: "overlap", "*" | sort %}
85
- {% set ovname = ovdir | basename %}
86
- <h{{h+1}}>{{ovname}}</h{{h+1}}>
87
- {% assign ovpngs = ovdir | glob: "*.png" | sort %}
88
- {{ table_of_images(ovpngs) }}
89
- {% endfor %}
90
-
91
- <h{{h}}>Gene usage</h{{h}}>
92
- {% for gu_dir in job.out.outdir | glob: "gene_usage", "*" | sort %}
93
- {% set gu_name = gu_dir | basename %}
94
- {% if gu_name != "DEFAULT" %}
95
- <h{{h+1}}>{{gu_name}}</h{{h+1}}>
96
- {% endif %}
97
- {% assign gupngs = gu_dir | glob: "*.png" | sort %}
98
- {{ table_of_images(gupngs) }}
99
- {% endfor %}
100
-
101
- <h{{h}}>Spectratyping</h{{h}}>
102
- {% for spect_sam_dir in job.out.outdir | glob: "spectratyping", "*" | sort %}
103
- <h{{h+1}}>{{ spect_sam_dir | basename }}</h{{h+1}}>
104
- {% assign spectpngs = spect_sam_dir | glob: "*.png" | sort %}
105
- {{ table_of_images(spectpngs) }}
106
- {% endfor %}
107
-
108
- <h{{h}}>Diversity estimation</h{{h}}>
109
- {% assign div_met_dirs = job.out.outdir | glob: "diversity", "*" | sort %}
110
- {% for dm_dir in div_met_dirs %}
111
- <h{{h+1}}>{{dm_dir | basename}}</h{{h+1}}>
112
- {% if dm_dir | glob: "diversity.test.*.txt" %}
113
- {% assign dm_test_file = dm_dir | glob0: "diversity.test.*.txt" %}
114
- {% assign dm_test_method = dm_test_file | stem | replace: "diversity.test.", "" %}
115
- <Tabs>
116
- <Tab label="Plot" />
117
- <Tab label="Test: {{dm_test_method}}" />
118
- <div slot="content">
119
- <TabContent>
120
- <Image src={{ dm_dir | joinpaths: "diversity.png" | quote }} />
121
- </TabContent>
122
- <TabContent>
123
- <DataTable src={{ dm_test_file | quote }} data={ {{ dm_test_file | datatable: sep="\t" }} } />
124
- </TabContent>
125
- </div>
126
- </Tabs>
127
- {% else %}
128
- <Image src={{ dm_dir | joinpaths: "diversity.png" | quote }} />
129
- {% endif %}
130
- {% endfor %}
131
-
132
- {% if job.out.outdir | glob: "rarefraction", "*" %}
133
- <h{{h}}>Rarefaction analysis</h{{h}}>
134
- {% for rfdir in job.out.outdir | glob: "rarefraction", "*" | sort %}
135
- {% assign rfname = rfdir | basename %}
136
- {% if rfname != "DEFAULT" %}
137
- <h{{h+1}}>{{rfname}}</h{{h+1}}>
138
- {% endif %}
139
- {% assign rfpngs = rfdir | glob: "*.png" | sort %}
140
- {{ table_of_images(rfpngs) }}
141
- {% endfor %}
142
- {% endif %}
143
-
144
- {% if job.out.outdir | glob: "tracking", "*.png" %}
145
- <h{{h}}>Tracking of clonotypes</h{{h}}>
146
- {% assign trackpngs = job.out.outdir | glob: "tracking", "*.png" | sort %}
147
- {{ table_of_images(trackpngs) }}
148
- {% endif %}
149
-
150
- <h{{h}}>Kmer and sequence motif analysis</h{{h}}>
151
- {% for kmerdir in job.out.outdir | glob: "kmer", "*" | sort %}
152
- {% assign kmercase = kmerdir | basename %}
153
- {% if kmercase != "DEFAULT" %}
154
- <h{{h+1}}>{{kmercase}}</h{{h+1}}>
155
- {% endif %}
156
- {% assign kmerpngs = kmerdir | glob: "*.png" | sort %}
157
- {{ table_of_images(kmerpngs) }}
158
- {% endfor %}
159
-
160
- <h{{h}}>V-J Junction Circos Plots</h{{h}}>
161
- {% set vjjunc_case_dirs = job.out.outdir | glob: "vj_junc", "*" %}
162
- {% if len(vjjunc_case_dirs) > 1 or basename(vjjunc_case_dirs[0]) != "DEFAULT" %}
163
- {% for vjjunc_case_dir in vjjunc_case_dirs %}
164
- <h{{h+1}}>{{vjjunc_case_dir | basename | escape}}</h{{h+1}}>
165
- {% assign vjjuncpngs = vjjunc_case_dir | glob: "*.png" | sort %}
166
- {{ table_of_images(vjjuncpngs) }}
167
- {% endfor %}
168
- {% else %}
169
- {% assign vjjuncpngs = vjjunc_case_dirs[0] | glob: "*.png" | sort %}
170
- {{ table_of_images(vjjuncpngs) }}
171
- {% endif %}
172
-
8
+ {{ job | render_job: h=h }}
173
9
  {%- endmacro -%}
174
10
 
175
11
 
176
12
  {%- macro head_job(job) -%}
177
- <h1>{{job.out.outdir | stem | replace: ".immunarch", ""}}</h1>
13
+ <h1>{{job.out.outdir | stem | replace: ".immunarch", ""}}</h1>
178
14
  {%- endmacro -%}
179
15
 
180
16
  {{ report_jobs(jobs, head_job, report_job) }}
@@ -1,57 +1,15 @@
1
1
  {% from "utils/misc.liq" import report_jobs -%}
2
2
  <script>
3
- import { Image, DataTable } from "$libs";
3
+ import { Image, DataTable, Descr } from "$libs";
4
4
  import { Tabs, Tab, TabContent } from "$ccs";
5
5
  </script>
6
6
 
7
7
  {%- macro report_job(job, h=1) -%}
8
- <h{{h}}>TCR Cluster size distribution</h{{h}}>
9
-
10
- {% for casedir in job.out.outdir | glob: "ClusterSizeDistribution", "*" %}
11
- {% set casename = casedir | basename %}
12
- {% if casename != "DEFAULT" %}
13
- <h{{h+1}}>{{casename}}</h{{h+1}}>
14
- {% endif %}
15
- <Image src={{casedir | joinpaths: "cluster_size_distribution.png" | quote}} />
16
- {% endfor %}
17
-
18
- <h{{h}}>Shared TCR clusters among samples</h{{h}}>
19
-
20
- {% for casedir in job.out.outdir | glob: "SharedClusters", "*" %}
21
- {% set casename = casedir | basename %}
22
- {% if casename != "DEFAULT" %}
23
- <h{{h+1}}>{{casename}}</h{{h+1}}>
24
- {% endif %}
25
- <Image src={{casedir | joinpaths: "shared_clusters.png" | quote}} />
26
- {% endfor %}
27
-
28
-
29
- <h{{h}}>Sample diversity using TCR clusters</h{{h}}>
30
-
31
- {% for casedir in job.out.outdir | glob: "SampleDiversity", "*" %}
32
- {% set casename = casedir | basename %}
33
- {% if casename != "DEFAULT" %}
34
- <h{{h+1}}>{{casename}}</h{{h+1}}>
35
- {% endif %}
36
-
37
- <Tabs>
38
- <Tab label="Plot" />
39
- <Tab label="Table" />
40
- <svelte:fragment slot="content">
41
- <TabContent>
42
- <Image src={{casedir | joinpaths: "diversity.png" | quote}} />
43
- </TabContent>
44
- <TabContent>
45
- <DataTable src={{casedir | joinpaths: "diversity.txt" | quote}}
46
- data={ {{ casedir | joinpaths: "diversity.txt" | datatable: sep="\t", index_col=0 }} } />
47
- </TabContent>
48
- </svelte:fragment>
49
- </Tabs>
50
- {% endfor %}
8
+ {{ job | render_job: h=h }}
51
9
  {%- endmacro -%}
52
10
 
53
11
  {%- macro head_job(job) -%}
54
- <h1>{{job.in.immfile | stem | replace: ".immunarch", ""}}</h1>
12
+ <h1>{{job.in.immfile | stem | replace: ".immunarch", ""}}</h1>
55
13
  {%- endmacro -%}
56
14
 
57
15
  {{ report_jobs(jobs, head_job, report_job) }}
@@ -1,39 +1,22 @@
1
1
  {% from "utils/misc.liq" import report_jobs, table_of_images -%}
2
2
  <script>
3
- import { Image, DataTable } from "$libs";
4
- import { Tile } from "$ccs";
3
+ import { Image, DataTable, Descr } from "$libs";
4
+ import { UnorderedList, ListItem } from "$ccs";
5
5
  </script>
6
6
 
7
- <Tile>
7
+ <Descr>
8
+ <h1>Introduction</h1>
8
9
  <p><a href="https://github.com/jcao89757/TESSA" target="_blank">Tessa</a> is a Bayesian model to integrate T cell receptor (TCR) sequence profiling with transcriptomes of T cells. Enabled by the recently developed single cell sequencing techniques, which provide both TCR sequences and RNA sequences of each T cell concurrently, Tessa maps the functional landscape of the TCR repertoire, and generates insights into understanding human immune response to diseases. As the first part of tessa, BriseisEncoder is employed prior to the Bayesian algorithm to capture the TCR sequence features and create numerical embeddings. We showed that the reconstructed Atchley Factor matrices and CDR3 sequences, generated through the numerical embeddings, are highly similar to their original counterparts. The CDR3 peptide sequences are constructed via a RandomForest model applied on the reconstructed Atchley Factor matrices.</p>
9
-
10
+ <p></p>
10
11
  <p>For more information, please refer to the following papers:</p>
11
- <ul>
12
- <li>- <a href="https://www.nature.com/articles/s41592-020-01020-3" target="_blank">Mapping the Functional Landscape of TCR Repertoire</a>, Zhang, Z., Xiong, D., Wang, X. et al. 2021.</li>
13
- <li>- <a href="https://www.nature.com/articles/s42256-021-00383-2" target="_blank">Deep learning-based prediction of the T cell receptor–antigen binding specificity</a>, Lu, T., Zhang, Z., Zhu, J. et al. 2021.</li>
14
- </ul>
15
- </Tile>
16
- <p>&nbsp;</p>
12
+ <UnorderedList>
13
+ <ListItem><a href="https://www.nature.com/articles/s41592-020-01020-3" target="_blank">Mapping the Functional Landscape of TCR Repertoire</a>, Zhang, Z., Xiong, D., Wang, X. et al. 2021.</ListItem>
14
+ <ListItem><a href="https://www.nature.com/articles/s42256-021-00383-2" target="_blank">Deep learning-based prediction of the T cell receptor–antigen binding specificity</a>, Lu, T., Zhang, Z., Zhu, J. et al. 2021.</ListItem>
15
+ </UnorderedList>
16
+ </Descr>
17
17
 
18
18
  {%- macro report_job(job, h=1) -%}
19
- {{ table_of_images(
20
- [
21
- joinpaths(job.outdir, "result", "Cluster_size_dist.png"),
22
- joinpaths(job.outdir, "result", "clone_size.png"),
23
- joinpaths(job.outdir, "result", "exp_TCR_pair_plot.png"),
24
- joinpaths(job.outdir, "result", "TCR_dist_density.png"),
25
- joinpaths(job.outdir, "result", "TCR_explore.png"),
26
- joinpaths(job.outdir, "result", "TCR_explore_clusters.png"),
27
- ],
28
- [
29
- "TESSA cluster size distribution",
30
- "Cluster center size vs. non-center cluster size",
31
- "Expression-TCR distance plot",
32
- "Density of TCR distances",
33
- "Exploratory plot at the TCR level",
34
- "TESSA clusters",
35
- ],
36
- ) }}
19
+ {{ job | render_job: h=h }}
37
20
  {%- endmacro -%}
38
21
 
39
22
  {%- macro head_job(job) -%}
@@ -4,7 +4,6 @@ library(rlang)
4
4
  library(dplyr)
5
5
  library(ggplot2)
6
6
  library(ggprism)
7
- library(ggsci)
8
7
  library(ggrepel)
9
8
 
10
9
  infile <- {{in.infile | r}}
@@ -14,6 +13,13 @@ mutaters <- {{envs.mutaters | r}}
14
13
  save_mutated <- {{envs.save_mutated | r}}
15
14
  defaults <- {{envs.defaults | r}}
16
15
  stats <- {{envs.stats | r}}
16
+ exclude_cols <- {{envs.exclude_cols | r}}
17
+
18
+ if (is.null(exclude_cols)) {
19
+ exclude_cols <- c()
20
+ } else {
21
+ exclude_cols <- trimws(unlist(strsplit(exclude_cols, ",")))
22
+ }
17
23
 
18
24
  outdir <- dirname(outfile)
19
25
  indata <- read.delim(infile, sep = sep, header = TRUE, row.names = NULL)
@@ -37,6 +43,20 @@ write.table(
37
43
  col.names = TRUE,
38
44
  quote = FALSE
39
45
  )
46
+ add_report(
47
+ list(
48
+ kind = "descr",
49
+ content = "The samples used in the analysis. Each row is a sample, and columns are the meta information about the sample. This is literally the input sample information file, but the paths to the scRNA-seq and scTCR-seq data are hidden.",
50
+ once = TRUE
51
+ ),
52
+ list(
53
+ kind = "table",
54
+ pageSize = 50,
55
+ data = list(file = outfile, sep = sep, excluded = exclude_cols),
56
+ src = FALSE
57
+ ),
58
+ h1 = "Sample Information"
59
+ )
40
60
 
41
61
  theme_set(theme_prism())
42
62
  for (name in names(stats)) {
@@ -93,14 +113,14 @@ for (name in names(stats)) {
93
113
  if (stat$plot == "boxplot" || stat$plot == "box") {
94
114
  p <- ggplot(data, aes(x=!!group, y=!!sym(stat$on), fill=!!group)) +
95
115
  geom_boxplot(position = "dodge") +
96
- scale_fill_ucscgb(alpha = .8) +
116
+ scale_fill_biopipen() +
97
117
  xlab("")
98
118
  } else if (stat$plot == "violin" ||
99
119
  stat$plot == "violinplot" ||
100
120
  stat$plot == "vlnplot") {
101
121
  p <- ggplot(data, aes(x = !!group, y = !!sym(stat$on), fill=!!group)) +
102
122
  geom_violin(position = "dodge") +
103
- scale_fill_ucscgb(alpha = .8) +
123
+ scale_fill_biopipen() +
104
124
  xlab("")
105
125
  } else if (
106
126
  (grepl("violin", stat$plot) || grepl("vln", stat$plot)) &&
@@ -109,12 +129,12 @@ for (name in names(stats)) {
109
129
  p <- ggplot(data, aes(x = !!group, y = !!sym(stat$on), fill = !!group)) +
110
130
  geom_violin(position = "dodge") +
111
131
  geom_boxplot(width = 0.1, position = position_dodge(0.9), fill="white") +
112
- scale_fill_ucscgb(alpha = .8) +
132
+ scale_fill_biopipen() +
113
133
  xlab("")
114
134
  } else if (stat$plot == "histogram" || stat$plot == "hist") {
115
135
  p <- ggplot(data, aes(x = !!sym(stat$on), fill = !!group)) +
116
136
  geom_histogram(bins = 10, position = "dodge", alpha = 0.8, color = "white") +
117
- scale_fill_ucscgb(alpha = .8)
137
+ scale_fill_biopipen()
118
138
  } else if (stat$plot == "pie" || stat$plot == "piechart") {
119
139
  if (is.null(stat$each)) {
120
140
  data <- data %>% distinct(!!group, .keep_all = TRUE)
@@ -137,7 +157,7 @@ for (name in names(stats)) {
137
157
  fill="#EEEEEE",
138
158
  size=4
139
159
  ) +
140
- scale_fill_ucscgb(alpha = .7, name = group) +
160
+ scale_fill_biopipen(name = group) +
141
161
  ggtitle(paste0("# ", stat$on))
142
162
  } else if (stat$plot == "bar" || stat$plot == "barplot") {
143
163
  if (is.null(stat$each)) {
@@ -149,7 +169,7 @@ for (name in names(stats)) {
149
169
  data,
150
170
  aes(x = !!group, y = !!sym(count_on), fill = !!group)) +
151
171
  geom_bar(stat = "identity") +
152
- scale_fill_ucscgb(alpha = .8) +
172
+ scale_fill_biopipen() +
153
173
  ylab(paste0("# ", stat$on))
154
174
  } else {
155
175
  stop("Unknown plot type: ", stat$plot)
@@ -159,4 +179,18 @@ for (name in names(stats)) {
159
179
  }
160
180
  print(p)
161
181
  dev.off()
182
+
183
+ by_desc <- ifelse(is.null(stat$by), "", paste0(" by ", stat$by))
184
+ descr <- ifelse(
185
+ is_continuous,
186
+ paste0("The distribution of ", stat$on, by_desc),
187
+ paste0("The number of ", stat$on, by_desc)
188
+ )
189
+ add_report(
190
+ list(kind = "table_image", src = plotfile, name = name, descr = descr),
191
+ h1 = "Statistics",
192
+ ui = "table_of_images:2"
193
+ )
162
194
  }
195
+
196
+ save_report(outdir)