-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated functions in network-dal.js and protein-dal.js to reflect new…
… namespaces and addition of timestamp. need to test that queries work correctly
- Loading branch information
1 parent
2abe82e
commit a0ab429
Showing
2 changed files
with
42 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,15 +18,22 @@ var sequelize = new Sequelize( | |
); | ||
|
||
const buildNetworkSourceQuery = function () { | ||
return "SELECT * FROM protein_protein_interactions.source ORDER BY time_stamp DESC;"; | ||
return `SELECT * FROM protein_protein_interactions.source | ||
UNION ALL | ||
SELECT * FROM protein_protein_interactions_new.source | ||
ORDER BY time_stamp DESC;`; | ||
}; | ||
|
||
const buildNetworkFromGeneProteinQuery = function (geneProtein) { | ||
const buildNetworkFromGeneProteinQuery = function (geneProtein, timestamp) { | ||
const namespace = | ||
timestamp < new Date("2025-01-01") | ||
? "protein_protein_interactions" | ||
: "protein_protein_interactions_new"; | ||
return `SELECT DISTINCT gene_id, display_gene_id, standard_name, length, molecular_weight, PI FROM | ||
protein_protein_interactions.gene, protein_protein_interactions.protein WHERE | ||
(LOWER(gene.gene_id)=LOWER('${geneProtein}') OR LOWER(gene.display_gene_id)=LOWER('${geneProtein}') | ||
OR LOWER(protein.standard_name) =LOWER('${geneProtein}')) AND | ||
LOWER(gene.gene_id) = LOWER(protein.gene_systematic_name);`; | ||
${namespace}.gene, ${namespace}.protein WHERE | ||
(LOWER(gene.gene_id)=LOWER('${geneProtein}') OR LOWER(gene.display_gene_id)=LOWER('${geneProtein}') | ||
OR LOWER(protein.standard_name) =LOWER('${geneProtein}')) AND | ||
LOWER(gene.gene_id) = LOWER(protein.gene_systematic_name) AND gene.time_stamp = ${timestamp};`; | ||
This comment has been minimized.
Sorry, something went wrong.
ntran18
Collaborator
|
||
}; | ||
|
||
const buildNetworkProteinsQuery = function (proteinString) { | ||
|
@@ -40,10 +47,15 @@ const buildNetworkProteinsQuery = function (proteinString) { | |
}; | ||
|
||
const buildGenerateProteinNetworkQuery = function (proteins, timestamp, source) { | ||
return `SELECT DISTINCT protein1, protein2 FROM | ||
protein_protein_interactions.physical_interactions WHERE | ||
physical_interactions.time_stamp='${timestamp}' AND physical_interactions.source='${source}' AND | ||
${buildNetworkProteinsQuery(proteins)} ORDER BY protein1 DESC;`; | ||
const namespace = | ||
timestamp < new Date("2025-01-01") | ||
? "protein_protein_interactions" | ||
: "protein_protein_interactions_new"; | ||
const annotation = | ||
timestamp < new Date("2025-01-01") ? "" : ", annotation_type"; | ||
return `SELECT DISTINCT protein1, protein2${annotation} FROM ${namespace}.physical_interactions | ||
${namespace}.time_stamp='${timestamp}' AND ${namespace}.source='${source}' AND | ||
${buildNetworkProteinsQuery(proteins)} ORDER BY protein1 DESC;`; | ||
}; | ||
|
||
const buildQueryByType = function (query) { | ||
|
1 comment
on commit a0ab429
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be nice if you can add constants for different namespaces
This would not work for old namespace because it doesn't have time_stamp