-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmodels.js
53 lines (46 loc) · 1.31 KB
/
models.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
"use strict";
// imports
var async = require('async');
var mongoose = require('mongoose');
// open database connection
var dbConnection = mongoose.createConnection('mongodb://localhost/seqdb');
var Schema = mongoose.Schema;
// define schema for stiring feature data as they ar in gff3 format
var FeatureSchema = new Schema({
seqid: {type: String},
source: {type: String},
type: {type: String},
start: {type: Number},
end: {type: Number},
score: String,
strand: {type: String},
phase: {type: String},
attributes: {}
});
dbConnection.model('Feature', FeatureSchema);
// define schema for storing reference sequence imported from fasta file
var RefSeqSchema = new Schema(
{
genome: {type: String},
chrom: {type: String},
starts: {type: Number},
ends: {type: Number},
sequence: String
});
dbConnection.model('RefSeq', RefSeqSchema);
// define schema for storing list of accessions/strains for each genome
var GenomeStrainsSchema = new Schema(
{
genome: {type: String},
strains: [String]
});
dbConnection.model('genomestrains', GenomeStrainsSchema);
// define schema for storing chromInfo
var ChromInfoSchema = new Schema(
{
genome: {type: String},
chromosomes: {}
}
);
dbConnection.model('chromInfo', ChromInfoSchema);
exports.dbConnection = dbConnection;