forked from cBioPortal/cbioportal-core
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5e0f5bc
commit 99608a2
Showing
6 changed files
with
126 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
root = true | ||
|
||
[*] | ||
end_of_line = lf | ||
insert_final_newline = true | ||
|
||
[*.{java,py}] | ||
indent_style = space | ||
indent_size = 4 |
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
74 changes: 74 additions & 0 deletions
74
src/main/java/org/mskcc/cbio/portal/dao/DaoSingleCellExpression.java
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 |
---|---|---|
@@ -0,0 +1,74 @@ | ||
/* | ||
* Copyright (c) 2024 The Hyve B.V. | ||
* This code is licensed under the GNU Affero General Public License (AGPL), | ||
* version 3, or (at your option) any later version. | ||
*/ | ||
|
||
/* | ||
* This file is part of cBioPortal. | ||
* | ||
* cBioPortal is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License as | ||
* published by the Free Software Foundation, either version 3 of the | ||
* License. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
/* | ||
* @author Matthijs Pon | ||
*/ | ||
|
||
package org.mskcc.cbio.portal.dao; | ||
|
||
import java.sql.*; | ||
import org.mskcc.cbio.portal.model.*; | ||
|
||
public class DaoSingleCellExpression { | ||
|
||
private DaoSingleCellExpression() { | ||
} | ||
|
||
/** | ||
* Set genetic profile link in `genetic_profile_link` table in database. | ||
* @throws DaoException | ||
**/ | ||
public static void addSingleCellExpression(int geneticProfileId, int entrezGeneId, String tissue, String cellType, String[] sampleIds, String[] values) throws DaoException { | ||
Connection connection = null; | ||
PreparedStatement preparedStatement = null; | ||
ResultSet resultSet = null; | ||
|
||
try { | ||
// Open connection to database | ||
connection = JdbcUtil.getDbConnection(DaoGeneticProfileLink.class); | ||
|
||
// Prepare SQL statement | ||
preparedStatement = connection.prepareStatement("INSERT INTO single_cell_expression " | ||
+ "(GENETIC_PROFILE_ID, SAMPLE_ID, TISSUE, CELL_TYPE, ENTREZ_GENE_ID, EXPRESSION_VALUE) VALUES (?,?,?,?,?,?)"); | ||
for (int i = 0; i < sampleIds.length; i++) { | ||
// for (String expressionValue: values) { | ||
// Fill in statement | ||
preparedStatement.setInt(1, geneticProfileId); | ||
preparedStatement.setInt(2, sampleIds[i]); | ||
preparedStatement.setString(3, tissue); | ||
preparedStatement.setString(4, cellType); | ||
preparedStatement.setInt(5, entrezGeneId); | ||
preparedStatement.setFloat(6, Float.valueOf(values[i])); | ||
preparedStatement.addBatch(); | ||
} | ||
|
||
// Execute statement | ||
preparedStatement.executeBatch(); | ||
} catch (SQLException e) { | ||
throw new DaoException(e); | ||
} finally { | ||
JdbcUtil.closeAll(DaoGeneticProfileLink.class, connection, preparedStatement, resultSet); | ||
} | ||
} | ||
} |
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
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