1+ // Set the configuration of every mongo collection
2+ // Set local and global collections separatedly since they may use different indexes
3+ // name - Actual name of the collection inside the database
4+ // indexes - Index configuration in the database, for the collections setup
5+ // documentNames - Document names used for displaying only
6+ const LOCAL_COLLECTIONS = {
7+ projects : {
8+ name : 'projects' ,
9+ indexes : [ { published : 1 } ] ,
10+ documentNames : { singular : 'project' , plural : 'projects' } ,
11+ } ,
12+ uniprot_refs : {
13+ name : 'references' ,
14+ documentNames : { singular : 'reference' , plural : 'references' } ,
15+ } ,
16+ inchikey_refs : {
17+ name : 'inchikey_refs' ,
18+ documentNames : { singular : 'inchikey' , plural : 'inchikeys' } ,
19+ } ,
20+ pdb_refs : {
21+ name : 'pdb_refs' ,
22+ documentNames : { singular : 'PDB' , plural : 'PDBs' } ,
23+ } ,
24+ chain_refs : {
25+ name : 'chain_refs' ,
26+ documentNames : { singular : 'chain' , plural : 'chains' } ,
27+ } ,
28+ collection_refs : {
29+ name : 'collection_refs' ,
30+ documentNames : { singular : 'collection' , plural : 'collections' } ,
31+ } ,
32+ topologies : {
33+ name : 'topologies' ,
34+ indexes : [ { project : 1 } ] ,
35+ documentNames : { singular : 'topology' , plural : 'topologies' } ,
36+ } ,
37+ files : {
38+ name : 'fs.files' ,
39+ indexes : [ { 'metadata.project' : 1 } ] ,
40+ documentNames : { singular : 'file' , plural : 'files' } ,
41+ } ,
42+ chunks : {
43+ name : 'fs.chunks' ,
44+ documentNames : { singular : 'chunk' , plural : 'chunks' } ,
45+ } ,
46+ analyses : {
47+ name : 'analyses' ,
48+ indexes : [ { project : 1 } ] ,
49+ documentNames : { singular : 'analysis' , plural : 'analyses' } ,
50+ } ,
51+ counters : {
52+ name : 'counters' ,
53+ documentNames : { singular : 'counter' , plural : 'counters' }
54+ } ,
55+ } ;
56+ const GLOBAL_COLLECTIONS = {
57+ projects : {
58+ name : 'global.projects' ,
59+ indexes : [ { posited : 1 } , { accession : 1 } , { node : 1 , local : 1 } ] ,
60+ documentNames : { singular : 'project' , plural : 'projects' } ,
61+ } ,
62+ topologies : {
63+ name : 'global.topologies' ,
64+ documentNames : { singular : 'topology' , plural : 'topologies' } ,
65+ } ,
66+ uniprot_refs : {
67+ name : 'global.references' ,
68+ indexes : [ { uniprot : 1 } ] ,
69+ documentNames : { singular : 'reference' , plural : 'references' } ,
70+ } ,
71+ inchikey_refs : {
72+ name : 'global.inchikeys' ,
73+ indexes : [ { inchikey : 1 } ] ,
74+ documentNames : { singular : 'inchikey' , plural : 'inchikeys' } ,
75+ } ,
76+ pdb_refs : {
77+ name : 'global.pdb_refs' ,
78+ indexes : [ { id : 1 } ] ,
79+ documentNames : { singular : 'pdb' , plural : 'pdbs' } ,
80+ } ,
81+ chain_refs : {
82+ name : 'global.chain_refs' ,
83+ documentNames : { singular : 'chain' , plural : 'chains' } ,
84+ } ,
85+ collection_refs : {
86+ name : 'global.collection_refs' ,
87+ documentNames : { singular : 'collection' , plural : 'collections' } ,
88+ } ,
89+ nodes : {
90+ name : 'global.nodes' ,
91+ documentNames : { singular : 'topology' , plural : 'topologies' } ,
92+ } ,
93+ counters : {
94+ name : 'global.counters' ,
95+ documentNames : { singular : 'counter' , plural : 'counters' }
96+ } ,
97+ pointers : {
98+ name : 'pointers' ,
99+ documentNames : { singular : 'pointers' , plural : 'pointers' }
100+ }
101+ } ;
102+
103+ // Set the configuration of every reference collection
104+ // Configuration for local and global collections should be identical
105+ // The 'idField' is the field inside every reference document which stores the reference id
106+ // The 'projectIdsField' is the field inside project documents with a list of reference ids related to the project
107+ const REFERENCES = {
108+ proteins : {
109+ collectionName : 'uniprot_refs' ,
110+ idField : 'uniprot' ,
111+ projectIdsField : 'metadata.REFERENCES'
112+ } ,
113+ inchikeys : {
114+ collectionName : 'inchikey_refs' ,
115+ idField : 'inchikey' ,
116+ projectIdsField : 'metadata.INCHIKEYS'
117+ } ,
118+ pdbs : {
119+ collectionName : 'pdb_refs' ,
120+ idField : 'id' ,
121+ projectIdsField : 'metadata.PDBIDS'
122+ } ,
123+ chains : {
124+ collectionName : 'chain_refs' ,
125+ idField : 'sequence' ,
126+ projectIdsField : 'metadata.PROTSEQ'
127+ } ,
128+ collections : {
129+ collectionName : 'collection_refs' ,
130+ idField : 'id' ,
131+ projectIdsField : 'metadata.COLLECTIONS'
132+ }
133+ } ;
134+
135+ // Set some constants
136+ module . exports = {
137+ // Export mongo collections
138+ LOCAL_COLLECTIONS ,
139+ GLOBAL_COLLECTIONS ,
140+ // Export references
141+ REFERENCES ,
142+ // Standard filenames
143+ STANDARD_TRAJECTORY_FILENAME : 'trajectory.bin' ,
144+ STANDARD_STRUCTURE_FILENAME : 'structure.pdb' ,
145+ }
0 commit comments