Skip to content

Commit

Permalink
now make query based on timestamp and source. all queries seem to be …
Browse files Browse the repository at this point in the history
…working
  • Loading branch information
ceciliazaragoza committed Feb 26, 2025
1 parent 87709ff commit ec6906a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
4 changes: 3 additions & 1 deletion server/dals/network-dal.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ const buildNetworkSourceQuery = function () {

const buildNetworkGeneFromSourceQuery = function (gene, source, timestamp) {
const namespace = `${timestampNamespace(timestamp, true)}.gene`;
const timestampQuery = isTimestampOld(timestamp) ? "" : `AND gene.time_stamp='${timestamp}'`;
const timestampQuery = isTimestampOld(timestamp)
? ""
: `AND gene.time_stamp='${timestamp}' AND gene.source='${source}'`;

return `SELECT DISTINCT gene_id, display_gene_id FROM
${namespace} WHERE (gene.gene_id ='${gene}'
Expand Down
8 changes: 5 additions & 3 deletions server/dals/protein-dal.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@ const buildNetworkSourceQuery = function () {
ORDER BY time_stamp DESC;`;
};

const buildNetworkFromGeneProteinQuery = function (geneProtein, timestamp) {
const buildNetworkFromGeneProteinQuery = function (geneProtein, source, timestamp) {
const namespace = timestampNamespace(timestamp, false);
const timestampQuery = isTimestampOld(timestamp) ? "" : `AND gene.time_stamp='${timestamp}'`;
const timestampQuery = isTimestampOld(timestamp)
? ""
: `AND gene.time_stamp='${timestamp}' AND gene.source='${source}'`;
console.log("timestampquery", timestampQuery);
return `SELECT DISTINCT gene_id, display_gene_id, standard_name, length, molecular_weight, PI FROM
${namespace}.gene, ${namespace}.protein WHERE
Expand Down Expand Up @@ -54,7 +56,7 @@ const buildGenerateProteinNetworkQuery = function (proteins, timestamp, source)
const buildQueryByType = function (query) {
const networkQueries = {
NetworkSource: () => buildNetworkSourceQuery(),
NetworkFromGeneProtein: () => buildNetworkFromGeneProteinQuery(query.geneProtein),
NetworkFromGeneProtein: () => buildNetworkFromGeneProteinQuery(query.geneProtein, query.timestamp, query.source),

Check failure on line 59 in server/dals/protein-dal.js

View workflow job for this annotation

GitHub Actions / build (18.x)

Line 59 exceeds the maximum line length of 120

Check failure on line 59 in server/dals/protein-dal.js

View workflow job for this annotation

GitHub Actions / build (20.x)

Line 59 exceeds the maximum line length of 120
GenerateProteinNetwork: () => buildGenerateProteinNetworkQuery(query.proteins, query.timestamp, query.source),
};
if (Object.keys(networkQueries).includes(query.type)) {
Expand Down

0 comments on commit ec6906a

Please sign in to comment.