|
|
@@ -12,127 +12,82 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
|
};
|
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
+const fs_1 = __importDefault(require("fs"));
|
|
|
const path_1 = __importDefault(require("path"));
|
|
|
const piscina_1 = __importDefault(require("piscina"));
|
|
|
-(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
- const getEsearch = new piscina_1.default({
|
|
|
- filename: path_1.default.resolve(__dirname, './workers/esearch.js')
|
|
|
- });
|
|
|
- // https://www.ncbi.nlm.nih.gov/books/NBK25499/
|
|
|
- const orders = [
|
|
|
- // {
|
|
|
- // params: {
|
|
|
- // db: 'nuccore',
|
|
|
- // id: '1674999401',
|
|
|
- // rettype: 'gb',
|
|
|
- // retmode: 'text'
|
|
|
- // },
|
|
|
- // xpath: '/',
|
|
|
- // endpoint: 'https://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi'
|
|
|
- // },
|
|
|
- // {
|
|
|
- // db: 'nuccore',
|
|
|
- // id: '1674999401',
|
|
|
- // rettype: 'native',
|
|
|
- // retmode: 'xml',
|
|
|
- // endpoint: 'https://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi'
|
|
|
- // },
|
|
|
- // {
|
|
|
- // term: 'NOTCH1 AND Human AND Refseq',
|
|
|
- // db: 'nuccore',
|
|
|
- // endpoint: 'https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi',
|
|
|
- // query: `$..Id`
|
|
|
- // },
|
|
|
- // {
|
|
|
- // term: 'NOTCH1[Gene Name]+AND+Human',
|
|
|
- // db: 'gene',
|
|
|
- // endpoint: 'https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi',
|
|
|
- // query: `$..Id`
|
|
|
- // },
|
|
|
- // {
|
|
|
- // db: 'pubmed',
|
|
|
- // id: '19393038',
|
|
|
- // retmode: 'xml',
|
|
|
- // endpoint: 'https://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi',
|
|
|
- // //query: `$..AbstractText[?(@.Label==='RESULTS')]`
|
|
|
- // query: `$..AbstractText`
|
|
|
- // },
|
|
|
- {
|
|
|
- db: 'gene',
|
|
|
- id: '4851',
|
|
|
- retmode: 'xml',
|
|
|
- endpoint: 'https://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi',
|
|
|
- query: [
|
|
|
- `{ "Locus" : **.Gene_ref_locus,
|
|
|
- "Synonyms" : [**.Entrezgene_gene.**.Gene_ref_syn_E],
|
|
|
- "Update_Date" : **.Gene_track_update_date.Date.Date_std.Date_std.{"Year": Date_std_year, "Month": Date_std_month, "Day": Date_std_month},
|
|
|
- "Location" : **.Gene_ref_maploc,
|
|
|
- "Summary" : **.Entrezgene_summary,
|
|
|
- "Genomic_Position": **.Entrezgene_locus.Gene_commentary[Gene_commentary_type.value='genomic'][0].{
|
|
|
- "Accession": Gene_commentary_accession,
|
|
|
- "Positions": $.{
|
|
|
- "from" : Gene_commentary_seqs.**.Seq_interval_from,
|
|
|
- "to" : Gene_commentary_seqs.**.Seq_interval_to,
|
|
|
- "strand": Gene_commentary_seqs.**.Na_strand.value
|
|
|
- }
|
|
|
- },
|
|
|
- "Gene_Ontology" : **.Entrezgene_properties.Gene_commentary[Gene_commentary_heading='GeneOntology'].Gene_commentary_comment.{
|
|
|
- "Functions" : Gene_commentary[Gene_commentary_label='Function'].Gene_commentary_comment.Gene_commentary.{
|
|
|
- "ID" : Gene_commentary_source.Other_source.**.Object_id_id,
|
|
|
- "Pre_Text": Gene_commentary_source.Other_source.Other_source_pre_text,
|
|
|
- "Anchor" : Gene_commentary_source.Other_source.Other_source_anchor
|
|
|
- },
|
|
|
- "Processes" : Gene_commentary[Gene_commentary_label='Process'].Gene_commentary_comment.Gene_commentary.{
|
|
|
- "ID" : Gene_commentary_source.Other_source.**.Object_id_id,
|
|
|
- "Pre_Text": Gene_commentary_source.Other_source.Other_source_pre_text,
|
|
|
- "Anchor" : Gene_commentary_source.Other_source.Other_source_anchor
|
|
|
- },
|
|
|
- "Components" : Gene_commentary[Gene_commentary_label='Component'].Gene_commentary_comment.Gene_commentary.{
|
|
|
- "ID" : Gene_commentary_source.Other_source.**.Object_id_id,
|
|
|
- "Pre_Text": Gene_commentary_source.Other_source.Other_source_pre_text,
|
|
|
- "Anchor" : Gene_commentary_source.Other_source.Other_source_anchor
|
|
|
- }
|
|
|
- },
|
|
|
- "Transcript": {
|
|
|
- "Accession" : **.'Entrezgene_comments'.'Gene_commentary'[Gene_commentary_heading='NCBI Reference Sequences (RefSeq)'].**.Gene_commentary[Gene_commentary_heading='mRNA Sequence'][0].Gene_commentary_accession,
|
|
|
- "Exon_Count": **.'Entrezgene_properties'.'Gene_commentary'[Gene_commentary_label='Exon count'].Gene_commentary_text
|
|
|
+const NCBIGeneTemplate = (id) => {
|
|
|
+ return {
|
|
|
+ db: 'gene',
|
|
|
+ id,
|
|
|
+ retmode: 'xml',
|
|
|
+ endpoint: 'https://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi',
|
|
|
+ query: [
|
|
|
+ `{ "Locus" : **.Gene_ref_locus,
|
|
|
+ "Update_Date" : **.Gene_track_update_date.Date.Date_std.Date_std.{"Year": Date_std_year, "Month": Date_std_month, "Day": Date_std_month},
|
|
|
+ "Location" : **.Gene_ref_maploc,
|
|
|
+ "Summary" : **.Entrezgene_summary,
|
|
|
+ "Genomic_Position": **.Entrezgene_locus.Gene_commentary[Gene_commentary_type.value='genomic'][0].{
|
|
|
+ "Accession": Gene_commentary_accession,
|
|
|
+ "Positions": $.{
|
|
|
+ "from" : Gene_commentary_seqs.**.Seq_interval_from,
|
|
|
+ "to" : Gene_commentary_seqs.**.Seq_interval_to,
|
|
|
+ "strand": Gene_commentary_seqs.**.Na_strand.value
|
|
|
+ }
|
|
|
+ },
|
|
|
+ "Gene_Ontology" : **.Entrezgene_properties.Gene_commentary[Gene_commentary_heading='GeneOntology'].Gene_commentary_comment.{
|
|
|
+ "Functions" : Gene_commentary[Gene_commentary_label='Function'].Gene_commentary_comment.Gene_commentary.{
|
|
|
+ "ID" : Gene_commentary_source.Other_source.**.Object_id_id,
|
|
|
+ "Pre_Text": Gene_commentary_source.Other_source.Other_source_pre_text,
|
|
|
+ "Anchor" : Gene_commentary_source.Other_source.Other_source_anchor
|
|
|
},
|
|
|
- "Products": **.'Entrezgene_comments'.'Gene_commentary'[Gene_commentary_heading='NCBI Reference Sequences (RefSeq)'].**.Gene_commentary[Gene_commentary_heading='mRNA Sequence'][0].Gene_commentary_products.Gene_commentary[Gene_commentary_heading='Product'][0].{
|
|
|
- "Accession": Gene_commentary_accession,
|
|
|
- "Domains" : Gene_commentary_comment.Gene_commentary[Gene_commentary_heading='Conserved Domains'].Gene_commentary_comment.Gene_commentary.{
|
|
|
- "DB" : Gene_commentary_source.**.Dbtag_db,
|
|
|
- "ID" : Gene_commentary_source.**.Object_id_id,
|
|
|
- "Anchor" : Gene_commentary_source.**.Other_source_anchor,
|
|
|
- "Location": Gene_commentary_comment.**.Gene_commentary_text
|
|
|
- }
|
|
|
+ "Processes" : Gene_commentary[Gene_commentary_label='Process'].Gene_commentary_comment.Gene_commentary.{
|
|
|
+ "ID" : Gene_commentary_source.Other_source.**.Object_id_id,
|
|
|
+ "Pre_Text": Gene_commentary_source.Other_source.Other_source_pre_text,
|
|
|
+ "Anchor" : Gene_commentary_source.Other_source.Other_source_anchor
|
|
|
},
|
|
|
- "Biblio_PMID": **.PubMedId
|
|
|
- }`
|
|
|
- ]
|
|
|
- },
|
|
|
- // {
|
|
|
- // db: 'gene',
|
|
|
- // id: '4851',
|
|
|
- // retmode: 'xml',
|
|
|
- // endpoint: 'https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esummary.fcgi',
|
|
|
- // //query: `$..AbstractText[?(@.Label==='RESULTS')]`
|
|
|
- // query: [
|
|
|
- // `$..Name`,
|
|
|
- // `$..Description`,
|
|
|
- // `$..MapLocation`,
|
|
|
- // '$..OtherAliases',
|
|
|
- // `$..OtherDesignations`,
|
|
|
- // '$..ChrLoc',
|
|
|
- // `$..GenomicInfoType..ChrAccVer`,
|
|
|
- // '$..GenomicInfoType..ChrStart',
|
|
|
- // '$..GenomicInfoType..ChrStop',
|
|
|
- // '$..ExonCount',
|
|
|
- // '$..GeneWeight',
|
|
|
- // '$..Summary',
|
|
|
- // ]
|
|
|
- // },
|
|
|
- ];
|
|
|
- const results = yield Promise.all(orders.map(e => getEsearch.run(e)));
|
|
|
- console.log(orders.map((e, i) => (Object.assign(Object.assign({}, e), { results: results[i] })))[0].results.value);
|
|
|
- // await fs.promises.writeFile('test.json',JSON.stringify(orders.map((e:any, i) => ({...e, results: results[i]})).map(e => e.results)[0]))
|
|
|
+ "Components" : Gene_commentary[Gene_commentary_label='Component'].Gene_commentary_comment.Gene_commentary.{
|
|
|
+ "ID" : Gene_commentary_source.Other_source.**.Object_id_id,
|
|
|
+ "Pre_Text": Gene_commentary_source.Other_source.Other_source_pre_text,
|
|
|
+ "Anchor" : Gene_commentary_source.Other_source.Other_source_anchor
|
|
|
+ }
|
|
|
+ },
|
|
|
+ "Transcript": {
|
|
|
+ "Accession" : **.'Entrezgene_comments'.'Gene_commentary'[Gene_commentary_heading='NCBI Reference Sequences (RefSeq)'].**.Gene_commentary[Gene_commentary_heading='mRNA Sequence'][0].Gene_commentary_accession,
|
|
|
+ "Exon_Count": **.'Entrezgene_properties'.'Gene_commentary'[Gene_commentary_label='Exon count'].Gene_commentary_text
|
|
|
+ },
|
|
|
+ "Products": **.'Entrezgene_comments'.'Gene_commentary'[Gene_commentary_heading='NCBI Reference Sequences (RefSeq)'].**.Gene_commentary[Gene_commentary_heading='mRNA Sequence'][0].Gene_commentary_products.Gene_commentary[Gene_commentary_heading='Product'][0].{
|
|
|
+ "Accession": Gene_commentary_accession,
|
|
|
+ "Domains" : Gene_commentary_comment.Gene_commentary[Gene_commentary_heading='Conserved Domains'].Gene_commentary_comment.Gene_commentary.{
|
|
|
+ "DB" : Gene_commentary_source.**.Dbtag_db,
|
|
|
+ "ID" : Gene_commentary_source.**.Object_id_id,
|
|
|
+ "Anchor" : Gene_commentary_source.**.Other_source_anchor,
|
|
|
+ "Location": Gene_commentary_comment.**.Gene_commentary_text
|
|
|
+ }
|
|
|
+ },
|
|
|
+ "Biblio_PMID": **.PubMedId
|
|
|
+ }`
|
|
|
+ ]
|
|
|
+ };
|
|
|
+};
|
|
|
+const searchGeneTemplate = (name) => {
|
|
|
+ return {
|
|
|
+ term: name + '[Gene Name]+AND+Human[Organism] ',
|
|
|
+ db: 'gene',
|
|
|
+ endpoint: 'https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi',
|
|
|
+ query: `{"First_ID": **.Id[0]}`
|
|
|
+ };
|
|
|
+};
|
|
|
+const getEsearch = new piscina_1.default({
|
|
|
+ filename: path_1.default.resolve(__dirname, './workers/esearch.js')
|
|
|
+});
|
|
|
+const getGene = (name) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
+ const id = (yield Promise.all([searchGeneTemplate(name)].map(e => getEsearch.run(e))))[0].value.First_ID;
|
|
|
+ const result = (yield Promise.all([NCBIGeneTemplate(String(id))].map(e => getEsearch.run(e))))[0].value;
|
|
|
+ return result;
|
|
|
+});
|
|
|
+(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
+ // https://www.ncbi.nlm.nih.gov/books/NBK25499/
|
|
|
+ const r = yield getGene('ZFP36L2');
|
|
|
+ console.log(r);
|
|
|
+ yield fs_1.default.promises.writeFile('test.json', JSON.stringify(r));
|
|
|
}))();
|