Skip to content

Commit

Permalink
fix(JATS): Treat <ack> like other <back> elements
Browse files Browse the repository at this point in the history
This change retains the orginal ordering of backmatter sections (previously acks were always first)
and add a `ThematicBreak` before acks (to be consistent with other backmatter sections).

Closes elifesciences/enhanced-preprints-issues#360.
  • Loading branch information
nokome committed Jan 23, 2023
1 parent 3bd4c5d commit cd9dbc6
Show file tree
Hide file tree
Showing 21 changed files with 75 additions and 44 deletions.
1 change: 1 addition & 0 deletions src/codecs/elife/__file_snapshots__/46793.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14982,6 +14982,7 @@ content:
- >-
). The absorbance of the buffer was subtracted from the recorded
spectra.
- type: ThematicBreak
- type: Heading
depth: 1
content:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9444,6 +9444,9 @@
"In our experimental evolution model, ancestral plasticity neither hinders nor facilitates phenotypic divergence of locomotion behavior. The direction of phenotypic divergence in the target environment can be predicted from the ancestral genetic covariances of component traits of locomotion behavior with fitness, even if experimental evolution took place in a gradually changing environment until reaching the target environment, for multiple generations, and there was a large reduction of genetic variation affecting locomotion behaviour. Indirect selection seems to be responsible for the phenotypic divergence of locomotion behavior. Together, these findings indicate that selection theory can be used to predict the direction of short-term adaptive phenotypic evolution."
]
},
{
"type": "ThematicBreak"
},
{
"type": "Heading",
"depth": 1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6867,6 +6867,9 @@
"; LD|25°C (19.5h:4.5h)) entire florets from a single pseudowhorl were dissected from the capitulum and photographed. Organs were then measured with Image J for each floret. For ovary growth measurements, at ZT 2 on after the second day in a given growth condition, entire florets, including ovaries, were dissected from the capitulum along 4-8 continuous parastichies and photographed. Ovary length was then measured with Image J for each floret, consecutively. Position 8 always designated the boundary between pseudowhorls."
]
},
{
"type": "ThematicBreak"
},
{
"type": "Heading",
"depth": 1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10000,6 +10000,9 @@
" List of peptides represented on the chord plot. Related to 4I."
]
},
{
"type": "ThematicBreak"
},
{
"type": "Heading",
"depth": 1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13319,6 +13319,9 @@
"Results are expressed as means ± SEM. Statistical analysis was performed using Sigmaplot (version 14.0, Systat Software) or Igor Pro 8 (Wavemetrics). Results of in vitro experiments were analyzed using Student’s t test (for differences between two groups). Results of in vivo experiments were analyzed using Two Way Repeated Measures ANOVA with Holm-Sidak post-hoc analysis. Differences between groups with P < 0.05 were considered statistically significant. In experiments on mice technical replicates (n) were individual neurons and biological replicates (N) were individual mice. Details on statistical analysis are included in the figure legends. We calculated the sample power for rat behavioral studies with 8 animals per group is needed to show significant differences of 20% or more. The acceptable power level was considered to be between 0.8 and 0.9. For the thermal hyperalgesia test we assumed the mean value for the control population is 7.5 seconds and we want to be able to distinguish a difference of 20% with a common standard deviation of about 10%. To test if the two populations are not equal at a significance level of 0.05, a power of 0.8 gives an n=8. The observed effect size was greater than expected and resulted in significant results with even smaller n. Investigators were blinded to identification of compound components in all studies. In brief, compound doses and vehicles were prepared and dosed on the day of the study by an independent researcher from those conducting the behavioral assessments. All treatment groups were randomized independent of baseline responses and the treatments included vehicle and positive controls were randomized on each day of assessment for blinded observers."
]
},
{
"type": "ThematicBreak"
},
{
"type": "Heading",
"depth": 1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6659,34 +6659,37 @@
]
},
"supplements/468444_file02.pdf Supplemental figures",
{
"type": "ThematicBreak"
},
{
"type": "Heading",
"id": "s5",
"depth": 1,
"content": [
"Acknowledgements"
"Data availability"
]
},
{
"type": "Paragraph",
"content": [
"We thank Celia Lau for the original SEZ diagram models, and members of the Gordon lab for comments on the manuscript. This work was funded by Natural Sciences and Engineering Research Council (NSERC) grants RGPIN-2016–03857 and RGPAS 492846–16."
"All data are available in the manuscript and Supplementary Information, or are available upon request from the corresponding author."
]
},
{
"type": "ThematicBreak"
},
{
"type": "Heading",
"id": "s5",
"depth": 1,
"content": [
"Data availability"
"Acknowledgements"
]
},
{
"type": "Paragraph",
"content": [
"All data are available in the manuscript and Supplementary Information, or are available upon request from the corresponding author."
"We thank Celia Lau for the original SEZ diagram models, and members of the Gordon lab for comments on the manuscript. This work was funded by Natural Sciences and Engineering Research Council (NSERC) grants RGPIN-2016–03857 and RGPAS 492846–16."
]
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10242,6 +10242,9 @@
" were downloaded from the GEO and used for GSEA and over-representation enrichment analysis as mentioned previously."
]
},
{
"type": "ThematicBreak"
},
{
"type": "Heading",
"depth": 1,
Expand Down
1 change: 1 addition & 0 deletions src/codecs/jats/__file_snapshots__/elife-30274-v1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5196,6 +5196,7 @@ content:
- type: Paragraph
content:
- "The number of flasks, and thus cells, was increased when tetracycline was added to P493-6 cells to account for the cells not proliferating during this period (i.e. there were two Flask B’s as described in the Registered Report, which were pooled prior to seeding). The proposed statistical analysis for the western blot analysis (Protocol 1) described in the Registered Report was not performed since the levels of normalized c-Myc at time 0 hr was at the limit of detection. The number of genes analyzed in the original study, and thus listed in the Registered Report, was reported incorrectly as 1388 instead of 1338 (data shared by original authors). NanoString analysis was conducted using the nCounter RCC Collector Worksheet instead of nSolver Analysis software. Additionally, the statistical tests reported in\_Figure\_3F of the original study incorrectly described the comparisons as between 0 hr and 1 hr instead of between 0 hr and 24 hr (scripts shared by original authors). The corrected values are described above for comparisons and used in the meta-analysis. Additional materials and instrumentation not listed in the Registered Report, but needed during experimentation are also listed."
- type: ThematicBreak
- type: Heading
depth: 1
content:
Expand Down
1 change: 1 addition & 0 deletions src/codecs/jats/__file_snapshots__/elife-46472-v3.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9497,6 +9497,7 @@ content:
content:
- Reed et al., 2018
- ).
- type: ThematicBreak
- type: Heading
depth: 1
content:
Expand Down
1 change: 1 addition & 0 deletions src/codecs/jats/__file_snapshots__/elife-46793-v1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14982,6 +14982,7 @@ content:
- >-
). The absorbance of the buffer was subtracted from the recorded
spectra.
- type: ThematicBreak
- type: Heading
depth: 1
content:
Expand Down
1 change: 1 addition & 0 deletions src/codecs/jats/__file_snapshots__/elife-52882-v2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6108,6 +6108,7 @@ content:
content:
- Figure 3H–I
- ).
- type: ThematicBreak
- type: Heading
depth: 1
content:
Expand Down
1 change: 1 addition & 0 deletions src/codecs/jats/__file_snapshots__/f1000-8-1394-v1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3582,6 +3582,7 @@ content:
content:
- Creative Commons Zero “No rights reserved” data waiver
- ' (CC0 1.0 Public domain dedication).'
- type: ThematicBreak
- type: Heading
depth: 1
content:
Expand Down
1 change: 1 addition & 0 deletions src/codecs/jats/__file_snapshots__/f1000-8-978-v1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3313,6 +3313,7 @@ content:
content:
- Creative Commons Attribution 4.0 International license
- ' (CC-BY 4.0).'
- type: ThematicBreak
- type: Heading
depth: 1
content:
Expand Down
1 change: 1 addition & 0 deletions src/codecs/jats/__file_snapshots__/plosone-0091296.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5103,6 +5103,7 @@ content:
content:
- '[34]'
- .
- type: ThematicBreak
- type: Heading
depth: 1
content:
Expand Down
1 change: 1 addition & 0 deletions src/codecs/jats/__file_snapshots__/plosone-0178565.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4712,6 +4712,7 @@ content:
List of co-evolving genes.Column A describes the cluster number. Column B to
D describes various identifiers and attributes of the genes used. Column E
denotes the GCI.(XLSX)
- type: ThematicBreak
- type: Heading
depth: 1
content:
Expand Down
77 changes: 38 additions & 39 deletions src/codecs/jats/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1144,45 +1144,27 @@ function decodeBack(

const references = decodeReferences(first(elem, 'ref-list'))

const ack = decodeAck(first(elem, 'ack'), state) ?? []
const sections = decodeBackSecs(
elem.elements?.filter((elem) => elem.name === 'sec') ?? [],
elem.elements?.filter(
(elem) => elem.name === 'ack' || elem.name === 'sec'
) ?? [],
state
)

return { references, content: [...ack, ...sections] }
return { references, content: sections }
}

/**
* Decode a JATS `<ack>` element to a Stencila `BlockContent`
* including a `Acknowledgements` heading
*
* Any existing <title> (e.g. ACKNOW... all caps) or <label> (e.g. numeric section number) elements are ignored.
*/
function decodeAck(
elem: xml.Element | null,
state: DecodeState
): stencila.BlockContent[] | undefined {
if (elem === null) return undefined

const filtered = (elem.elements ?? []).filter(
(elem) => elem.name !== 'title' && elem.name !== 'label'
)
const blocks = ensureBlockContentArray(decodeElements(filtered, state))
return [
stencila.heading({ depth: 1, content: ['Acknowledgements'] }),
...blocks,
]
}

/**
* Decode a JATS `<back> <sec>` element to a Stencila `BlockContent`
* Decode JATS <back> <ack> or <sec> elements to Stencila `BlockContent`s
*
* Backmatter sections are used for a variety of purposes included supplementary figures
* and data availability statements. No attempt is made to differentiate between these and unlike with <ack>
* the sections are mostly decoded verbatim.
*
* The <title> is treated as the h1 for the section.
* For <ack> elements, any existing <title> (e.g. ACKNOW... all caps) or <label> (e.g. numeric section number)
* elements are ignored and a h1 with 'Acknowledgements' is inserted
*
* For <sec> elements, any <title> is treated as the h1 for the section.
* Any other heading in the section are dropped if they have the same content
* as the title (otherwise there can be duplication).
*/
Expand All @@ -1191,20 +1173,37 @@ function decodeBackSecs(
state: DecodeState
): stencila.BlockContent[] {
return elems.reduce((prev: stencila.BlockContent[], elem) => {
const blocks = decodeElement(elem, state) as stencila.BlockContent[]
const node = blocks[0]
if (blocks.length === 1 && node?.type === 'Heading') {
const alreadyExists =
prev.findIndex(
(existing) =>
existing.type === 'Heading' &&
existing.content[0] === node.content[0]
) >= 0
if (alreadyExists) {
return prev
if (elem.name == 'ack') {
const filtered = (elem.elements ?? []).filter(
(elem) => elem.name !== 'title' && elem.name !== 'label'
)

const blocks = ensureBlockContentArray(decodeElements(filtered, state))

return [
...prev,
stencila.thematicBreak(),
stencila.heading({ depth: 1, content: ['Acknowledgements'] }),
...blocks,
]
} else {
const blocks = decodeElement(elem, state) as stencila.BlockContent[]

const node = blocks[0]
if (blocks.length === 1 && node?.type === 'Heading') {
const alreadyExists =
prev.findIndex(
(existing) =>
existing.type === 'Heading' &&
existing.content[0] === node.content[0]
) >= 0
if (alreadyExists) {
return prev
}
}

return [...prev, stencila.thematicBreak(), ...blocks]
}
return [...prev, stencila.thematicBreak(), ...blocks]
}, [])
}

Expand Down
1 change: 1 addition & 0 deletions src/codecs/plos/__file_snapshots__/pbio-3000349.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4393,6 +4393,7 @@ content:
was higher in Group 1 than in Group 2. CBP, chronic back pain.(PDF)
- Details of statistical tests for results shown in Figs 1–6.(PDF)
- Data underlying figures.(XLSX)
- type: ThematicBreak
- type: Heading
depth: 1
content:
Expand Down
1 change: 1 addition & 0 deletions src/codecs/plos/__file_snapshots__/pgen-1008133.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6224,6 +6224,7 @@ content:
corresponding transgenic RNAi lines used for the screen.(PDF)
- Signaling pathways affected in RACS-expressing cells.(PDF)
- List of primers used in this study.(PDF)
- type: ThematicBreak
- type: Heading
depth: 1
content:
Expand Down
1 change: 1 addition & 0 deletions src/codecs/plos/__file_snapshots__/pmed-1002858.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4591,6 +4591,7 @@ content:
Inclusion criteria for the studies used in the pooled data analysis.HCT,
haematocrit; SB, serum bilirubin; SBP, systolic blood pressure; SC, serum
creatinine; UO, urine output.(XLSX)
- type: ThematicBreak
- type: Heading
depth: 1
content:
Expand Down
1 change: 1 addition & 0 deletions src/codecs/plos/__file_snapshots__/pone-0216012.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13643,6 +13643,7 @@ content:
results obtained on the model validation, it would be important to
perform a sensitivity analysis on the paramater space to better assess
the robustness of the model and direct its future extensions.
- type: ThematicBreak
- type: Heading
depth: 1
content:
Expand Down
1 change: 1 addition & 0 deletions src/codecs/plos/__file_snapshots__/ppat-1007958.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5472,6 +5472,7 @@ content:
antibody (red). Scale bar: 10 μm. (C) The mRNA levels were determined b
RT-qPCR. Error bars represent the standard deviation.(TIF)
- Materials and methods.(DOCX)
- type: ThematicBreak
- type: Heading
depth: 1
content:
Expand Down

0 comments on commit cd9dbc6

Please sign in to comment.