@opencloning/ui 1.9.2 → 2.0.0
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.
- package/CHANGELOG.md +61 -0
- package/package.json +5 -6
- package/src/components/CloningSpeedDial.jsx +3 -5
- package/src/components/EditSequenceNameDialog.jsx +3 -5
- package/src/components/ExternalServicesStatusCheck.jsx +3 -5
- package/src/components/LoadCloningHistoryWrapper.jsx +5 -7
- package/src/components/assembler/Assembler.jsx +4 -6
- package/src/components/assembler/ExistingSyntaxDialog.jsx +2 -2
- package/src/components/assembler/useAssembler.js +6 -8
- package/src/components/domesticate/DomesticateDialog.jsx +3 -5
- package/src/components/form/EnzymeMultiSelect.jsx +3 -5
- package/src/components/navigation/MainAppBar.jsx +4 -2
- package/src/components/navigation/SelectTemplateDialog.jsx +4 -2
- package/src/components/primers/primer_design/SequenceTabComponents/hooks/useDesignPrimers.js +4 -6
- package/src/components/primers/primer_details/usePrimerDetailsEndpoints.js +4 -6
- package/src/components/sources/CollectionSource.jsx +2 -2
- package/src/components/sources/Source.jsx +32 -32
- package/src/components/sources/SourceAnnotation.jsx +2 -2
- package/src/components/sources/SourceAssembly.jsx +7 -7
- package/src/components/sources/SourceDatabase.jsx +2 -2
- package/src/components/sources/SourceFile.jsx +2 -2
- package/src/components/sources/SourceGenomeRegion.cy.jsx +46 -0
- package/src/components/sources/SourceGenomeRegion.jsx +29 -15
- package/src/components/sources/SourceHomologousRecombination.jsx +3 -3
- package/src/components/sources/SourceKnownGenomeRegion.jsx +3 -3
- package/src/components/sources/SourceManuallyTyped.jsx +2 -2
- package/src/components/sources/SourcePCRorHybridization.jsx +3 -3
- package/src/components/sources/SourcePolymeraseExtension.jsx +2 -2
- package/src/components/sources/SourceRepositoryId.jsx +4 -4
- package/src/components/sources/SourceRestriction.jsx +2 -2
- package/src/components/sources/SourceReverseComplement.jsx +2 -2
- package/src/components/sources/SourceServerStaticFile.jsx +3 -3
- package/src/components/verification/VerificationFileDialog.cy.jsx +17 -21
- package/src/components/verification/VerificationFileDialog.jsx +12 -11
- package/src/hooks/index.js +1 -2
- package/src/hooks/useBackendHttpClient.js +17 -0
- package/src/hooks/useCloningHistoryLoader.js +5 -7
- package/src/hooks/useGatewaySites.js +3 -5
- package/src/hooks/useInitializeApp.js +3 -4
- package/src/hooks/useLoadDatabaseFile.js +2 -2
- package/src/hooks/useSequencingAlignment.js +4 -6
- package/src/hooks/useServerStaticFiles.js +2 -2
- package/src/hooks/{useBackendAPI.js → useSourceRequest.js} +6 -8
- package/src/hooks/useStoreEditor.js +2 -1
- package/src/hooks/useUrlParamsLoader.js +8 -5
- package/src/hooks/useValidateState.js +4 -6
- package/src/version.js +1 -1
- package/src/hooks/useBackendRoute.js +0 -23
- package/src/hooks/useHttpClient.js +0 -20
|
@@ -5,7 +5,7 @@ import { isEqual } from 'lodash-es';
|
|
|
5
5
|
import { getInputSequencesFromSourceId } from '@opencloning/store/cloning_utils';
|
|
6
6
|
import SubmitButtonBackendAPI from '../form/SubmitButtonBackendAPI';
|
|
7
7
|
|
|
8
|
-
function SourceAnnotation({ source, requestStatus,
|
|
8
|
+
function SourceAnnotation({ source, requestStatus, sendSourceRequest }) {
|
|
9
9
|
const [annotationTool, setAnnotationTool] = React.useState('plannotate');
|
|
10
10
|
|
|
11
11
|
const inputSequences = useSelector((state) => getInputSequencesFromSourceId(state, source.id), isEqual);
|
|
@@ -16,7 +16,7 @@ function SourceAnnotation({ source, requestStatus, sendPostRequest }) {
|
|
|
16
16
|
sequence: inputSequences[0],
|
|
17
17
|
source: { id: source.id, input: inputSequences.map((e) => ({ sequence: e.id })), annotation_tool: annotationTool },
|
|
18
18
|
};
|
|
19
|
-
|
|
19
|
+
sendSourceRequest({ endpoint: 'annotate/plannotate', requestData, source });
|
|
20
20
|
};
|
|
21
21
|
|
|
22
22
|
return (
|
|
@@ -15,7 +15,7 @@ const helpSingleSite = 'Even if input sequences contain multiple att sites '
|
|
|
15
15
|
+ 'Select this option to get those products.';
|
|
16
16
|
|
|
17
17
|
// A component representing the ligation or gibson assembly of several fragments
|
|
18
|
-
function SourceAssembly({ source, requestStatus,
|
|
18
|
+
function SourceAssembly({ source, requestStatus, sendSourceRequest }) {
|
|
19
19
|
const assemblyType = source.type;
|
|
20
20
|
const { id: sourceId, input: sourceInput } = source;
|
|
21
21
|
const inputSequences = useSelector((state) => getInputSequencesFromSourceId(state, sourceId), shallowEqual);
|
|
@@ -91,21 +91,21 @@ function SourceAssembly({ source, requestStatus, sendPostRequest }) {
|
|
|
91
91
|
} };
|
|
92
92
|
// To instantiate the correct class on the backend
|
|
93
93
|
requestData.source.type = assemblyType;
|
|
94
|
-
|
|
94
|
+
sendSourceRequest({ endpoint: 'gibson_assembly', requestData, config, source });
|
|
95
95
|
} else if (assemblyType === 'RestrictionAndLigationSource') {
|
|
96
96
|
if (enzymes.length === 0) { return; }
|
|
97
97
|
requestData.source.restriction_enzymes = enzymes;
|
|
98
98
|
const config = { params: {
|
|
99
99
|
circular_only: circularOnly,
|
|
100
100
|
} };
|
|
101
|
-
|
|
101
|
+
sendSourceRequest({ endpoint: 'restriction_and_ligation', requestData, config, source });
|
|
102
102
|
} else if (assemblyType === 'GatewaySource') {
|
|
103
103
|
requestData.source.greedy = gatewaySettings.greedy;
|
|
104
104
|
requestData.source.reaction_type = gatewaySettings.reactionType;
|
|
105
105
|
const config = { params: { circular_only: circularOnly, only_multi_site: gatewaySettings.onlyMultiSite } };
|
|
106
|
-
|
|
106
|
+
sendSourceRequest({ endpoint: 'gateway', requestData, config, source });
|
|
107
107
|
} else if (assemblyType === 'CreLoxRecombinationSource') {
|
|
108
|
-
|
|
108
|
+
sendSourceRequest({ endpoint: 'cre_lox_recombination', requestData, source });
|
|
109
109
|
} else if (assemblyType === 'RecombinaseSource') {
|
|
110
110
|
if (recombinases.length === 0) { return; }
|
|
111
111
|
requestData.source.recombinases = recombinases;
|
|
@@ -113,14 +113,14 @@ function SourceAssembly({ source, requestStatus, sendPostRequest }) {
|
|
|
113
113
|
reverse_recombinase: reverseRecombinase,
|
|
114
114
|
input_contains_genome: inputContainsGenome,
|
|
115
115
|
} };
|
|
116
|
-
|
|
116
|
+
sendSourceRequest({ endpoint: 'recombinase', requestData, config, source });
|
|
117
117
|
} else {
|
|
118
118
|
const config = { params: {
|
|
119
119
|
allow_partial_overlap: allowPartialOverlap,
|
|
120
120
|
circular_only: circularOnly,
|
|
121
121
|
blunt: bluntLigation,
|
|
122
122
|
} };
|
|
123
|
-
|
|
123
|
+
sendSourceRequest({ endpoint: classNameToEndPointMap[assemblyType], requestData, config, source });
|
|
124
124
|
}
|
|
125
125
|
};
|
|
126
126
|
|
|
@@ -4,12 +4,12 @@ import SubmitButtonBackendAPI from '../form/SubmitButtonBackendAPI';
|
|
|
4
4
|
import useDatabase from '../../hooks/useDatabase';
|
|
5
5
|
import useLoadDatabaseFile from '../../hooks/useLoadDatabaseFile';
|
|
6
6
|
|
|
7
|
-
function SourceDatabase({ source, requestStatus,
|
|
7
|
+
function SourceDatabase({ source, requestStatus, sendSourceRequest }) {
|
|
8
8
|
const [file, setFile] = React.useState(null);
|
|
9
9
|
const [databaseId, setDatabaseId] = React.useState(null);
|
|
10
10
|
const database = useDatabase();
|
|
11
11
|
const [historyFileError, setHistoryFileError] = React.useState(null);
|
|
12
|
-
const { loadDatabaseFile } = useLoadDatabaseFile({ source,
|
|
12
|
+
const { loadDatabaseFile } = useLoadDatabaseFile({ source, sendSourceRequest, setHistoryFileError });
|
|
13
13
|
|
|
14
14
|
const onSubmit = async (e) => {
|
|
15
15
|
e.preventDefault();
|
|
@@ -14,7 +14,7 @@ const fileFormatToExtension = {
|
|
|
14
14
|
};
|
|
15
15
|
|
|
16
16
|
// A component providing an interface to import a file
|
|
17
|
-
function SourceFile({ source, requestStatus,
|
|
17
|
+
function SourceFile({ source, requestStatus, sendSourceRequest }) {
|
|
18
18
|
const [circularize, setCircularize] = React.useState(false);
|
|
19
19
|
const [showCoordinates, setShowCoordinates] = React.useState(false);
|
|
20
20
|
const [coordinates, setCoordinates] = React.useState({ start: null, end: null });
|
|
@@ -80,7 +80,7 @@ function SourceFile({ source, requestStatus, sendPostRequest }) {
|
|
|
80
80
|
},
|
|
81
81
|
params: { circularize, sequence_file_format: fileFormat || null, ...coordinates },
|
|
82
82
|
};
|
|
83
|
-
|
|
83
|
+
sendSourceRequest({ endpoint: 'read_from_file', requestData, config, source });
|
|
84
84
|
};
|
|
85
85
|
|
|
86
86
|
const updateCoordinates = (value, isStart) => {
|
|
@@ -62,6 +62,52 @@ describe('<AssemblyIdSelector />', () => {
|
|
|
62
62
|
cy.wait('@getPairedAssemblyInfo');
|
|
63
63
|
cy.contains('Equivalent assembly GCF_000002945.3 has annotation').should('exist');
|
|
64
64
|
});
|
|
65
|
+
it('shows a warning when the paired accession lookup fails', () => {
|
|
66
|
+
const setAssemblyId = cy.spy().as('setAssemblyId');
|
|
67
|
+
const setHasAnnotation = cy.spy().as('setHasAnnotation');
|
|
68
|
+
const onAssemblyIdChange = cy.spy().as('onAssemblyIdChange');
|
|
69
|
+
|
|
70
|
+
cy.intercept('GET', 'https://api.ncbi.nlm.nih.gov/datasets/v2alpha/genome/accession/GCA_000002945.3/dataset_report*', {
|
|
71
|
+
statusCode: 200,
|
|
72
|
+
body: {
|
|
73
|
+
reports: [{
|
|
74
|
+
accession: 'GCA_000002945.3',
|
|
75
|
+
organism: {
|
|
76
|
+
tax_id: 559292,
|
|
77
|
+
organism_name: 'Saccharomyces cerevisiae'
|
|
78
|
+
},
|
|
79
|
+
annotation_info: undefined,
|
|
80
|
+
paired_accession: 'GCF_000002945.3',
|
|
81
|
+
assembly_info: {
|
|
82
|
+
assembly_status: 'current'
|
|
83
|
+
}
|
|
84
|
+
}]
|
|
85
|
+
}
|
|
86
|
+
}).as('getAssemblyInfo');
|
|
87
|
+
|
|
88
|
+
cy.intercept('GET', 'https://api.ncbi.nlm.nih.gov/datasets/v2alpha/genome/accession/GCF_000002945.3/dataset_report*', {
|
|
89
|
+
statusCode: 500,
|
|
90
|
+
body: {}
|
|
91
|
+
}).as('getPairedAssemblyInfo');
|
|
92
|
+
|
|
93
|
+
cy.mount(
|
|
94
|
+
<ConfigProvider config={config}>
|
|
95
|
+
<AssemblyIdSelector
|
|
96
|
+
setAssemblyId={setAssemblyId}
|
|
97
|
+
setHasAnnotation={setHasAnnotation}
|
|
98
|
+
onAssemblyIdChange={onAssemblyIdChange}
|
|
99
|
+
/>
|
|
100
|
+
</ConfigProvider>
|
|
101
|
+
);
|
|
102
|
+
cy.get('input').type('GCA_000002945.3');
|
|
103
|
+
cy.wait('@getAssemblyInfo');
|
|
104
|
+
cy.wait('@getPairedAssemblyInfo');
|
|
105
|
+
|
|
106
|
+
cy.contains('Could not check whether an equivalent assembly has annotation:').should('exist');
|
|
107
|
+
cy.contains('Equivalent assembly GCF_000002945.3 has annotation').should('not.exist');
|
|
108
|
+
cy.get('label').contains('Species').siblings('div').children('input')
|
|
109
|
+
.should('have.value', 'Saccharomyces cerevisiae - 559292');
|
|
110
|
+
});
|
|
65
111
|
it('handles NCBI being down displaying the right error', () => {
|
|
66
112
|
cy.intercept('GET', 'https://api.ncbi.nlm.nih.gov/datasets/v2alpha/genome/accession/GCA_000002945.3/dataset_report*', {
|
|
67
113
|
statusCode: 500,
|
|
@@ -5,8 +5,11 @@ import { getReferenceAssemblyId, taxonSuggest, geneSuggest, getInfoFromAssemblyI
|
|
|
5
5
|
import TextFieldValidate from '../form/TextFieldValidate';
|
|
6
6
|
import SubmitButtonBackendAPI from '../form/SubmitButtonBackendAPI';
|
|
7
7
|
import GetRequestMultiSelect from '../form/GetRequestMultiSelect';
|
|
8
|
-
import useHttpClient from '../../hooks/useHttpClient';
|
|
9
8
|
import { formatSequenceLocationString } from '@opencloning/utils/other';
|
|
9
|
+
import { getExternalHttpClient } from '@opencloning/utils/httpClients';
|
|
10
|
+
|
|
11
|
+
// External urls (not the backend): no auth token, only whitelisted urls
|
|
12
|
+
const httpClient = getExternalHttpClient();
|
|
10
13
|
|
|
11
14
|
function getGeneCoordsInfo(gene) {
|
|
12
15
|
const { range: geneRange, accession_version: accessionVersion } = gene.annotation.genomic_regions[0].gene_range;
|
|
@@ -59,7 +62,6 @@ function SpeciesPicker({ setSpecies, setAssemblyId }) {
|
|
|
59
62
|
}
|
|
60
63
|
|
|
61
64
|
function SequenceAccessionPicker({ assemblyAccession, setSequenceAccession }) {
|
|
62
|
-
const httpClient = useHttpClient();
|
|
63
65
|
|
|
64
66
|
const url = `https://api.ncbi.nlm.nih.gov/datasets/v2alpha/genome/accession/${assemblyAccession}/sequence_reports`
|
|
65
67
|
return (
|
|
@@ -80,7 +82,7 @@ function SequenceAccessionPicker({ assemblyAccession, setSequenceAccession }) {
|
|
|
80
82
|
}
|
|
81
83
|
|
|
82
84
|
// Extra component to be used in SourceGenomeRegion
|
|
83
|
-
function SourceGenomeRegionLocusOnReference({ source, requestStatus,
|
|
85
|
+
function SourceGenomeRegionLocusOnReference({ source, requestStatus, sendSourceRequest }) {
|
|
84
86
|
const { id: sourceId } = source;
|
|
85
87
|
const [gene, setGene] = React.useState(null);
|
|
86
88
|
const [species, setSpecies] = React.useState(null);
|
|
@@ -92,7 +94,7 @@ function SourceGenomeRegionLocusOnReference({ source, requestStatus, sendPostReq
|
|
|
92
94
|
event.preventDefault();
|
|
93
95
|
const requestData = formatBackendPayloadWithGene(assemblyId, gene, Number(upstreamBasesRef.current.value), Number(downstreamBasesRef.current.value));
|
|
94
96
|
requestData.id = sourceId;
|
|
95
|
-
|
|
97
|
+
sendSourceRequest({ endpoint: 'genome_coordinates', requestData, source });
|
|
96
98
|
};
|
|
97
99
|
|
|
98
100
|
// Reset gene when species changes
|
|
@@ -153,9 +155,11 @@ function AssemblyIdSelector({ setAssemblyId, setHasAnnotation = () => {}, onAsse
|
|
|
153
155
|
const [newerAssembly, setNewerAssembly] = React.useState(false);
|
|
154
156
|
const [species, setSpecies] = React.useState(null);
|
|
155
157
|
const [pairedAccessionWithAnnotation, setPairedAccessionWithAnnotation] = React.useState('');
|
|
158
|
+
const [pairedAccessionLookupFailed, setPairedAccessionLookupFailed] = React.useState(false);
|
|
156
159
|
|
|
157
160
|
const onChange = async (userInput, resp) => {
|
|
158
161
|
setPairedAccessionWithAnnotation('');
|
|
162
|
+
setPairedAccessionLookupFailed(false);
|
|
159
163
|
setSpecies(resp === null ? null : resp.species);
|
|
160
164
|
if (resp === null) {
|
|
161
165
|
setAssemblyId('');
|
|
@@ -172,9 +176,14 @@ function AssemblyIdSelector({ setAssemblyId, setHasAnnotation = () => {}, onAsse
|
|
|
172
176
|
setNewerAssembly(resp !== null && resp.newerAssembly);
|
|
173
177
|
onAssemblyIdChange();
|
|
174
178
|
if (resp !== null && !resp.hasAnnotation && resp.pairedAccession) {
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
179
|
+
try {
|
|
180
|
+
const pairedAccessionInfo = await getInfoFromAssemblyId(resp.pairedAccession);
|
|
181
|
+
if (pairedAccessionInfo !== null && pairedAccessionInfo.hasAnnotation) {
|
|
182
|
+
setPairedAccessionWithAnnotation(resp.pairedAccession);
|
|
183
|
+
}
|
|
184
|
+
} catch (e) {
|
|
185
|
+
console.error(e);
|
|
186
|
+
setPairedAccessionLookupFailed(true);
|
|
178
187
|
}
|
|
179
188
|
}
|
|
180
189
|
};
|
|
@@ -194,13 +203,18 @@ function AssemblyIdSelector({ setAssemblyId, setHasAnnotation = () => {}, onAsse
|
|
|
194
203
|
Equivalent assembly <a href={`https://www.ncbi.nlm.nih.gov/datasets/genome/${pairedAccessionWithAnnotation}`} target="_blank" rel="noopener noreferrer">{pairedAccessionWithAnnotation}</a> has annotation.
|
|
195
204
|
</Alert>
|
|
196
205
|
)}
|
|
206
|
+
{pairedAccessionLookupFailed && (
|
|
207
|
+
<Alert severity="warning">
|
|
208
|
+
Could not check whether an equivalent assembly has annotation: Try deleting and retyping the assembly ID.
|
|
209
|
+
</Alert>
|
|
210
|
+
)}
|
|
197
211
|
{species && <KnownSpeciesField species={species} />}
|
|
198
212
|
</>
|
|
199
213
|
);
|
|
200
214
|
}
|
|
201
215
|
|
|
202
216
|
// Extra component to be used in SourceGenomeRegion
|
|
203
|
-
function SourceGenomeRegionLocusOnOther({ source, requestStatus,
|
|
217
|
+
function SourceGenomeRegionLocusOnOther({ source, requestStatus, sendSourceRequest }) {
|
|
204
218
|
const { id: sourceId } = source;
|
|
205
219
|
const [gene, setGene] = React.useState(null);
|
|
206
220
|
const [assemblyId, setAssemblyId] = React.useState('');
|
|
@@ -212,7 +226,7 @@ function SourceGenomeRegionLocusOnOther({ source, requestStatus, sendPostRequest
|
|
|
212
226
|
event.preventDefault();
|
|
213
227
|
const requestData = formatBackendPayloadWithGene(assemblyId, gene, Number(upstreamBasesRef.current.value), Number(downstreamBasesRef.current.value));
|
|
214
228
|
requestData.id = sourceId;
|
|
215
|
-
|
|
229
|
+
sendSourceRequest({ endpoint: 'genome_coordinates', requestData, source });
|
|
216
230
|
};
|
|
217
231
|
|
|
218
232
|
return (
|
|
@@ -235,7 +249,7 @@ function SourceGenomeRegionLocusOnOther({ source, requestStatus, sendPostRequest
|
|
|
235
249
|
}
|
|
236
250
|
|
|
237
251
|
// Extra component to be used in SourceGenomeRegion
|
|
238
|
-
function SourceGenomeRegionCustomCoordinates({ source, requestStatus,
|
|
252
|
+
function SourceGenomeRegionCustomCoordinates({ source, requestStatus, sendSourceRequest, selectionMode }) {
|
|
239
253
|
// https://eutils.ncbi.nlm.nih.gov/entrez/eutils/elink.fcgi?dbfrom=nuccore&db=assembly&id=CM041205.1&idtype=acc
|
|
240
254
|
const { id: sourceId } = source;
|
|
241
255
|
const [species, setSpecies] = React.useState(null);
|
|
@@ -285,7 +299,7 @@ function SourceGenomeRegionCustomCoordinates({ source, requestStatus, sendPostRe
|
|
|
285
299
|
assembly_accession: assemblyId || null,
|
|
286
300
|
coordinates: formatSequenceLocationString(coords.start, coords.end, coords.strand === 'plus' ? 1 : -1),
|
|
287
301
|
};
|
|
288
|
-
|
|
302
|
+
sendSourceRequest({ endpoint: 'genome_coordinates', requestData, source });
|
|
289
303
|
};
|
|
290
304
|
|
|
291
305
|
const onSequenceAccessionChange = async (userInput, resp) => {
|
|
@@ -446,7 +460,7 @@ function SourceGenomeRegionSelectGene({ gene, upstreamBasesRef, downstreamBasesR
|
|
|
446
460
|
);
|
|
447
461
|
}
|
|
448
462
|
|
|
449
|
-
function SourceGenomeRegion({ source, requestStatus,
|
|
463
|
+
function SourceGenomeRegion({ source, requestStatus, sendSourceRequest }) {
|
|
450
464
|
const { id: sourceId } = source;
|
|
451
465
|
const [selectionMode, setSelectionMode] = React.useState('');
|
|
452
466
|
const changeSelectionMode = (event) => { setSelectionMode(event.target.value); };
|
|
@@ -470,9 +484,9 @@ function SourceGenomeRegion({ source, requestStatus, sendPostRequest }) {
|
|
|
470
484
|
</Select>
|
|
471
485
|
</FormControl>
|
|
472
486
|
</form>
|
|
473
|
-
{selectionMode === 'reference_genome' && (<SourceGenomeRegionLocusOnReference {...{ source, requestStatus,
|
|
474
|
-
{selectionMode === 'other_assembly' && (<SourceGenomeRegionLocusOnOther {...{ source, requestStatus,
|
|
475
|
-
{selectionMode.startsWith('custom') && (<SourceGenomeRegionCustomCoordinates {...{ source, requestStatus,
|
|
487
|
+
{selectionMode === 'reference_genome' && (<SourceGenomeRegionLocusOnReference {...{ source, requestStatus, sendSourceRequest }} />)}
|
|
488
|
+
{selectionMode === 'other_assembly' && (<SourceGenomeRegionLocusOnOther {...{ source, requestStatus, sendSourceRequest }} />)}
|
|
489
|
+
{selectionMode.startsWith('custom') && (<SourceGenomeRegionCustomCoordinates {...{ source, requestStatus, sendSourceRequest, selectionMode }} />)}
|
|
476
490
|
|
|
477
491
|
</>
|
|
478
492
|
);
|
|
@@ -9,7 +9,7 @@ import SubmitButtonBackendAPI from '../form/SubmitButtonBackendAPI';
|
|
|
9
9
|
import SelectPrimerForm from '../primers/SelectPrimerForm';
|
|
10
10
|
|
|
11
11
|
// A component representing the ligation of several fragments
|
|
12
|
-
function SourceHomologousRecombination({ source, requestStatus,
|
|
12
|
+
function SourceHomologousRecombination({ source, requestStatus, sendSourceRequest }) {
|
|
13
13
|
const isCrispr = source.type === 'CRISPRSource';
|
|
14
14
|
const { id: sourceId, input } = source;
|
|
15
15
|
const inputSequences = useSelector((state) => getInputSequencesFromSourceId(state, sourceId), isEqual);
|
|
@@ -33,9 +33,9 @@ function SourceHomologousRecombination({ source, requestStatus, sendPostRequest
|
|
|
33
33
|
const config = { params: { minimal_homology: minimalHomologyRef.current.value } };
|
|
34
34
|
if (isCrispr) {
|
|
35
35
|
requestData.guides = selectedPrimers.map((primerId) => primers.find((p) => p.id === primerId));
|
|
36
|
-
|
|
36
|
+
sendSourceRequest({ endpoint: 'crispr', requestData, config, source });
|
|
37
37
|
} else {
|
|
38
|
-
|
|
38
|
+
sendSourceRequest({ endpoint: 'homologous_recombination', requestData, config, source });
|
|
39
39
|
}
|
|
40
40
|
};
|
|
41
41
|
|
|
@@ -4,7 +4,7 @@ import { geneSuggest } from '@opencloning/utils/ncbiRequests';
|
|
|
4
4
|
import { formatBackendPayloadWithGene } from './SourceGenomeRegion';
|
|
5
5
|
import { Box, CircularProgress } from '@mui/material';
|
|
6
6
|
|
|
7
|
-
function SourceKnownGenomeRegion({ source, requestStatus,
|
|
7
|
+
function SourceKnownGenomeRegion({ source, requestStatus, sendSourceRequest }) {
|
|
8
8
|
// A source where we pass a complete GenomeCoordinatesSource, so we just have to make the request
|
|
9
9
|
const [error, setError] = React.useState('');
|
|
10
10
|
const [connectAttempt, setConnectAttempt] = React.useState(0);
|
|
@@ -25,14 +25,14 @@ function SourceKnownGenomeRegion({ source, requestStatus, sendPostRequest }) {
|
|
|
25
25
|
}
|
|
26
26
|
const requestData = formatBackendPayloadWithGene(source.assembly_accession, resp[0], source.padding, source.padding);
|
|
27
27
|
requestData.id = source.id;
|
|
28
|
-
|
|
28
|
+
sendSourceRequest({ endpoint: 'genome_coordinates', requestData, source });
|
|
29
29
|
}
|
|
30
30
|
else {
|
|
31
31
|
const requestData = {
|
|
32
32
|
...source,
|
|
33
33
|
type: 'GenomeCoordinatesSource',
|
|
34
34
|
};
|
|
35
|
-
|
|
35
|
+
sendSourceRequest({ endpoint: 'genome_coordinates', requestData, source });
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
38
|
makeRequest();
|
|
@@ -4,7 +4,7 @@ import SubmitButtonBackendAPI from '../form/SubmitButtonBackendAPI';
|
|
|
4
4
|
import ValidatedTextField from '../form/ValidatedTextField';
|
|
5
5
|
import { stringIsNotDNA } from '@opencloning/store/cloning_utils';
|
|
6
6
|
|
|
7
|
-
function SourceManuallyTyped({ source, requestStatus,
|
|
7
|
+
function SourceManuallyTyped({ source, requestStatus, sendSourceRequest }) {
|
|
8
8
|
const { id: sourceId } = source;
|
|
9
9
|
|
|
10
10
|
const [userInput, setUserInput] = React.useState('');
|
|
@@ -48,7 +48,7 @@ function SourceManuallyTyped({ source, requestStatus, sendPostRequest }) {
|
|
|
48
48
|
overhang_watson_3prime: overhangWatson3prime,
|
|
49
49
|
},
|
|
50
50
|
};
|
|
51
|
-
|
|
51
|
+
sendSourceRequest({ endpoint: 'manually_typed', requestData, source });
|
|
52
52
|
}
|
|
53
53
|
};
|
|
54
54
|
|
|
@@ -10,7 +10,7 @@ import { cloningActions } from '@opencloning/store/cloning';
|
|
|
10
10
|
import useStoreEditor from '../../hooks/useStoreEditor';
|
|
11
11
|
import LabelWithTooltip from '../form/LabelWithTooltip';
|
|
12
12
|
|
|
13
|
-
function SourcePCRorHybridization({ source, requestStatus,
|
|
13
|
+
function SourcePCRorHybridization({ source, requestStatus, sendSourceRequest }) {
|
|
14
14
|
// Represents a PCR if inputs != [], else is a oligo hybridization
|
|
15
15
|
|
|
16
16
|
const dispatch = useDispatch();
|
|
@@ -58,14 +58,14 @@ function SourcePCRorHybridization({ source, requestStatus, sendPostRequest }) {
|
|
|
58
58
|
if (!isPcr) {
|
|
59
59
|
requestData.source.input = [forwardPrimerId, reversePrimerId].map((id) => ({ sequence: id }));
|
|
60
60
|
const config = { params: { minimal_annealing: minimalAnnealingRef.current.value } };
|
|
61
|
-
|
|
61
|
+
sendSourceRequest({ endpoint: 'oligonucleotide_hybridization', requestData, config, source });
|
|
62
62
|
} else {
|
|
63
63
|
const config = { params: {
|
|
64
64
|
minimal_annealing: minimalAnnealingRef.current.value,
|
|
65
65
|
allowed_mismatches: allowedMismatchesRef.current.value,
|
|
66
66
|
} };
|
|
67
67
|
requestData.source.add_primer_features = addPrimerFeatures;
|
|
68
|
-
|
|
68
|
+
sendSourceRequest({ endpoint: 'pcr', requestData, config, source });
|
|
69
69
|
}
|
|
70
70
|
};
|
|
71
71
|
|
|
@@ -4,7 +4,7 @@ import { Alert } from '@mui/material';
|
|
|
4
4
|
import { getInputSequencesFromSourceId } from '@opencloning/store/cloning_utils';
|
|
5
5
|
import SubmitButtonBackendAPI from '../form/SubmitButtonBackendAPI';
|
|
6
6
|
|
|
7
|
-
function SourcePolymeraseExtension({ source, requestStatus,
|
|
7
|
+
function SourcePolymeraseExtension({ source, requestStatus, sendSourceRequest }) {
|
|
8
8
|
const { id: sourceId } = source;
|
|
9
9
|
const inputSequences = useSelector((state) => getInputSequencesFromSourceId(state, sourceId), shallowEqual);
|
|
10
10
|
const { overhang_crick_3prime, overhang_watson_3prime } = inputSequences[0];
|
|
@@ -16,7 +16,7 @@ function SourcePolymeraseExtension({ source, requestStatus, sendPostRequest }) {
|
|
|
16
16
|
sequences: inputSequences,
|
|
17
17
|
source: { id: sourceId, input: inputSequences.map((e) => ({ sequence: e.id })) },
|
|
18
18
|
};
|
|
19
|
-
|
|
19
|
+
sendSourceRequest({ endpoint: 'polymerase_extension', requestData, source });
|
|
20
20
|
};
|
|
21
21
|
// No need for MultipleOutputsSelector, since there is only one output
|
|
22
22
|
return (
|
|
@@ -3,10 +3,10 @@ import { IconButton, InputAdornment, InputLabel, MenuItem, TextField, FormContro
|
|
|
3
3
|
import { Clear as ClearIcon } from '@mui/icons-material';
|
|
4
4
|
import SubmitButtonBackendAPI from '../form/SubmitButtonBackendAPI';
|
|
5
5
|
import RequestStatusWrapper from '../form/RequestStatusWrapper';
|
|
6
|
-
import
|
|
6
|
+
import { getExternalHttpClient } from '@opencloning/utils/httpClients';
|
|
7
7
|
import repositoryMetadata from './repositoryMetadata';
|
|
8
8
|
|
|
9
|
-
const httpClient =
|
|
9
|
+
const httpClient = getExternalHttpClient();
|
|
10
10
|
|
|
11
11
|
function validateRepositoryId(repositoryId, repository) {
|
|
12
12
|
switch (repository) {
|
|
@@ -243,7 +243,7 @@ function IndexJsonSelector({
|
|
|
243
243
|
|
|
244
244
|
// A component providing an interface for the user to type a repository ID
|
|
245
245
|
// and get a sequence
|
|
246
|
-
function SourceRepositoryId({ source, requestStatus,
|
|
246
|
+
function SourceRepositoryId({ source, requestStatus, sendSourceRequest }) {
|
|
247
247
|
const { id: sourceId } = source;
|
|
248
248
|
const [inputValue, setInputValue] = React.useState('');
|
|
249
249
|
const [repositoryType, setRepositoryType] = React.useState(source.type || '');
|
|
@@ -290,7 +290,7 @@ function SourceRepositoryId({ source, requestStatus, sendPostRequest }) {
|
|
|
290
290
|
extra.sequence_file_url = encodeURI(inputValue.url);
|
|
291
291
|
}
|
|
292
292
|
const requestData = { id: sourceId, ...extra, type: repositoryType };
|
|
293
|
-
|
|
293
|
+
sendSourceRequest({ endpoint: `repository_id/${repositoryMeta.slug}`, requestData, source });
|
|
294
294
|
};
|
|
295
295
|
const helperText = error || (repositoryMeta?.example && `Example: ${repositoryMeta.example}`);
|
|
296
296
|
return (
|
|
@@ -7,7 +7,7 @@ import SubmitButtonBackendAPI from '../form/SubmitButtonBackendAPI';
|
|
|
7
7
|
// A component providing an interface for the user to perform a restriction reaction
|
|
8
8
|
// with one or more restriction enzymes, move between output fragments, and eventually
|
|
9
9
|
// select one as an output.
|
|
10
|
-
function SourceRestriction({ source, requestStatus,
|
|
10
|
+
function SourceRestriction({ source, requestStatus, sendSourceRequest }) {
|
|
11
11
|
const { id: sourceId } = source;
|
|
12
12
|
const [enzymes, setEnzymes] = React.useState([]);
|
|
13
13
|
const inputSequences = useSelector((state) => getInputSequencesFromSourceId(state, sourceId), shallowEqual);
|
|
@@ -19,7 +19,7 @@ function SourceRestriction({ source, requestStatus, sendPostRequest }) {
|
|
|
19
19
|
source: { id: sourceId, input: source.input },
|
|
20
20
|
sequences: inputSequences,
|
|
21
21
|
};
|
|
22
|
-
|
|
22
|
+
sendSourceRequest({ endpoint: 'restriction', requestData, source, config: { params: { restriction_enzymes: enzymes } } });
|
|
23
23
|
};
|
|
24
24
|
|
|
25
25
|
return (
|
|
@@ -3,7 +3,7 @@ import { shallowEqual, useSelector } from 'react-redux';
|
|
|
3
3
|
import { getInputSequencesFromSourceId } from '@opencloning/store/cloning_utils';
|
|
4
4
|
import SubmitButtonBackendAPI from '../form/SubmitButtonBackendAPI';
|
|
5
5
|
|
|
6
|
-
function SourceReverseComplement({ source, requestStatus,
|
|
6
|
+
function SourceReverseComplement({ source, requestStatus, sendSourceRequest }) {
|
|
7
7
|
const { id: sourceId, input } = source;
|
|
8
8
|
const inputSequences = useSelector((state) => getInputSequencesFromSourceId(state, sourceId), shallowEqual);
|
|
9
9
|
const onSubmit = (event) => {
|
|
@@ -13,7 +13,7 @@ function SourceReverseComplement({ source, requestStatus, sendPostRequest }) {
|
|
|
13
13
|
sequences: inputSequences,
|
|
14
14
|
source: { id: sourceId, input },
|
|
15
15
|
};
|
|
16
|
-
|
|
16
|
+
sendSourceRequest({ endpoint: 'reverse_complement', requestData, source });
|
|
17
17
|
};
|
|
18
18
|
// No need for MultipleOutputsSelector, since there is only one output
|
|
19
19
|
return (
|
|
@@ -2,7 +2,7 @@ import React from 'react'
|
|
|
2
2
|
import ServerStaticFileSelect from '../form/ServerStaticFileSelect';
|
|
3
3
|
import { Alert, LinearProgress } from '@mui/material';
|
|
4
4
|
|
|
5
|
-
function SourceServerStaticFile({ source, requestStatus,
|
|
5
|
+
function SourceServerStaticFile({ source, requestStatus, sendSourceRequest }) {
|
|
6
6
|
const onFileSelected = React.useCallback((file) => {
|
|
7
7
|
const requestData = new FormData();
|
|
8
8
|
requestData.append('file', file);
|
|
@@ -11,8 +11,8 @@ function SourceServerStaticFile({ source, requestStatus, sendPostRequest }) {
|
|
|
11
11
|
'content-type': 'multipart/form-data',
|
|
12
12
|
},
|
|
13
13
|
};
|
|
14
|
-
|
|
15
|
-
}, [
|
|
14
|
+
sendSourceRequest({ endpoint: 'read_from_file', requestData, config, source });
|
|
15
|
+
}, [sendSourceRequest, source]);
|
|
16
16
|
|
|
17
17
|
return (
|
|
18
18
|
<>
|
|
@@ -4,6 +4,11 @@ import store from '@opencloning/store';
|
|
|
4
4
|
import { cloningActions } from '@opencloning/store/cloning';
|
|
5
5
|
import { loadDataAndMount } from '../../../../../cypress/e2e/common_funcions_store';
|
|
6
6
|
import { getVerificationFileName } from '@opencloning/utils/readNwrite';
|
|
7
|
+
import {
|
|
8
|
+
clearVerificationFileContents,
|
|
9
|
+
getVerificationFileContent,
|
|
10
|
+
setVerificationFileContent,
|
|
11
|
+
} from '@opencloning/utils/verificationFileStore';
|
|
7
12
|
import { ConfigProvider } from '@opencloning/ui/providers/ConfigProvider';
|
|
8
13
|
import { Provider } from 'react-redux';
|
|
9
14
|
|
|
@@ -23,7 +28,7 @@ const base64str = 'aGVsbG8=';
|
|
|
23
28
|
|
|
24
29
|
describe('<VerificationFileDialog />', () => {
|
|
25
30
|
beforeEach(() => {
|
|
26
|
-
|
|
31
|
+
clearVerificationFileContents();
|
|
27
32
|
});
|
|
28
33
|
it('renders and calls setDialogOpen with false when clicking close button', () => {
|
|
29
34
|
// see: https://on.cypress.io/mounting-react
|
|
@@ -51,7 +56,7 @@ describe('<VerificationFileDialog />', () => {
|
|
|
51
56
|
it('displays existing files and can download and delete them', () => {
|
|
52
57
|
store.dispatch(setFiles(dummyFiles));
|
|
53
58
|
dummyFiles.forEach((file) => {
|
|
54
|
-
|
|
59
|
+
setVerificationFileContent(getVerificationFileName(file), base64str);
|
|
55
60
|
});
|
|
56
61
|
cy.mount(
|
|
57
62
|
<Provider store={store}>
|
|
@@ -69,16 +74,11 @@ describe('<VerificationFileDialog />', () => {
|
|
|
69
74
|
|
|
70
75
|
cy.get('[data-testid="DeleteIcon"]').first().click();
|
|
71
76
|
cy.get('table').contains('file2.txt');
|
|
72
|
-
cy.get('table').contains('file1.txt').should('not.exist')
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
.should('be.null');
|
|
78
|
-
|
|
79
|
-
cy.window().its('sessionStorage')
|
|
80
|
-
.invoke('getItem', 'verification-1-file2.txt')
|
|
81
|
-
.should('not.be.null');
|
|
77
|
+
cy.get('table').contains('file1.txt').should('not.exist').then(() => {
|
|
78
|
+
// Check that the file is not in the verification file store
|
|
79
|
+
expect(getVerificationFileContent('verification-1-file1.txt')).to.be.null;
|
|
80
|
+
expect(getVerificationFileContent('verification-1-file2.txt')).to.not.be.null;
|
|
81
|
+
});
|
|
82
82
|
});
|
|
83
83
|
|
|
84
84
|
it('can submit files and aligns them', () => {
|
|
@@ -105,9 +105,8 @@ describe('<VerificationFileDialog />', () => {
|
|
|
105
105
|
cy.expect(file.file_type).to.equal('Sequencing file');
|
|
106
106
|
cy.expect(file.sequence_id).to.equal(2);
|
|
107
107
|
cy.expect(file.alignment).to.have.length(2);
|
|
108
|
-
// The file content is stored in
|
|
109
|
-
cy.
|
|
110
|
-
.invoke('getItem', getVerificationFileName(file))
|
|
108
|
+
// The file content is stored in the verification file store
|
|
109
|
+
cy.wrap(getVerificationFileContent(getVerificationFileName(file)))
|
|
111
110
|
.should('not.be.null', { timeout: 10000 });
|
|
112
111
|
|
|
113
112
|
cy.intercept('POST', 'http://127.0.0.1:8000/align_sanger*', {
|
|
@@ -133,9 +132,8 @@ describe('<VerificationFileDialog />', () => {
|
|
|
133
132
|
cy.expect(file.file_type).to.equal('Sequencing file');
|
|
134
133
|
cy.expect(file.sequence_id).to.equal(2);
|
|
135
134
|
cy.expect(file.alignment).to.deep.equal(['A', 'C']);
|
|
136
|
-
// The file content is stored in
|
|
137
|
-
cy.
|
|
138
|
-
.invoke('getItem', getVerificationFileName(file))
|
|
135
|
+
// The file content is stored in the verification file store
|
|
136
|
+
cy.wrap(getVerificationFileContent(getVerificationFileName(file)))
|
|
139
137
|
.should('not.be.null', { timeout: 10000 });
|
|
140
138
|
});
|
|
141
139
|
});
|
|
@@ -187,9 +185,7 @@ describe('<VerificationFileDialog />', () => {
|
|
|
187
185
|
cy.contains('Request failed');
|
|
188
186
|
// It has not been added
|
|
189
187
|
cy.get('table').contains('BZO902-13409020-13409020.ab1').should('not.exist');
|
|
190
|
-
|
|
191
|
-
.invoke('getItem', 'verification-2-BZO902-13409020-13409020.ab1')
|
|
192
|
-
.should('be.null');
|
|
188
|
+
expect(getVerificationFileContent('verification-2-BZO902-13409020-13409020.ab1')).to.be.null;
|
|
193
189
|
|
|
194
190
|
// Connection error
|
|
195
191
|
cy.intercept('POST', 'http://127.0.0.1:8000/align_sanger*', {
|