{"_id":"_design/basic","_rev":"122-6aa34fcc95d41bdfa7e42e8bf30437b9","ignore-validate_doc_update":"function(newDoc, oldDoc, userCtx) {\r\n function forbidden(message) {\r\n\tthrow({forbidden : message}); // 403\r\n };\r\n function unauthorized(message) {\r\n\tthrow({unauthorized : message}); //401\r\n };\r\n if (userCtx.roles.indexOf('_admin') == -1) {\r\n\tforbidden(\"You may not create or edit documents.\")\r\n }\r\n}","language":"javascript","views":{"all":{"map":"function(doc) {\n emit(doc._id, doc);\n};"},"by_cytoband":{"map":"function(doc) {\n if (doc.Cytoband) {\n\temit(doc.Cytoband, doc._id);\n }\n};"},"get_probes":{"map":"function(doc) {\n if (doc.Probes) {\n\tfor (i = 0; i < doc.Probes.length; i++) {\n\t m = doc.Probes[i];\n\t emit([doc._id, m.Manufacturer, m.Platform], \n\t\t [m.Manufacturer, m.Platform, m.ProbeID]);\n\t}\n }\n};"},"by_probe2":{"map":"function(doc) {\n if (doc.Probes) {\n\tfor (i = 0; i < doc.Probes.length; i++) {\n\t m = doc.Probes[i];\n\t emit([m.Manufacturer, m.ProbeID, m.Platform], doc._id);\n\t}\n }\n};"},"by_ensembl":{"map":"function(doc) {\n if (doc.dbXrefs && doc.dbXrefs.Ensembl) {\n\temit(doc.dbXrefs.Ensembl, doc._id);\n }\n};"},"minlength":{"map":"function(doc) {\n if (doc.Maps) {\n\tfor (i = 0; i < doc.Maps.length; i++) {\n\t m = doc.Maps[i];\n\t emit([m.Chromosome, doc._id], \n\t\t m.TranscriptionEnd - m.TranscriptionStart + 1);\n\t}\n }\n};","reduce":"function(keys, values) {\r\n var c = null;\r\n for (i = 0; i < values.length; i++) {\r\n\tvar a = parseInt(values[i]);\r\n\tif (a == null) break;\r\n\tif (c == null) c = a;\r\n\tif (a < c) c = a;\r\n }\r\n return(c);\r\n}"},"by_mir":{"map":"function(doc) {\n if (doc.Maps) {\n\tfor (m =0; m < doc.Maps.length; m++) {\n\t n = doc.Maps[m];\n\t if (n.miRbase) {\n\t\temit(n.miRbase, doc._id);\n\t\tbreak;\n\t }\n\t}\n }\n};"},"by_alias":{"map":"function(doc) {\n if (doc.Symbol) {\n\temit(doc.Symbol, doc._id);\n }\n for each (a in doc.Aliases) {\n\temit(a, doc._id)\n }\n};"},"by_probe":{"map":"function(doc) {\n if (doc.Probes) {\n\tfor (i = 0; i < doc.Probes.length; i++) {\n\t m = doc.Probes[i];\n\t emit([m.Manufacturer, m.Platform, m.ProbeID], 1);\n\t}\n }\n};","reduce":"_sum"},"by_unigene":{"map":"function(doc) {\n if (doc.UniGene) {\n\temit(doc.UniGene, doc._id);\n }\n};"},"gene_location":{"map":"function(doc) {\n if (doc.Maps) {\n\tfor (i = 0; i < doc.Maps.length; i++) {\n\t m = doc.Maps[i];\n\t if (m.UCSC) {\n\t\temit([doc._id, \"UCSC-\" + m.UCSC, m.Chromosome], \n\t\t [m.Chromosome, \n\t\t parseInt(m.TranscriptionStart), \n\t\t parseInt(m.TranscriptionEnd)]);\n\t }\n\t if (m.MIRB) {\n\t\temit([doc._id, \"miRbase-\" + m.MIRB, m.Chromosome], \n\t\t [m.Chromosome, \n\t\t parseInt(m.TranscriptionStart), \n\t\t parseInt(m.TranscriptionEnd)]);\n\t }\n\t}\n }\n};","reduce":"function(keys, values) {\r\n var curs = null;\r\n var cure = null;\r\n for (i = 0; i < values.length; i++) {\r\n\tvar a = values[i][1]; \r\n\tvar b = values[i][2];\r\n\tif (a == null) break;\r\n\tif (b == null) break;\r\n\tif (curs == null) curs = a;\r\n\tif (cure == null) cure = b;\r\n\tif (a < curs) curs = a;\r\n\tif (b > cure) cure = b;\r\n }\r\n return([values[0][0], curs, cure]);\r\n}"},"by_symbol":{"map":"function(doc) {\n if (doc.Symbol) {\n\temit(doc.Symbol, doc._id);\n }\n};"},"by_location":{"map":"function(doc) {\n if (doc.Maps) {\n\tfor (i = 0; i < doc.Maps.length; i++) {\n\t m = doc.Maps[i];\n\t var build = null;\n\t if (m.UCSC) build = \"UCSC-\" + m.UCSC;\n\t if (m.MIRB) build = \"miRbase-\" + m.MIRB;\n\t emit([build, m.Chromosome, \n\t\t parseInt(m.TranscriptionStart), \n\t\t parseInt(m.TranscriptionEnd)],\n\t\t [doc._id, i]);\n\t}\n }\n};"},"maxlength":{"map":"function(doc) {\n if (doc.Maps) {\n\tfor (i = 0; i < doc.Maps.length; i++) {\n\t m = doc.Maps[i];\n\t emit([m.Chromosome, doc._id], \n\t\t m.TranscriptionEnd - m.TranscriptionStart + 1);\n\t}\n }\n};","reduce":"function(keys, values) {\r\n var c = null;\r\n for (i = 0; i < values.length; i++) {\r\n\tvar a = parseInt(values[i]);\r\n\tif (a == null) break;\r\n\tif (c == null) c = a;\r\n\tif (a > c) c = a;\r\n }\r\n return(c);\r\n}"}},"lists":{"htmlUnique":"function(head, req) {\n var row;\n var p = req.path;\n var view = p[p.length-1];\n var sk = req.query.startkey;\n var ek = req.query.endkey;\n var skn = null;\n var ekn = null;\n if (sk[3]) {\n \tskn = sk[3];\n }else{\n \tskn=sk[2];\n }\n if (ek[2]) {\n \tekn = ek[2];\n }else{\n \tekn=ek[3];\n }\n var build=sk[0]\n var chr=sk[1]\n var seen = new Object;\n start({ \"headers\": { \"Content-Type\": \"text/html\" }});\n while (row = getRow()) {\n\t\tif (row.doc) {\n\t\t var doc = row.doc;\n\t\t var sym = doc.Symbol;\n\t\t if (seen[sym]) continue;\n\t\t seen[sym] = 1;\n\t\t var y = '';\n\t\t // if (doc.Maps && view == 'by_location') {\n\t\t\t\t// var v = row.value[1];\n\t\t\t\t// var m = doc.Maps[v];\n\t\t\t\t// if (skn && m.TranscriptionEnd < skn) {\n\t\t\t\t// continue;\n\t\t\t\t// } else if (ekn && m. TranscriptionStart > ekn) {\n\t\t\t\t// continue;\n\t\t\t\t// } else {\n\t\t\t\t// y = '
Mapped to chromosome ' + m.Chromosome + \n\t\t\t\t// \t'. Transcription starts at '+ m.TranscriptionStart + \n\t\t\t\t// \t' and ends at ' + m.TranscriptionEnd + '
\\n';\n\t\t\t\t// // }\n\t\t\t\t \n\t\t // }\n\t\t if (doc.Maps && view == 'by_location'){\n\t\t \t\n\t\t \tfor (var i=0;iBuild :'+m.UCSC+'. Mapped to chromosome ' + m.Chromosome + \n\t\t\t\t\t\t \t'. Transcription starts at '+ m.TranscriptionStart + \n\t\t\t\t\t\t \t' and ends at ' + m.TranscriptionEnd + '
\\n';\n\t\t\t\t\t\t \t\tx = 'Entrez gene:' + doc._id + '. ';\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t \tx += '
check:' + chr+ '.' + skn+ '.'+ekn +'. ';\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t if (doc.Cytoband) {\n\t\t\t\t\t\t\t\t\tx += '
Located at cytoband ' + doc.Cytoband + '
\\n';\n\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t x += y;\n\t\t\t\t\t\t\t if (m.GenBank) {\n\t\t\t\t\t\t\t\t\tx += 'GenBank reference sequence: ' + m.GenBank;\n\t\t\t\t\t\t\t\t\tif (doc.dbXrefs && doc.dbXrefs.Ensembl) {\n\t\t\t\t\t\t\t\t\t x += '. Ensembl ID: ' + doc.dbXrefs.Ensembl;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t if (doc.UniGene) {\n\t\t\t\t\t\t\t\t\tx += '\\nUniGene cluster: ' + doc.UniGene;\n\t\t\t\t\t\t\t }\t \n\t\t\t\t\t\t\t x += '
\\n';\n\t\t\t\t\t\t\t x += 'Mapped to chromosome ' + m.Chromosome + \n\t\t '. Transcription starts at '+ a + \n\t\t ' and ends at ' + b + '
\\n';\n\t }\n\t x = 'Located at cytoband ' + doc.Cytoband + '
\\n';\n\t }\n\t x += y;\n\t x += 'Entrez gene:' + doc._id + '. ';\n\t if (doc.GenBank) {\n\t\tx += 'GenBank reference sequence: ' + doc.GenBank;\n\t\tif (doc.dbXrefs && doc.dbXrefs.Ensembl) {\n\t\t x += '. Ensembl ID: ' + doc.dbXrefs.Ensembl;\n\t\t}\n\t }\n\t if (doc.UniGene) {\n\t\tx += '\\n
UniGene cluster: ' + doc.UniGene;\n\t }\t \n\t x += '
\\n';\n\t if (doc.Probes) {\n\t\tvar z = 'Mapped to chromosome ' + m.Chromosome + \n\t\t\t\t '. Transcription starts at '+ a + \n\t\t\t \t ' and ends at ' + b + ' (UCSC '+build+' NCBI '+NCBI+')
\\n';\n\t\t\t// if (NCBI == \"v37\"){\n\t\t\t// \ty += 'Mapped to chromosome ' + m.Chromosome + \n\t\t\t// \t '. Transcription starts at '+ a + \n\t\t\t// \t ' and ends at ' + b + ' (UCSC hg19)
\\n';\n\n\t\t\t// }else if(NCBI == \"GRCh37\"){\n\t\t\t// \ty += 'Mapped to chromosome ' + m.Chromosome + \n\t\t\t// \t '. Transcription starts at '+ a + \n\t\t\t// \t ' and ends at ' + b + ' (GENCODE GRCh37)
\\n';\n\t\t\t// }else {\n\t\t\t// \ty += 'Mapped to chromosome ' + m.Chromosome + \n\t\t\t// '.
\\n';\n\t\t // }\n\t\t\t// y += 'Mapped to chromosome ' + m.Chromosome + \n\t\t\t// '. Transcription starts at '+ a + \n\t\t\t// ' and ends at ' + b + '
\\n';\n\t\t // }\n\t\t x = 'Located at cytoband ' + doc.Cytoband + '
\\n';\n\t\t }\n\t\t x += y;\n\t\t x += 'Entrez gene:' + doc._id + '. ';\n\t\t if (doc.GenBank) {\n\t\t\t\tx += 'GenBank reference sequence: ' + doc.GenBank;\n\t\t\t\tif (doc.dbXrefs && doc.dbXrefs.Ensembl) {\n\t\t\t\t x += '. Ensembl ID: ' + doc.dbXrefs.Ensembl;\n\t\t\t\t}\n\t\t }\n\t\t if (doc.UniGene) {\n\t\t\t\tx += '\\n
UniGene cluster: ' + doc.UniGene;\n\t\t }\t \n\t\t x += '
\\n';\n\t\t x += 'Located at cytoband ' + doc.Cytoband + '
\\n'\r\n }\r\n if (doc.GenBank) {\r\n\tx += 'GenBank reference sequence: ' + doc.GenBank+ '
\\n'\r\n }\r\n x += 'Mapped to chromosome ' + m.Chromosome + \r\n\t '. Transcription starts at '+ a + \r\n\t ' and ends at ' + b + '
\\n';\r\n }\r\n x = 'Located at cytoband ' + doc.Cytoband + '
\\n'\r\n }\r\n x += y;\r\n x += 'Entrez gene: ' + doc._id + '. ';\r\n if (doc.GenBank) {\r\n\tx += '
GenBank reference sequence: ' + doc.GenBank+ '
\\n'\r\n }\r\n if (doc.UniGene) {\r\n\tx += '\\nUniGene cluster: ' + doc.UniGene;\r\n }\r\n x += '
';\r\n if (doc.Probes) {\r\n\tvar z = '