Skip to content

Commit 8fa20d4

Browse files
authored
fix: handle duplicate properties in imported files (#1065)
1 parent e09effa commit 8fa20d4

File tree

4 files changed

+144
-24
lines changed

4 files changed

+144
-24
lines changed

compose/neurosynth-frontend/cypress/e2e/workflows/Curation/ImportStudiesDialog.cy.tsx

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/// <reference types="cypress" />
2+
import { expect } from 'chai';
23

34
describe('ImportStudiesDialog', () => {
45
beforeEach(() => {
@@ -225,10 +226,32 @@ describe('ImportStudiesDialog', () => {
225226
cy.contains('button', 'next').should('be.visible');
226227
});
227228

228-
// TODO : create a test for importing bibtex file
229-
// it('should import studies via a file', () => {})
229+
it('should upload a .RIS file and import successfully', () => {
230+
cy.get('input[role="combobox"]').click();
231+
cy.contains('li', 'Scopus').click();
232+
cy.get('label[role="button"]').selectFile('cypress/fixtures/standardFiles/ris.ris');
233+
cy.contains('button', 'next').should('be.visible').and('not.be.disabled');
234+
cy.contains('button', 'next').click();
235+
});
230236

231-
// TODO : create a test for importing RIS file
237+
it('should handle the duplicates in an import file', () => {
238+
cy.get('input[role="combobox"]').click();
239+
cy.contains('li', 'Scopus').click();
240+
cy.get('label[role="button"]').selectFile('cypress/fixtures/standardFiles/duplicates.ris');
241+
cy.contains('button', 'next').should('be.visible').and('not.be.disabled');
242+
cy.contains('button', 'next').click();
243+
cy.contains('Click to view 1 imported studies').click();
244+
cy.contains('(2023). Manifold Learning for fMRI time-varying FC').should(
245+
// doing this to enforce strict equals
246+
($el: JQuery<HTMLElement> | undefined) => {
247+
if (!$el) throw new Error('Could not find element');
248+
expect($el.text()).to.equal('(2023). Manifold Learning for fMRI time-varying FC');
249+
}
250+
);
251+
cy.contains(/^\bbioRxiv\b/).should('exist'); // \b is a word boundary which means there shouldnt be any other letters/words before and after
252+
});
253+
254+
// TODO : create a test for importing bibtex file
232255
// it('should import studies via a file', () => {})
233256
});
234257

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
TY - JOUR
2+
T1 - Manifold Learning for fMRI time-varying FC
3+
T1 - DUPLICATE TITLE!!!
4+
JF - bioRxiv
5+
JF - DUPLICATE JOURNAL!
6+
DO - 10.1101/2023.01.14.523992
7+
SP - 2023.01.14.523992
8+
SP - DUPLICATE DATE!
9+
AU - Gonzalez-Castillo, Javier
10+
AU - Smith, Michael
11+
Y1 - 2023/01/01
12+
Y1 - DUPLICATE OTHER DATE!
13+
UR - http://biorxiv.org/content/early/2023/01/16/2023.01.14.523992.abstract
14+
UR - DUPLICATE LINK!
15+
N2 - Whole-brain functional connectivity (FC) measured with functional MRI (fMRI) evolve over time in meaningful ways at temporal scales going from years (e.g., development) to seconds (e.g., within-scan time-varying FC (tvFC)). Yet, our ability to explore tvFC is severely constrained by its large dimensionality (several thousands). To overcome this difficulty, researchers seek to generate low dimensional representations (e.g., 2D and 3D scatter plots) expected to retain its most informative aspects (e.g., relationships to behavior, disease progression). Limited prior empirical work suggests that manifold learning techniques (MLTs)—namely those seeking to infer a low dimensional non-linear surface (i.e., the manifold) where most of the data lies—are good candidates for accomplishing this task. Here we explore this possibility in detail. First, we discuss why one should expect tvFC data to lie on a low dimensional manifold. Second, we estimate what is the intrinsic dimension (i.e., minimum number of latent dimensions; ID) of tvFC data manifolds. Third, we describe the inner workings of three state-of-the-art MLTs: Laplacian Eigenmaps (LE), T-distributed Stochastic Neighbor Embedding (T-SNE), and Uniform Manifold Approximation and Projection (UMAP). For each method, we empirically evaluate its ability to generate neuro-biologically meaningful representations of tvFC data, as well as their robustness against hyper-parameter selection. Our results show that tvFC data has an ID that ranges between 4 and 26, and that ID varies significantly between rest and task states. We also show how all three methods can effectively capture subject identity and task being performed: UMAP and T-SNE can capture these two levels of detail concurrently, but LE could only capture one at a time. We observed substantial variability in embedding quality across MLTs, and within-MLT as a function of hyper-parameter selection. To help alleviate this issue, we provide heuristics that can inform future studies. Finally, we also demonstrate the importance of feature normalization when combining data across subjects and the role that temporal autocorrelation plays in the application of MLTs to tvFC data. Overall, we conclude that while MLTs can be useful to generate summary views of labeled tvFC data, their application to unlabeled data such as resting-state remains challenging.Competing Interest StatementThe authors have declared no competing interest.
16+
N2 - DUPLICATE ABSTRACT!
17+
ER -
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
TY - JOUR
2+
T1 - Distinct neurochemical influences on fMRI response polarity in the striatum
3+
JF - bioRxiv
4+
DO - 10.1101/2023.02.20.529283
5+
SP - 2023.02.20.529283
6+
AU - Cerri, Domenic H.
7+
AU - Albaugh, Daniel L.
8+
AU - Walton, Lindsay R.
9+
AU - Katz, Brittany
10+
AU - Wang, Tzu-Wen
11+
AU - Chao, Tzu-Hao Harry
12+
AU - Zhang, Weiting
13+
AU - Nonneman, Randal J.
14+
AU - Jiang, Jing
15+
AU - Lee, Sung-Ho
16+
AU - Etkin, Amit
17+
AU - Hall, Catherine N.
18+
AU - Stuber, Garret D.
19+
AU - Shih, Yen-Yu Ian
20+
Y1 - 2023/01/01
21+
UR - http://biorxiv.org/content/early/2023/02/21/2023.02.20.529283.abstract
22+
N2 - The striatum is the primary input nucleus of the basal ganglia, widely studied for its complex roles in health and disease. Functional magnetic resonance imaging (fMRI) studies are essential for discerning striatal function, however the relationship between neuronal and hemodynamic activity, critical for interpreting fMRI signals, has not been rigorously examined in striatum. We find that optogenetic stimulation of striatal neurons or afferents evokes negative striatal fMRI responses in rats that can occur despite broad increases in local neuronal activity. Intra-striatal pharmacological manipulations suggest that opioidergic, but not dopaminergic transmission contributes to negative striatal fMRI signals (the latter instead associated with positive signals). Striatal neuronal activity peaks are also associated with negative hemodynamic signals in behaving rats. Negative fMRI responses are observed in human striatum under conditions of anticipated neuronal activity increases. Our results prompt consideration of local cellular and neurochemical environments along with neuronal activity in fMRI signal interpretation.Competing Interest StatementThe authors have declared no competing interest.
23+
ER -
24+
25+
TY - JOUR
26+
T1 - A systematically optimized awake mouse fMRI paradigm
27+
JF - bioRxiv
28+
DO - 10.1101/2022.11.16.516376
29+
SP - 2022.11.16.516376
30+
AU - Xu, Wenjing
31+
AU - Pei, Mengchao
32+
AU - Zhang, Kaiwei
33+
AU - Tong, Chuanjun
34+
AU - Bo, Binshi
35+
AU - Feng, Jianfeng
36+
AU - Zhang, Xiao-Yong
37+
AU - Liang, Zhifeng
38+
Y1 - 2022/01/01
39+
UR - http://biorxiv.org/content/early/2022/11/16/2022.11.16.516376.abstract
40+
N2 - Functional magnetic resonance imaging (fMRI) has been increasingly utilized in mice. Due to the non-negligible effects of anesthetics on mouse fMRI, it is becoming more common to perform fMRI in the awake mice. However, high stress level and head motion in awake mouse fMRI remain to be fully addressed, which limits its practical applications. Therefore, here we presented a systematically optimized awake mouse fMRI paradigm as a practical and open-source solution. First, we designed a soundproof habituation chamber in which multiple mice can be habituated simultaneously and independently. Then, combining corticosterone, body weight and behavioral measurements, we systematically evaluated the potential factors that may contribute to animals’ stress level for awake imaging. Among many factors, we found that the restraining setup allowing forelimbs freely moving and head tilted at 30-degree was optimal for minimizing stress level. Importantly, we implemented multiband simultaneous multi-slice imaging to enable ultrafast fMRI acquisition in awake mice. Compared to conventional single-band EPI, faster acquisition enabled by multiband imaging were more robust to head motion and yielded higher statistical power. Thus, more robust resting-state functional connectivity was detected using multiband acquisition in awake mouse fMRI, compared to conventional single-band acquisition. In conclusion, we presented an awake mouse fMRI paradigm that is highly optimized in both awake mice habituation and fMRI acquisition, and such paradigm minimized animals’ stress level and provided more resistance to head motion and higher statistical power.Competing Interest StatementThe authors have declared no competing interest.
41+
ER -
42+
43+
TY - JOUR
44+
T1 - Real-time feedback reduces participant motion during task-based fMRI
45+
JF - bioRxiv
46+
DO - 10.1101/2023.01.12.523791
47+
SP - 2023.01.12.523791
48+
AU - Rogers, Chad S.
49+
AU - Jones, Michael S.
50+
AU - McConkey, Sarah
51+
AU - McLaughlin, Drew J.
52+
AU - Peelle, Jonathan E.
53+
Y1 - 2023/01/01
54+
UR - http://biorxiv.org/content/early/2023/01/24/2023.01.12.523791.abstract
55+
N2 - The potential negative impact of head movement during fMRI has long been appreciated. Although a variety of prospective and retrospective approaches have been developed to help mitigate these effects, reducing head movement in the first place remains the most appealing strategy for optimizing data quality. Real-time interventions, in which participants are provided feedback regarding their scan-to-scan motion, have recently shown promise in reducing motion during resting state fMRI. However, whether feedback might similarly reduce motion during task-based fMRI is an open question. In particular, it is unclear whether participants can effectively monitor motion feedback while attending to task-related demands. Here we assessed whether a combination of real-time and between-run feedback could reduce head motion during task-based fMRI. During an auditory word repetition task, 78 adult participants (aged 18–81) were pseudorandomly assigned to receive feedback, implemented in FIRMM software, or not. We quantified movement using framewise displacement (FD). We found that motion feedback resulted in a statistically significant reduction in participant head motion, with a small-to-moderate effect size (reducing average FD from 0.347 to 0.282). There was some evidence for a change of effect over the course of six runs, but no clear evidence for practice effects based on motion feedback. We conclude that under some circumstances real-time feedback may reduce head motion during task-based fMRI, although its effectiveness may depend on the specific participant population and task demands of a given study.Competing Interest StatementThe authors have declared no competing interest.
56+
ER -

compose/neurosynth-frontend/src/pages/CurationImport/components/CurationImportStandardFormat.tsx

Lines changed: 45 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,18 @@ import '@citation-js/plugin-enw';
1414
import '@citation-js/plugin-bibtex';
1515
import '@citation-js/plugin-ris';
1616

17+
const normalize = (t: unknown): string => {
18+
if (typeof t === 'string') return t;
19+
if (Array.isArray(t)) return t.find((x) => typeof x === 'string' && x.trim()) || '';
20+
return '';
21+
};
22+
23+
const extractYear = (dateString: string | undefined) => {
24+
if (!dateString) return '';
25+
const match = dateString.match(/\b\d{4}\b/);
26+
return match ? match[0] : '';
27+
};
28+
1729
enum EValidationReason {
1830
EMPTY = 'Input is empty',
1931
INCORRECT = 'Format is incorrect or unsupported',
@@ -24,6 +36,7 @@ interface CSLJSONDateParts {
2436
| [string | number, number | number, string | number][]
2537
| [string | number, string | number][]
2638
| [string | number][];
39+
raw?: string | string[];
2740
}
2841

2942
interface CSLJSON {
@@ -92,27 +105,38 @@ const CurationImportStandardFormat: React.FC<{
92105
const citeObj = new Cite(uploadState.rawIdText);
93106
citeObj.format('data', { format: 'object' });
94107

95-
const formattedArticles: ICurationStubStudy[] = ((citeObj.data as CSLJSON[]) || []).map((article) => ({
96-
id: uuidv4(),
97-
title: article.title || article['title-short'] || '',
98-
authors: (article.author || []).reduce((acc, curr, index, arr) => {
99-
const middleParticle = curr['non-dropping-particle'] || curr['dropping-particle'] || '';
100-
return `${acc}${curr.given} ${middleParticle ? middleParticle + ' ' : ''}${
101-
curr.family
102-
}${index < arr.length - 1 ? ', ' : ''}`;
103-
}, ''),
104-
keywords: '',
105-
pmid: article.PMID || '',
106-
pmcid: article.PMCID || '',
107-
doi: article.DOI || '',
108-
articleYear: `${article?.issued?.['date-parts']?.[0]?.[0] || ''}`,
109-
journal: article['container-title'] || '',
110-
abstractText: article.abstract || article.annote || '',
111-
articleLink: article.URL || (article.PMID ? `https://pubmed.ncbi.nlm.nih.gov/${article.PMID}` : ''),
112-
exclusionTag: null,
113-
identificationSource: source,
114-
tags: [],
115-
}));
108+
const formattedArticles: ICurationStubStudy[] = ((citeObj.data as CSLJSON[]) || []).map((article) => {
109+
const titleRaw = article.title ?? article['title-short'];
110+
const articleYear =
111+
article?.issued?.['date-parts']?.[0]?.[0]?.toString() ??
112+
extractYear(normalize(article?.issued?.raw));
113+
const articleJournal = normalize(article['container-title']);
114+
const articleAbstract = article.abstract ?? article.annote;
115+
const articleLink =
116+
article.URL ?? (article.PMID ? `https://pubmed.ncbi.nlm.nih.gov/${normalize(article.PMID)}` : '');
117+
118+
return {
119+
id: uuidv4(),
120+
title: normalize(titleRaw),
121+
authors: (article.author || []).reduce((acc, curr, index, arr) => {
122+
const middleParticle = curr['non-dropping-particle'] || curr['dropping-particle'] || '';
123+
return `${acc}${curr.given} ${middleParticle ? middleParticle + ' ' : ''}${
124+
curr.family
125+
}${index < arr.length - 1 ? ', ' : ''}`;
126+
}, ''),
127+
keywords: '',
128+
pmid: normalize(article.PMID),
129+
pmcid: normalize(article.PMCID),
130+
doi: normalize(article.DOI),
131+
articleYear: articleYear ?? '',
132+
journal: articleJournal ?? '',
133+
abstractText: normalize(articleAbstract),
134+
articleLink: articleLink,
135+
exclusionTag: null,
136+
identificationSource: source,
137+
tags: [],
138+
};
139+
});
116140

117141
setUploadState((prev) => ({
118142
...prev,

0 commit comments

Comments
 (0)