junidude14 commited on
Commit
ef845d5
·
verified ·
1 Parent(s): 216c798

Archive 4 checkpoints (1-4)

Browse files
.gitattributes CHANGED
@@ -123,3 +123,4 @@ paper-releases/pbisc-diffusion/updates/20261012T011725Z-manuscript-title-abstrac
123
  paper-releases/pbisc-diffusion/updates/20261012T085105Z-introduction-citation-integration/diffusion/dataset/server_1/manuscript/main.pdf filter=lfs diff=lfs merge=lfs -text
124
  paper-releases/pbisc-diffusion/updates/20261012T090327Z-uniform-manuscript-margins/diffusion/dataset/server_1/manuscript/main.pdf filter=lfs diff=lfs merge=lfs -text
125
  paper-releases/pbisc-diffusion/updates/20261012T090327Z-uniform-manuscript-margins/diffusion/dataset/server_1/manuscript/supplementary.pdf filter=lfs diff=lfs merge=lfs -text
 
 
123
  paper-releases/pbisc-diffusion/updates/20261012T085105Z-introduction-citation-integration/diffusion/dataset/server_1/manuscript/main.pdf filter=lfs diff=lfs merge=lfs -text
124
  paper-releases/pbisc-diffusion/updates/20261012T090327Z-uniform-manuscript-margins/diffusion/dataset/server_1/manuscript/main.pdf filter=lfs diff=lfs merge=lfs -text
125
  paper-releases/pbisc-diffusion/updates/20261012T090327Z-uniform-manuscript-margins/diffusion/dataset/server_1/manuscript/supplementary.pdf filter=lfs diff=lfs merge=lfs -text
126
+ paper-releases/pbisc-diffusion/updates/20261012T091446Z-frontmatter-word-export/diffusion/dataset/server_1/manuscript/archive/word_exports/20261012T091054Z/preview/PBISC-Diffusion_Title_Abstract_Introduction_20261012.pdf filter=lfs diff=lfs merge=lfs -text
paper-releases/pbisc-diffusion/updates/20261012T091446Z-frontmatter-word-export/diffusion/dataset/server_1/manuscript/archive/word_exports/20261012T091054Z/EXPORT_RECEIPT.json ADDED
@@ -0,0 +1,172 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "source_commit": "132cfc93c3c14ff6e9c1940f4a3b5e188c5cf512",
3
+ "source_sha256": {
4
+ "main.tex": "30566c34888bb341726d07a6d5ca8112c8e9a9cde0640bc4050490259500a58e",
5
+ "sections/abstract.tex": "72f8f311cc024752022d958161a065aba3f4407da1d7eea8560ddbec87aa1dc0",
6
+ "sections/introduction.tex": "24f61ccc0e5627ce6e4df6ca6bd43c6cd51efc791e52c3badc74c7c4cb833165",
7
+ "references.bib": "9dfd3a17687bd597de37107cf2f6e72fa88c1fabb9e4aeb416bea20fd11f8d79"
8
+ },
9
+ "template_file": "PBISC-Diffusion_Abstract_Introduction.docx",
10
+ "template_sha256": "7bc00dc09a6b93b5add8d9a0f281daef854fd1ecbf89348b2cd151468ee863e6",
11
+ "docx_file": "PBISC-Diffusion_Title_Abstract_Introduction_20261012.docx",
12
+ "docx_sha256": "a9d225233ca0f6ad3f8743fff60ac3253e7ef12368363c13393b82747671e0af",
13
+ "format": {
14
+ "page": "A4",
15
+ "margins_mm": 25.4,
16
+ "font": "Times New Roman",
17
+ "body_pt": 11,
18
+ "body_line_spacing": 1.5,
19
+ "title_pt": 14,
20
+ "heading_pt": 13,
21
+ "reference_pt": 9.5
22
+ },
23
+ "title": "Diffusion model with bulk expression conditioning can generate precise single cell dataset from bulk transcriptome with preserved disease specific gene expression signature",
24
+ "abstract": "Bulk RNA sequencing offers cost-effective, sensitive transcriptome profiling but averages expression across cells, obscuring cellular heterogeneity. Deconvolution methods estimate cell-type composition and expression from the bulk dataset but do not resolve variation within cell types. Generative approaches infer individual cells using various machine learning methods but are constrained by small reference cohorts and there are mismatch between pseudobulk and measured bulk RNA-seq. Here we introduce PBISC, a diffusion model pretrained on over 33 million single cells for generating single-cell RNA profiles conditioned on a sample’s bulk transcriptome. Using paired bulk and single-cell data from minimum five donors, the model adapted to the target bulk sequencing protocol and generates single-cell profiles for the remaining cohort. By repeated sampling from independent Gaussian noise, we were able to produce a synthetic cell population representing the sample’s cellular heterogeneity. Pre-annotated cell types were not used for either training or generation, allowing PBISC to generate rare cell populations without defining them as separate categories in advance. Furthermore, PBISC showed improved preservation of disease-associated expression changes relative to comparator methods in most evaluated settings. Together, these results support extending analyses at single-cell resolution to large cohorts profiled by bulk RNA-seq.",
25
+ "introduction_paragraphs": [
26
+ "Bulk RNA sequencing of blood and tissue remains the most widely used transcriptomic assay in clinical research, including large clinical trials, biobanks and disease cohorts. Each bulk profile, however, is a mixture: changes in cell-type abundance are confounded with changes in cell-state-specific expression, and disease signals carried by minority populations are diluted. Single-cell RNA sequencing resolves these components, but cost and sample logistics still limit it to tens or hundreds of donors per study.",
27
+ "Computational deconvolution has been the principal bridge between the two. Digital cytometry methods such as CIBERSORTx, MuSiC, Bisque, DWLS, Scaden and TAPE estimate cell-type proportions from bulk using single-cell-derived signatures, and BayesPrism, BLADE and bMIND additionally infer cell-type-specific expression. Despite of the highly advanced calculation algorithms, the accuracy of each model’s output highly depends on data transformation, single cell profile reference choice and annotation granularity, degrades for closely related and rare cell types, and changes rank when the reference differs from the bulk cohort. These methods also return proportions or cell-type averages, which cannot represent heterogeneity within a cell type, thus masking many disease-associated states that could be inferred by transcriptomics.",
28
+ "Advances in machine learning have enabled generative approaches to infer single-cell expression profiles from bulk transcriptomes. Bulk2Space and BulkTrajBlend use estimated cell-type composition to guide generation from single-cell reference data, whereas scSemiProfiler adapts profiles from selected cohort representatives using bulk-derived constraints on aggregate expression. However, these approaches remain dependent on selected references, whose coverage and representativeness can influence the inferred cellular landscape. Methods that organize generation around cell types or clusters also depend on how these populations are defined, motivating approaches that do not require cell identities or proportions to be specified in advance.",
29
+ "Diffusion-based methods, including scDiffusion, have expanded the possibilities for generating cellular profiles. However, realistic single-cell generation also requires faithful reproduction of the sparse patterns of zero and nonzero expression observed in experimental data. Sparse Data Diffusion introduced “sparsity bits” to represent these patterns explicitly alongside expression magnitudes, improving the fidelity of sparse data generation in biological and physical datasets. This approach provides a basis for jointly modeling which genes are detected and their expression levels when reconstructing cellular heterogeneity.",
30
+ "A further obstacle is the scarcity of experimentally paired bulk and single-cell measurements. Large single-cell datasets can provide abundant bulk-to-single-cell training sets by aggregating cells into pseudobulk profiles, but these simulated profiles do not fully reproduce the expression distribution of measured bulk RNA-seq. Systematic differences between pseudobulk and measured bulk can therefore limit the transfer of models to experimental data. Learning broadly from available single-cell resources and subsequently adapting to real bulk measurements with a small amount of paired data offers a practical strategy for addressing this limitation.",
31
+ "Here we introduce PBMC Bulk Sample to Immune Single Cells (PBISC), a bulk-conditioned generative model pretrained on pseudobulk–single-cell examples constructed from over 33 million cells across 22 scRNA-seq datasets. This pretraining establishes a shared model of cellular expression across cohorts, reducing reliance on selecting a separate single-cell reference for each target. PBISC incorporates the sparsity-bit concept from Sparse Data Diffusion to jointly model gene-detection patterns and expression levels. It generates cells from independent random initializations under a shared bulk condition, without requiring cell-type annotations or predicted cell-type proportions during training or generation.",
32
+ "To adapt PBISC to measured bulk RNA-seq, we fine-tune the pretrained model using experimentally paired bulk and single-cell profiles, with as few as five paired samples in the evaluated settings. During adaptation, measured bulk profiles serve as conditioning inputs, while observed single-cell profiles from the corresponding biological samples provide the training targets. We then apply the adapted model to generate single-cell profiles for the remaining cohort using bulk measurements alone.",
33
+ "In our evaluations, PBISC reproduced the distributions of paired experimental single-cell profiles, as assessed by precision and coverage. It also preserved disease-associated expression changes more accurately than comparator methods in most evaluated settings. Furthermore, PBISC reproduced literature-defined rare cell populations observed in the single-cell data of the evaluated cohorts, without specifying these populations as separate generation categories. Together, these results support extending analyses of cellular heterogeneity and disease-associated transcriptional programs to large cohorts primarily profiled by bulk RNA-seq."
34
+ ],
35
+ "citations": [
36
+ {
37
+ "number": 1,
38
+ "bibtex_key": "newman2019cibersortx",
39
+ "url": "https://doi.org/10.1038/s41587-019-0114-2"
40
+ },
41
+ {
42
+ "number": 2,
43
+ "bibtex_key": "wang2019music",
44
+ "url": "https://doi.org/10.1038/s41467-018-08023-x"
45
+ },
46
+ {
47
+ "number": 3,
48
+ "bibtex_key": "jew2020bisque",
49
+ "url": "https://doi.org/10.1038/s41467-020-15816-6"
50
+ },
51
+ {
52
+ "number": 4,
53
+ "bibtex_key": "tsoucas2019dwls",
54
+ "url": "https://doi.org/10.1038/s41467-019-10802-z"
55
+ },
56
+ {
57
+ "number": 5,
58
+ "bibtex_key": "menden2020scaden",
59
+ "url": "https://doi.org/10.1126/sciadv.aba2619"
60
+ },
61
+ {
62
+ "number": 6,
63
+ "bibtex_key": "chen2022tape",
64
+ "url": "https://doi.org/10.1038/s41467-022-34550-9"
65
+ },
66
+ {
67
+ "number": 7,
68
+ "bibtex_key": "chu2022bayesprism",
69
+ "url": "https://doi.org/10.1038/s43018-022-00356-3"
70
+ },
71
+ {
72
+ "number": 8,
73
+ "bibtex_key": "barbosa2021blade",
74
+ "url": "https://doi.org/10.1038/s41467-021-26328-2"
75
+ },
76
+ {
77
+ "number": 9,
78
+ "bibtex_key": "wang2021bmind",
79
+ "url": "https://doi.org/10.1101/gr.268722.120"
80
+ },
81
+ {
82
+ "number": 10,
83
+ "bibtex_key": "avilacobos2020benchmarking",
84
+ "url": "https://doi.org/10.1038/s41467-020-19015-1"
85
+ },
86
+ {
87
+ "number": 11,
88
+ "bibtex_key": "sturm2019evaluation",
89
+ "url": "https://doi.org/10.1093/bioinformatics/btz363"
90
+ },
91
+ {
92
+ "number": 12,
93
+ "bibtex_key": "dietrich2026omnideconv",
94
+ "url": "https://doi.org/10.1186/s13059-026-03955-w"
95
+ },
96
+ {
97
+ "number": 13,
98
+ "bibtex_key": "community2024assessment",
99
+ "url": "https://doi.org/10.1038/s41467-024-50618-0"
100
+ },
101
+ {
102
+ "number": 14,
103
+ "bibtex_key": "liao2022bulk2space",
104
+ "url": "https://doi.org/10.1038/s41467-022-34271-z"
105
+ },
106
+ {
107
+ "number": 15,
108
+ "bibtex_key": "zeng2024omicverse",
109
+ "url": "https://doi.org/10.1038/s41467-024-50194-3"
110
+ },
111
+ {
112
+ "number": 16,
113
+ "bibtex_key": "wang2024scsemiprofiler",
114
+ "url": "https://doi.org/10.1038/s41467-024-50150-1"
115
+ },
116
+ {
117
+ "number": 17,
118
+ "bibtex_key": "luo2024scdiffusion",
119
+ "url": "https://doi.org/10.1093/bioinformatics/btae518"
120
+ },
121
+ {
122
+ "number": 18,
123
+ "bibtex_key": "ostheimer2025sparse",
124
+ "url": "https://arxiv.org/abs/2502.02448"
125
+ },
126
+ {
127
+ "number": 19,
128
+ "bibtex_key": "delafuente2025sweetwater",
129
+ "url": "https://doi.org/10.1093/nar/gkaf821"
130
+ },
131
+ {
132
+ "number": 20,
133
+ "bibtex_key": "kynkaanniemi2019improved",
134
+ "url": "https://proceedings.neurips.cc/paper_files/paper/2019/file/0234c510bc6d908b28c70ff313743079-Paper.pdf"
135
+ },
136
+ {
137
+ "number": 21,
138
+ "bibtex_key": "naeem2020reliable",
139
+ "url": "https://proceedings.mlr.press/v119/naeem20a.html"
140
+ },
141
+ {
142
+ "number": 22,
143
+ "bibtex_key": "reyes2020immune",
144
+ "url": "https://doi.org/10.1038/s41591-020-0752-4"
145
+ },
146
+ {
147
+ "number": 23,
148
+ "bibtex_key": "nehar2020mapping",
149
+ "url": "https://doi.org/10.1038/s41590-020-0743-0"
150
+ }
151
+ ],
152
+ "scope": "Current approved title, Abstract, eight Introduction paragraphs and their 23 references; no old draft prose or editorial notes from the formatting example.",
153
+ "structure_verification": {
154
+ "title_match": true,
155
+ "abstract_match": true,
156
+ "introduction_paragraphs_match": 8,
157
+ "references": 23,
158
+ "inline_superscript_links": 29,
159
+ "all_reference_links_match": true,
160
+ "old_editorial_notes_excluded": true
161
+ },
162
+ "render_verification": {
163
+ "engine": "LibreOffice headless",
164
+ "pages": 4,
165
+ "pdf_file": "preview/PBISC-Diffusion_Title_Abstract_Introduction_20261012.pdf",
166
+ "pdf_sha256": "e30e15681bf76d70ae200220ae7a0d97f5e8e7f57f0fceb38149fa1b5f5c459f",
167
+ "pdf_hyperlinks": 52,
168
+ "times_new_roman_fonts_embedded": true,
169
+ "all_text_within_margins": true,
170
+ "visual_review": "Title/Abstract page, Introduction and reference pages checked; no clipping or missing content."
171
+ }
172
+ }
paper-releases/pbisc-diffusion/updates/20261012T091446Z-frontmatter-word-export/diffusion/dataset/server_1/manuscript/archive/word_exports/20261012T091054Z/PBISC-Diffusion_Title_Abstract_Introduction_20261012.docx ADDED
Binary file (42.9 kB). View file
 
paper-releases/pbisc-diffusion/updates/20261012T091446Z-frontmatter-word-export/diffusion/dataset/server_1/manuscript/archive/word_exports/20261012T091054Z/build_word_export.py ADDED
@@ -0,0 +1,244 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Export approved manuscript front matter using the supplied Word visual style."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import hashlib
6
+ import html
7
+ import json
8
+ import re
9
+ import subprocess
10
+ from datetime import datetime, timezone
11
+ from pathlib import Path
12
+
13
+ from docx import Document
14
+ from docx.enum.text import WD_ALIGN_PARAGRAPH
15
+ from docx.oxml import OxmlElement
16
+ from docx.oxml.ns import qn
17
+ from docx.shared import Inches, Mm, Pt, RGBColor
18
+ from docx.opc.constants import RELATIONSHIP_TYPE as RT
19
+ from pylatexenc.latex2text import LatexNodes2Text
20
+
21
+
22
+ ROOT = Path('/home/sj_server_1/PBISC/paper-release-20260928/manuscript')
23
+ OUT = Path(__file__).resolve().parent
24
+ TEMPLATE = Path('/home/sj_server_1/.codex/attachments/03604e6c-f8be-452b-b240-7fdfd5f9dce3/PBISC-Diffusion_Abstract_Introduction.docx')
25
+ OUTPUT = OUT / 'PBISC-Diffusion_Title_Abstract_Introduction_20261012.docx'
26
+ CONVERTER = LatexNodes2Text()
27
+
28
+
29
+ def plain(text: str) -> str:
30
+ converted = CONVERTER.latex_to_text(text)
31
+ return re.sub(r"(?<=\w)'(?=\w)", '’', converted)
32
+
33
+
34
+ def digest(path: Path) -> str:
35
+ return hashlib.sha256(path.read_bytes()).hexdigest()
36
+
37
+
38
+ def font(run, size: float, *, bold: bool = False, color: str = '000000') -> None:
39
+ run.font.name = 'Times New Roman'
40
+ run.font.size = Pt(size)
41
+ run.font.bold = bold
42
+ run.font.color.rgb = RGBColor.from_string(color)
43
+ props = run._element.get_or_add_rPr()
44
+ fonts = props.find(qn('w:rFonts'))
45
+ for name in ('ascii', 'hAnsi', 'eastAsia', 'cs'):
46
+ fonts.set(qn('w:' + name), 'Times New Roman')
47
+
48
+
49
+ def hyperlink(paragraph, text: str, url: str, *, superscript: bool = False, size: float = 11) -> None:
50
+ assert url.startswith('https://'), url
51
+ link = OxmlElement('w:hyperlink')
52
+ link.set(qn('r:id'), paragraph.part.relate_to(url, RT.HYPERLINK, is_external=True))
53
+ run = OxmlElement('w:r')
54
+ props = OxmlElement('w:rPr')
55
+ fonts = OxmlElement('w:rFonts')
56
+ for name in ('ascii', 'hAnsi', 'eastAsia', 'cs'):
57
+ fonts.set(qn('w:' + name), 'Times New Roman')
58
+ props.append(fonts)
59
+ for name, value in [('color', '0563C1'), ('u', 'single'), ('sz', str(int(size * 2)))]:
60
+ element = OxmlElement('w:' + name)
61
+ element.set(qn('w:val'), value)
62
+ props.append(element)
63
+ if superscript:
64
+ element = OxmlElement('w:vertAlign')
65
+ element.set(qn('w:val'), 'superscript')
66
+ props.append(element)
67
+ run.append(props)
68
+ value = OxmlElement('w:t')
69
+ value.text = text
70
+ run.append(value)
71
+ link.append(run)
72
+ paragraph._p.append(link)
73
+
74
+
75
+ def body_paragraph(doc, *, indent: bool = False):
76
+ paragraph = doc.add_paragraph()
77
+ fmt = paragraph.paragraph_format
78
+ fmt.alignment = WD_ALIGN_PARAGRAPH.LEFT
79
+ fmt.line_spacing = 1.5
80
+ fmt.space_before = Pt(0)
81
+ fmt.space_after = Pt(8)
82
+ fmt.first_line_indent = Mm(5) if indent else Pt(0)
83
+ fmt.widow_control = True
84
+ return paragraph
85
+
86
+
87
+ def heading(doc, text: str, *, page_break: bool = False) -> None:
88
+ paragraph = doc.add_paragraph()
89
+ fmt = paragraph.paragraph_format
90
+ fmt.space_before = Pt(18)
91
+ fmt.space_after = Pt(8)
92
+ fmt.line_spacing = 1
93
+ fmt.keep_with_next = True
94
+ fmt.page_break_before = page_break
95
+ font(paragraph.add_run(text), 13, bold=True)
96
+
97
+
98
+ def author_name(author: dict) -> str:
99
+ if 'literal' in author:
100
+ return author['literal']
101
+ family = ' '.join(author.get(k, '') for k in ('non-dropping-particle', 'family')).strip()
102
+ initials = ' '.join(part[0] + '.' for part in re.split(r'[\s-]+', author.get('given', '')) if part)
103
+ return family + (', ' + initials if initials else '')
104
+
105
+
106
+ def reference(entry: dict) -> str:
107
+ authors = entry.get('author', [])
108
+ if len(authors) > 3:
109
+ names = author_name(authors[0]) + ' et al.'
110
+ elif len(authors) == 3:
111
+ names = ', '.join(author_name(a) for a in authors[:2]) + ' & ' + author_name(authors[2])
112
+ else:
113
+ names = ' & '.join(author_name(a) for a in authors)
114
+ names = names.rstrip('.') + '.' if names else ''
115
+ title = html.unescape(re.sub(r'<[^>]+>', '', entry['title'])).rstrip('.')
116
+ year = entry['issued']['date-parts'][0][0]
117
+ journal = entry.get('container-title', '')
118
+ abbreviations = {
119
+ 'Nature Biotechnology': 'Nat. Biotechnol.',
120
+ 'Nature Communications': 'Nat. Commun.',
121
+ 'Nature Cancer': 'Nat. Cancer.',
122
+ 'Nature Medicine': 'Nat. Med.',
123
+ 'Nature Immunology': 'Nat. Immunol.',
124
+ 'Genome Biology': 'Genome Biol.',
125
+ 'Genome Research': 'Genome Res.',
126
+ 'Science Advances': 'Sci. Adv.',
127
+ 'Nucleic Acids Research': 'Nucleic Acids Res.',
128
+ }
129
+ if journal:
130
+ venue = abbreviations.get(journal, journal)
131
+ if entry.get('volume'):
132
+ venue += ' ' + entry['volume']
133
+ if entry.get('page'):
134
+ venue += ', ' + entry['page'].replace('-', '–')
135
+ elif entry['id'] == 'ostheimer2025sparse':
136
+ venue = 'arXiv:2502.02448'
137
+ elif entry['id'] == 'kynkaanniemi2019improved':
138
+ venue = 'Advances in Neural Information Processing Systems 32'
139
+ elif entry['id'] == 'naeem2020reliable':
140
+ venue = 'Proceedings of the 37th International Conference on Machine Learning 119, 7176–7185'
141
+ else:
142
+ venue = html.unescape(re.sub(r'<[^>]+>', '', entry.get('publisher', '')))
143
+ result = f'{names} {title}. {venue} ({year}).'.strip()
144
+ if entry['id'] == 'ostheimer2025sparse':
145
+ result += ' ' + entry['note'].rstrip('.') + '.'
146
+ return result
147
+
148
+
149
+ def main() -> None:
150
+ title = plain(re.search(r'\\title\{([^}]+)\}', (ROOT / 'main.tex').read_text())[1])
151
+ abstract = plain((ROOT / 'sections/abstract.tex').read_text().strip())
152
+ intro = (ROOT / 'sections/introduction.tex').read_text().split(r'\section*{Introduction}', 1)[1].strip()
153
+ paragraphs = intro.split('\n\n')
154
+ assert len(paragraphs) == 8
155
+ entries = json.loads(subprocess.check_output(['pandoc', '-f', 'biblatex', '-t', 'csljson', str(ROOT / 'references.bib')], text=True))
156
+ bibliography = {entry['id']: entry for entry in entries}
157
+ citation_order = list(dict.fromkeys(key for group in re.findall(r'\\cite\{([^}]+)\}', intro) for key in group.split(',')))
158
+ assert len(citation_order) == 23
159
+ numbers = {key: i + 1 for i, key in enumerate(citation_order)}
160
+ urls = {key: bibliography[key].get('URL') or 'https://doi.org/' + bibliography[key]['DOI'] for key in citation_order}
161
+
162
+ doc = Document()
163
+ section = doc.sections[0]
164
+ section.page_width, section.page_height = Mm(210), Mm(297)
165
+ section.top_margin = section.bottom_margin = section.left_margin = section.right_margin = Inches(1)
166
+ section.gutter = Pt(0)
167
+ section.header_distance = section.footer_distance = Mm(12.5)
168
+ normal = doc.styles['Normal']
169
+ normal.font.name = 'Times New Roman'
170
+ normal.font.size = Pt(11)
171
+ normal.paragraph_format.line_spacing = 1.5
172
+ settings = doc.settings.element
173
+ for tag in ('mirrorMargins', 'evenAndOddHeaders'):
174
+ for element in settings.findall(qn('w:' + tag)):
175
+ settings.remove(element)
176
+ doc.core_properties.title = title
177
+ doc.core_properties.subject = 'PBISC — Title, Abstract and Introduction'
178
+ doc.core_properties.author = 'PBISC authors'
179
+ doc.core_properties.last_modified_by = 'PBISC manuscript export'
180
+ doc.core_properties.comments = ''
181
+ doc.core_properties.created = doc.core_properties.modified = datetime.now(timezone.utc)
182
+
183
+ paragraph = doc.add_paragraph()
184
+ paragraph.paragraph_format.space_after = Pt(6)
185
+ paragraph.paragraph_format.line_spacing = 1
186
+ paragraph.paragraph_format.keep_with_next = True
187
+ font(paragraph.add_run(title), 14, bold=True)
188
+ paragraph = doc.add_paragraph()
189
+ paragraph.paragraph_format.space_after = Pt(5)
190
+ paragraph.paragraph_format.line_spacing = 1
191
+ font(paragraph.add_run('PBISC-Diffusion · Title, Abstract and Introduction · 12 October 2026'), 9.5, color='595959')
192
+
193
+ heading(doc, 'Abstract')
194
+ paragraph = body_paragraph(doc)
195
+ paragraph.paragraph_format.space_after = Pt(10)
196
+ font(paragraph.add_run(abstract), 11)
197
+
198
+ heading(doc, 'Introduction', page_break=True)
199
+ expected_intro = []
200
+ for latex in paragraphs:
201
+ paragraph = body_paragraph(doc, indent=True)
202
+ offset = 0
203
+ expected_intro.append(plain(re.sub(r'\\cite\{[^}]+\}', '', latex)))
204
+ for match in re.finditer(r'\\cite\{([^}]+)\}', latex):
205
+ font(paragraph.add_run(plain(latex[offset:match.start()])), 11)
206
+ for index, key in enumerate(match[1].split(',')):
207
+ if index:
208
+ run = paragraph.add_run(',')
209
+ font(run, 11)
210
+ run.font.superscript = True
211
+ hyperlink(paragraph, str(numbers[key]), urls[key], superscript=True)
212
+ offset = match.end()
213
+ font(paragraph.add_run(plain(latex[offset:])), 11)
214
+
215
+ heading(doc, 'References')
216
+ for key in citation_order:
217
+ paragraph = doc.add_paragraph()
218
+ fmt = paragraph.paragraph_format
219
+ fmt.line_spacing = 1
220
+ fmt.space_after = Pt(4.5)
221
+ fmt.left_indent = Pt(21)
222
+ fmt.first_line_indent = Pt(-21)
223
+ fmt.keep_together = True
224
+ font(paragraph.add_run(f'{numbers[key]}. {reference(bibliography[key])} '), 9.5)
225
+ hyperlink(paragraph, urls[key], urls[key], size=9.5)
226
+ doc.save(OUTPUT)
227
+
228
+ source_files = ['main.tex', 'sections/abstract.tex', 'sections/introduction.tex', 'references.bib']
229
+ receipt = {
230
+ 'source_commit': subprocess.check_output(['git', 'rev-parse', 'HEAD'], cwd=ROOT, text=True).strip(),
231
+ 'source_sha256': {name: digest(ROOT / name) for name in source_files},
232
+ 'template_file': TEMPLATE.name, 'template_sha256': digest(TEMPLATE),
233
+ 'docx_file': OUTPUT.name, 'docx_sha256': digest(OUTPUT),
234
+ 'format': {'page': 'A4', 'margins_mm': 25.4, 'font': 'Times New Roman', 'body_pt': 11, 'body_line_spacing': 1.5, 'title_pt': 14, 'heading_pt': 13, 'reference_pt': 9.5},
235
+ 'title': title, 'abstract': abstract, 'introduction_paragraphs': expected_intro,
236
+ 'citations': [{'number': numbers[key], 'bibtex_key': key, 'url': urls[key]} for key in citation_order],
237
+ 'scope': 'Current approved title, Abstract, eight Introduction paragraphs and their 23 references; no old draft prose or editorial notes from the formatting example.',
238
+ }
239
+ (OUT / 'EXPORT_RECEIPT.json').write_text(json.dumps(receipt, indent=2, ensure_ascii=False) + '\n')
240
+ print(OUTPUT)
241
+
242
+
243
+ if __name__ == '__main__':
244
+ main()
paper-releases/pbisc-diffusion/updates/20261012T091446Z-frontmatter-word-export/diffusion/dataset/server_1/manuscript/archive/word_exports/20261012T091054Z/preview/PBISC-Diffusion_Title_Abstract_Introduction_20261012.pdf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e30e15681bf76d70ae200220ae7a0d97f5e8e7f57f0fceb38149fa1b5f5c459f
3
+ size 106121