Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 10 additions & 14 deletions database/schema/README.md

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The provenance of the branch looks good now, but it looks like your first commit (0793d5e) piggy-backed this file unintentionally. We can talk about how that might have happened this time and what can be done to avoid it, but in terms of finalizing this PR, can you redo the branch one more time and make sure that your committed changes have just your intended changes exclusively. The redo will also help you determine how/why this file found its way to your commit

Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@ For example, to access your local PostgreSQL database, use the following command
```
psql postgresql://localhost/postgres
```
or
```
psql -U postgres postgresql://localhost/postgres
```

## Creating Schemas and Adding Table Specifications

Expand All @@ -39,11 +35,11 @@ GRNsight requires six schemas, one for each of the following namespaces:
5. `gene_regulatory_network` (this is the old schema for the gene regulatory network database before 2025 - this namepsace can be empty because we no longer load data into this namespace)
6. `protein_protein_interactions` (this is the old schema for the protein protein interactions database before 2025 - this namepsace can be empty because we no longer load data into this namespace)

The scripts already contain the commands to create the schemas for you. Each schema requires a set of table definitions. You can add these by running the following commands, each corresponding to an SQL file that defines the structure for each schema.
The scripts already contain the command to create the schema for you. Each schema requires a set of table definitions. You can add these by running the following commands, each corresponding to an SQL file that defines the structure for each schema.

First, outside of postgres, navigate to the `schema` folder in your local copy of the GRNsight repository:
```
cd <path to schema folder>
cd <path to `schema` folder>
```

Then run the following commands. Note that for any command that begins with `psql`, you need to be _outside_ of postgres to run it. Also, you may need to specify the database username in front of localhost, i.e., use `postgresql://postgres@localhost/postgres` for each of the following commands.
Expand Down Expand Up @@ -77,9 +73,9 @@ Once these steps are completed, your database will be set up and ready to accept

### 1. Settings Database

The `settings` table stores the default expression dataset name that is used for the node coloring dropdown menu in GRNsight.
The `settings` table stores the default database name for the node coloring dropdown menu. Question: is this optional?

You need to change the default expression dataset name by following these steps:
To change the default database name, follow these steps:

1. **Log in to the Database**

Expand All @@ -95,19 +91,19 @@ You need to change the default expression dataset name by following these steps:

3. **Delete the Current Default Database Name**

Delete the existing expression dataset name with this command:
Delete the existing database name with this command:

```
DELETE FROM grnsettings;
```

4. **Insert the New Default Expression Dataset Name**
Insert the new default dataset name with the following command:
4. **Insert the New Default Database Name**
Insert the new default database name with the following command:
```
INSERT INTO grnsettings(expression_dataset) VALUES ('<new default dataset name>');
INSERT INTO grnsettings(expression_dataset) VALUES ('<new default database name>');
```
_Note: The current default expression dataset is `dahlquist_2018`. Don't forget!_
_Note: The current default database is `dahlquist_2018`. Don't forget!_

### 2. Other databases

For other databases, continue follow the instructions in the [README.md](https://github.com/dondi/GRNsight/tree/main/database/README.md#3-populate-data-into-database) outside of this directory.
For other databases, continue follow the instructions in the [README.md](https://github.com/dondi/GRNsight/tree/main/database) outside of this directory.
29 changes: 21 additions & 8 deletions web-client-classic/public/js/upload.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,24 @@ export const filenameWithExtension = function (mode, genes, edges, type, extensi
filename = filename.substr(0, filename.length - currentExtension[0].length);
}
if (mode === NETWORK_GRN_MODE && extension === "xlsx") {
source = $("input[name=expressionSource]:checked")[0].value;
if (source === "none") {
const anyExpressionChecked = $("input[name=workbookSheets]:checked")
.toArray()
.some(
el => el.value && (el.value.includes("expression") || el.value.includes("sigma"))
);

if (anyExpressionChecked) {
source = $("input[name=expressionSource]:checked")[0].value;
if (source === "none") {
source = null;
} else if (source === "userInput") {
// only demos will have an expression source
source = grnState.workbook.expression.source
? grnState.workbook.expression.source
: "user-data";
}
} else {
Comment on lines +64 to +74

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For now, we can keep this code as-is. But for future reference—and we’ll see if there’s time to discuss this at the meeting—what the code is doing here represents a higher-level programming pattern of imperative code whose sole result is the value of a single variable (source). When you have code that does this, there is an alternative approach that does not rely on side effects (and again if you’re unfamiliar with the term, we can discuss that)

In broader practice, this latter alternative (which will also be good for Alex to know) is generally considered safer and more robust, so even though what you have here is functionally equivalent, in terms of programming craft, the alternative is recommended. We can discuss this at some future juncture; it doesn’t need to block this PR

source = null;
} else if (source === "userInput") {
// only demos will have an expression source
source = grnState.workbook.expression.source
? grnState.workbook.expression.source
: "user-data";
}
}

Expand Down Expand Up @@ -526,7 +536,10 @@ export const upload = function () {
<label for='exportExcelExpressionSource-noneRadio' id='exportExcelExpressionSource-none' class='export-radio-label'>None</label>
</li>
`;
if (Object.keys(grnState.workbook.expression).length > 0) {
if (
Object.keys(grnState.workbook.expression).length > 0 &&
grnState.workbook.expression.hasOwnProperty("source")
) {
const isChecked = grnState.nodeColoring.nodeColoringEnabled ? `checked="true"` : "";
result += `
<li>
Expand Down
Loading