diff --git a/src/codecs/jats/__file_snapshots__/06908fc3-73df-1014-bb56-a21daa237ef0.json b/src/codecs/jats/__file_snapshots__/06908fc3-73df-1014-bb56-a21daa237ef0.json index e1e800d03..d881ea539 100644 --- a/src/codecs/jats/__file_snapshots__/06908fc3-73df-1014-bb56-a21daa237ef0.json +++ b/src/codecs/jats/__file_snapshots__/06908fc3-73df-1014-bb56-a21daa237ef0.json @@ -1595,6 +1595,10 @@ "type": "Date", "value": "2015" }, + "isPartOf": { + "type": "Periodical", + "name": "Nature" + }, "title": "Non-adaptive plasticity potentiates rapid adaptive evolution of gene expression in nature" }, { @@ -2552,6 +2556,10 @@ "type": "Date", "value": "2021" }, + "isPartOf": { + "type": "Periodical", + "name": "R package version 1.7.1-1" + }, "title": "emmeans: Estimated Marginal Means, aka Least-Squares Means" }, { @@ -2714,6 +2722,10 @@ "value": "XXXX" } ], + "isPartOf": { + "type": "Periodical", + "name": "bioRxiv" + }, "title": "Variation in mutational (co)variances" }, { @@ -2780,6 +2792,10 @@ "type": "Date", "value": "2019" }, + "isPartOf": { + "type": "Periodical", + "name": "bioRxiv" + }, "pageStart": 778282, "title": "Phenotypic stasis with genetic divergence" }, @@ -3731,6 +3747,10 @@ "value": "10.1101/506865" } ], + "isPartOf": { + "type": "Periodical", + "name": "Ecology Letters, page" + }, "title": "How differing modes of non-genetic inheritance affect population viability in fluctuating environments" }, { @@ -4114,6 +4134,10 @@ "type": "Date", "value": "2018" }, + "isPartOf": { + "type": "Periodical", + "name": "R package version 2.18.2" + }, "title": "RStan: the R interface to Stan" }, { diff --git a/src/codecs/jats/__file_snapshots__/48c60452-6c66-1014-adf9-c7b61873ecd3.json b/src/codecs/jats/__file_snapshots__/48c60452-6c66-1014-adf9-c7b61873ecd3.json index cc71eb354..628e9fbb0 100644 --- a/src/codecs/jats/__file_snapshots__/48c60452-6c66-1014-adf9-c7b61873ecd3.json +++ b/src/codecs/jats/__file_snapshots__/48c60452-6c66-1014-adf9-c7b61873ecd3.json @@ -255,6 +255,10 @@ "type": "Date", "value": "2022" }, + "isPartOf": { + "type": "Periodical", + "name": "Circular Statistics (version 0.4-94)" + }, "title": "R package “circular”" }, { @@ -1934,6 +1938,10 @@ "value": "10.1093/jxb/51.349.1403" } ], + "isPartOf": { + "type": "Periodical", + "name": "J Exp Bot" + }, "title": "Hormonal influence on photocontrol of the protandry in the genus Helianthus" }, { @@ -2851,7 +2859,7 @@ "value": "10.3120/0024-9637-56.3.209" } ], - "title": "Patterson B. 2009. Systematics, Evolution, and Biogeography of Compositae, Madroño. doi:10.3120/0024-9637-56.3.209" + "title": "Systematics, Evolution, and Biogeography of Compositae, Madroño" }, { "type": "Article", diff --git a/src/codecs/jats/__file_snapshots__/8758d58a-6c3d-1014-87a3-bbc202f7d832.json b/src/codecs/jats/__file_snapshots__/8758d58a-6c3d-1014-87a3-bbc202f7d832.json index c596121db..122e05f75 100644 --- a/src/codecs/jats/__file_snapshots__/8758d58a-6c3d-1014-87a3-bbc202f7d832.json +++ b/src/codecs/jats/__file_snapshots__/8758d58a-6c3d-1014-87a3-bbc202f7d832.json @@ -1103,6 +1103,10 @@ "type": "Date", "value": "1988" }, + "isPartOf": { + "type": "PublicationVolume", + "volumeNumber": 8 + }, "title": "T-cell antigen receptor genes and T-cell recognition", "meta": { "label": "9." @@ -5685,11 +5689,7 @@ "value": "10.1146/annurev-immunol-102819-023144" } ], - "isPartOf": { - "type": "Periodical", - "name": "Annu. Rev. Immunol." - }, - "title": "A. C. Hayday, P. Vantourout, Annu. Rev. Immunol., in press, doi:10.1146/annurev-immunol-102819-023144.", + "title": "Annu. Rev. Immunol.", "meta": { "label": "46." } @@ -6651,6 +6651,10 @@ ] } ], + "isPartOf": { + "type": "PublicationVolume", + "volumeNumber": 8 + }, "title": "OLGA: fast computation of generation probabilities of B- and T-cell receptor amino acid sequences and motifs", "meta": { "label": "62." diff --git a/src/codecs/jats/__file_snapshots__/ca7917ff-6cb0-1014-9b19-d05ef1e56b05.json b/src/codecs/jats/__file_snapshots__/ca7917ff-6cb0-1014-9b19-d05ef1e56b05.json index 4c372b6ba..7bbcc7393 100644 --- a/src/codecs/jats/__file_snapshots__/ca7917ff-6cb0-1014-9b19-d05ef1e56b05.json +++ b/src/codecs/jats/__file_snapshots__/ca7917ff-6cb0-1014-9b19-d05ef1e56b05.json @@ -3538,13 +3538,9 @@ }, "isPartOf": { "type": "PublicationVolume", - "isPartOf": { - "type": "Periodical", - "name": "Internal amino acid state modulates yeast taste neurons to support protein homeostasis in Drosophila" - }, "volumeNumber": 29 }, - "title": "Steck K, Walker SJ, Itskov PM, Baltazar C, Moreira J-M, Ribeiro C. 2018. Internal amino acid state modulates yeast taste neurons to support protein homeostasis in Drosophila 29." + "title": "Internal amino acid state modulates yeast taste neurons to support protein homeostasis in Drosophila" }, { "type": "Article", diff --git a/src/codecs/jats/__file_snapshots__/d6f14042-6db3-1014-b228-f9da7cb8e4cc.json b/src/codecs/jats/__file_snapshots__/d6f14042-6db3-1014-b228-f9da7cb8e4cc.json index 3b38811c7..607d61dbf 100644 --- a/src/codecs/jats/__file_snapshots__/d6f14042-6db3-1014-b228-f9da7cb8e4cc.json +++ b/src/codecs/jats/__file_snapshots__/d6f14042-6db3-1014-b228-f9da7cb8e4cc.json @@ -1466,6 +1466,10 @@ "type": "Date", "value": "2021" }, + "isPartOf": { + "type": "Periodical", + "name": "MedRxiv" + }, "title": "Obesity and accelerated epigenetic aging in a high-risk cohort of children", "url": "https://doi.org/10.1101/2021.11.03.21265865" }, @@ -3091,6 +3095,10 @@ "type": "Date", "value": "2021" }, + "isPartOf": { + "type": "Periodical", + "name": "MedRxiv" + }, "title": "BMI is positively associated with accelerated epigenetic aging in twin pairs discordant for BMI", "url": "https://doi.org/10.1101/2021.03.11.21253271" }, diff --git a/src/codecs/jats/__file_snapshots__/e9291f49-6d06-1014-9500-e156797df82e.json b/src/codecs/jats/__file_snapshots__/e9291f49-6d06-1014-9500-e156797df82e.json index b36252fe7..6a08ca6f3 100644 --- a/src/codecs/jats/__file_snapshots__/e9291f49-6d06-1014-9500-e156797df82e.json +++ b/src/codecs/jats/__file_snapshots__/e9291f49-6d06-1014-9500-e156797df82e.json @@ -574,7 +574,7 @@ "type": "Date", "value": "2010" }, - "title": "Andrews, S., 2010. FastQC: a quality control tool for high throughput sequence data." + "title": "FastQC: a quality control tool for high throughput sequence data" }, { "type": "Article", diff --git a/src/codecs/jats/__file_snapshots__/elife-30274-v1.jats.xml b/src/codecs/jats/__file_snapshots__/elife-30274-v1.jats.xml index deafe3e7c..499ab430c 100644 --- a/src/codecs/jats/__file_snapshots__/elife-30274-v1.jats.xml +++ b/src/codecs/jats/__file_snapshots__/elife-30274-v1.jats.xml @@ -1920,6 +1920,7 @@ R: A language and environment for statistical computing 2017 + R Foundation for Statistical Computing diff --git a/src/codecs/jats/__file_snapshots__/elife-30274-v1.yaml b/src/codecs/jats/__file_snapshots__/elife-30274-v1.yaml index 366b22533..b2e3947df 100644 --- a/src/codecs/jats/__file_snapshots__/elife-30274-v1.yaml +++ b/src/codecs/jats/__file_snapshots__/elife-30274-v1.yaml @@ -1837,6 +1837,9 @@ references: datePublished: type: Date value: '2017' + isPartOf: + type: Periodical + name: R Foundation for Statistical Computing title: 'R: A language and environment for statistical computing' - type: Article id: bib26 diff --git a/src/codecs/jats/__file_snapshots__/elife-43154-v2.jats.xml b/src/codecs/jats/__file_snapshots__/elife-43154-v2.jats.xml index a4833f930..89acf716a 100644 --- a/src/codecs/jats/__file_snapshots__/elife-43154-v2.jats.xml +++ b/src/codecs/jats/__file_snapshots__/elife-43154-v2.jats.xml @@ -1573,6 +1573,7 @@ 2019 + GitHub diff --git a/src/codecs/jats/__file_snapshots__/elife-43154-v2.yaml b/src/codecs/jats/__file_snapshots__/elife-43154-v2.yaml index 69f54018b..f08dbda90 100644 --- a/src/codecs/jats/__file_snapshots__/elife-43154-v2.yaml +++ b/src/codecs/jats/__file_snapshots__/elife-43154-v2.yaml @@ -1281,6 +1281,9 @@ references: datePublished: type: Date value: '2019' + isPartOf: + type: Periodical + name: GitHub title: Severe Malaria url: https://github.com/Stije/SevereMalariaAnalysis - type: Article diff --git a/src/codecs/jats/__file_snapshots__/elife-46472-v3.jats.xml b/src/codecs/jats/__file_snapshots__/elife-46472-v3.jats.xml index 8b32fd7cd..87f2a045b 100644 --- a/src/codecs/jats/__file_snapshots__/elife-46472-v3.jats.xml +++ b/src/codecs/jats/__file_snapshots__/elife-46472-v3.jats.xml @@ -4449,6 +4449,7 @@ 2012 + December 12, 2012; Published at US008697359B1 (Awarded) diff --git a/src/codecs/jats/__file_snapshots__/elife-46472-v3.yaml b/src/codecs/jats/__file_snapshots__/elife-46472-v3.yaml index 8f01ccc5e..960b1b5f3 100644 --- a/src/codecs/jats/__file_snapshots__/elife-46472-v3.yaml +++ b/src/codecs/jats/__file_snapshots__/elife-46472-v3.yaml @@ -4559,6 +4559,9 @@ references: datePublished: type: Date value: '2012' + isPartOf: + type: Periodical + name: December 12, 2012; Published at US008697359B1 (Awarded) title: Systems methods and compositions for sequence manipulation url: https://patents.google.com/patent/WO2015089486A3/en title: diff --git a/src/codecs/jats/__file_snapshots__/elife-46793-v1.jats.xml b/src/codecs/jats/__file_snapshots__/elife-46793-v1.jats.xml index a80b15dd9..99062c871 100644 --- a/src/codecs/jats/__file_snapshots__/elife-46793-v1.jats.xml +++ b/src/codecs/jats/__file_snapshots__/elife-46793-v1.jats.xml @@ -3942,6 +3942,7 @@ +  FASTQ/A Short-Reads Pre-Processing Tools Gordon @@ -5121,6 +5122,7 @@ 2019 + GitHub diff --git a/src/codecs/jats/__file_snapshots__/elife-46793-v1.yaml b/src/codecs/jats/__file_snapshots__/elife-46793-v1.yaml index 4deab87df..267ec67b2 100644 --- a/src/codecs/jats/__file_snapshots__/elife-46793-v1.yaml +++ b/src/codecs/jats/__file_snapshots__/elife-46793-v1.yaml @@ -3236,6 +3236,7 @@ references: datePublished: type: Date value: '2010' + title: "\_FASTQ/A Short-Reads Pre-Processing Tools" url: http://hannonlab.cshl.edu/fastx_toolkit/download.html - type: Article id: bib50 @@ -4987,6 +4988,9 @@ references: datePublished: type: Date value: '2019' + isPartOf: + type: Periodical + name: GitHub title: GWscreen_G4sensitivity url: https://github.com/sblab-bioinformatics/GWscreen_G4sensitivity - type: Article diff --git a/src/codecs/jats/__file_snapshots__/elife-52882-v2.jats.xml b/src/codecs/jats/__file_snapshots__/elife-52882-v2.jats.xml index 3699c858d..652170ac7 100644 --- a/src/codecs/jats/__file_snapshots__/elife-52882-v2.jats.xml +++ b/src/codecs/jats/__file_snapshots__/elife-52882-v2.jats.xml @@ -11748,6 +11748,7 @@ 2019 + GitLab @@ -11760,6 +11761,7 @@ 2019 + GitLab diff --git a/src/codecs/jats/__file_snapshots__/elife-52882-v2.yaml b/src/codecs/jats/__file_snapshots__/elife-52882-v2.yaml index 879d883c8..6cccd6274 100644 --- a/src/codecs/jats/__file_snapshots__/elife-52882-v2.yaml +++ b/src/codecs/jats/__file_snapshots__/elife-52882-v2.yaml @@ -1482,6 +1482,9 @@ references: datePublished: type: Date value: '2019' + isPartOf: + type: Periodical + name: GitLab title: Programs closed-loop phototaxis url: https://gitlab.com/Phiasso/programs_closed-loop_phototaxis.git - type: Article @@ -1495,6 +1498,9 @@ references: datePublished: type: Date value: '2019' + isPartOf: + type: Periodical + name: GitLab title: Analysis behavioral phototaxis url: https://gitlab.com/Phiasso/analysis.git - type: Article diff --git a/src/codecs/jats/index.ts b/src/codecs/jats/index.ts index 7cb594b55..f5110b578 100644 --- a/src/codecs/jats/index.ts +++ b/src/codecs/jats/index.ts @@ -1351,35 +1351,46 @@ export function decodeReference( let title: string | undefined let isPartOf: stencila.CreativeWork | undefined - if (publicationType === 'journal' || publicationType === 'preprint') { + let chapterTitle: string | undefined + + // Assign the title based upon the publicationType + if (['journal', 'preprint'].includes(publicationType ?? '')) { title = textOrUndefined(child(elem, 'article-title')) + } else if (['book', 'report'].includes(publicationType ?? '')) { + chapterTitle = textOrUndefined(child(elem, 'chapter-title')) + // Not a chapter so title is + title = chapterTitle ?? textOrUndefined(child(elem, 'source')) + } else { + // e.g. publicationType: 'software', 'web', 'patent' + title = textOrUndefined( + child(elem, ['article-title', 'chapter-title', 'data-title']), + ) + } - const periodicalName = textOrUndefined(child(elem, 'source')) - const volumeNumber = intOrUndefined(child(elem, 'volume')) - const issueNumber = intOrUndefined(child(elem, 'issue')) - if (periodicalName !== undefined) - isPartOf = stencila.periodical({ name: periodicalName }) - if (volumeNumber !== undefined) - isPartOf = stencila.publicationVolume({ volumeNumber, isPartOf }) - if (issueNumber !== undefined) - isPartOf = stencila.publicationIssue({ issueNumber, isPartOf }) - } else if (publicationType === 'book' || publicationType === 'report') { - title = textOrUndefined(child(elem, 'chapter-title')) - if (title !== undefined) { + // Assign isPartOf based upon the publicationType + if (['book', 'report'].includes(publicationType ?? '')) { + if (chapterTitle !== undefined) { // Book or report chapter so try to create a `isPartOf` property const book = textOrUndefined(child(elem, 'source')) if (book !== undefined) { isPartOf = stencila.creativeWork({ name: book }) } + } + } else { + // e.g. publicationType: 'journal', 'preprint', 'software', 'web', 'patent', 'other' + if (title !== undefined) { + const periodicalName = textOrUndefined(child(elem, 'source')) + if (periodicalName !== undefined) + isPartOf = stencila.periodical({ name: periodicalName }) } else { - // Not a chapter so title is title = textOrUndefined(child(elem, 'source')) } - } else { - // e.g. publicationType: 'software', 'web', 'patent' - title = textOrUndefined( - child(elem, ['article-title', 'chapter-title', 'data-title']), - ) + const volumeNumber = intOrUndefined(child(elem, 'volume')) + const issueNumber = intOrUndefined(child(elem, 'issue')) + if (volumeNumber !== undefined) + isPartOf = stencila.publicationVolume({ volumeNumber, isPartOf }) + if (issueNumber !== undefined) + isPartOf = stencila.publicationIssue({ issueNumber, isPartOf }) } // If title is still undefined and elem is a then use @@ -1387,6 +1398,9 @@ export function decodeReference( // Maynard Smith J (1982) Evolution and the Theory of Games. Cambridge University Press. if (title === undefined && elem.name === 'mixed-citation') { title = textOrUndefined(elem) + // Removing authors and isPartOf to reduce duplication + authors = [] + isPartOf = undefined } // Remove any space placeholders diff --git a/src/codecs/jats/jats.test.ts b/src/codecs/jats/jats.test.ts index 9ac7fd414..b46e1e1eb 100644 --- a/src/codecs/jats/jats.test.ts +++ b/src/codecs/jats/jats.test.ts @@ -188,7 +188,44 @@ test.each([ }, pageStart: 21, title: 'Deferasirox-Dependent Iron Chelation Enhances Mitochondrial Dysfunction and Restores p53 Signaling by Stabilization of p53 Family Members in Leukemic Cells', - type: 'Article', + type: 'Article' + }, + ], + [ + ` + + Carabetta VJ, Greco TM, Cristea IM, and Dubnau D (2019). YfmK is a Novel Nε-lysine Acetyltransferase that Directly Acetylates the Histone-like Protein HBsu in Bacillus Subtilis. + + `, + { + authors: [ + { + type: "Person", + familyNames: ["Carabetta"], + givenNames: ["VJ"] + }, + { + type: "Person", + familyNames: ["Greco"], + givenNames: ["TM"] + }, + { + type: "Person", + familyNames: ["Cristea"], + givenNames: ["IM"] + }, + { + type: "Person", + familyNames: ["Dubnau"], + givenNames: ["D"] + } + ], + datePublished: { + type: "Date", + value: "2019" + }, + title: "YfmK is a Novel Nε-lysine Acetyltransferase that Directly Acetylates the Histone-like Protein HBsu in Bacillus Subtilis", + type: "Article" }, ], ])('decode: or element', (input, expected) => {