Skip to content

Commit

Permalink
Merge pull request #2641 from jjgao/merge-hotfix-to-master
Browse files Browse the repository at this point in the history
release 1.6.3
  • Loading branch information
jjgao authored Jun 23, 2017
2 parents ff08c25 + 71fcaf9 commit c9d2b7d
Show file tree
Hide file tree
Showing 30 changed files with 544 additions and 390 deletions.
28 changes: 28 additions & 0 deletions OPEN-SOURCE-DOCUMENTATION
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ [email protected].
* FileSaver.min
* Font Awesome (CSS)
* Font Awesome (Fonts)
* clusterfck.min.js


ant-1.7.0
Expand Down Expand Up @@ -19686,3 +19687,30 @@ INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.

clusterfck.min.js
-----------------
From: https://github.com/tayden/clusterfck

Available under license:

Copyright (c) 2011 Heather Arthur <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2 changes: 1 addition & 1 deletion app.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
},
"MAVEN_CUSTOM_OPTS": {
"description":"set heroku profile for mvn",
"value":"-Pheroku,public -DskipTests -Dfinal.war.name=cbioportal -Ddb.user=cbio_user -Ddb.password=cbio_pass -Ddb.portal_db_name=public_test -Dtomcat.catalina.scope=runtime -Ddb.connection_string=jdbc:mysql://sm4sa6ozhn5ya6.cuooweljyhix.us-east-1.rds.amazonaws.com:3306/ -Ddb.host=sm4sa6ozhn5ya6.cuooweljyhix.us-east-1.rds.amazonaws.com"
"value":"-Pheroku,public -DskipTests -Dfinal.war.name=cbioportal -Ddb.user=cbio_user -Ddb.password=cbio_pass -Ddb.portal_db_name=public_test_small -Dtomcat.catalina.scope=runtime -Ddb.connection_string=jdbc:mysql://sm4sa6ozhn5ya6.cuooweljyhix.us-east-1.rds.amazonaws.com:3306/ -Ddb.host=sm4sa6ozhn5ya6.cuooweljyhix.us-east-1.rds.amazonaws.com"
}
},
"buildpacks": [
Expand Down
2 changes: 1 addition & 1 deletion business/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<artifactId>master</artifactId>
<groupId>org.mskcc.cbio</groupId>
<version>1.6.2</version>
<version>1.6.3</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>business</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,6 @@ public List<GenePanel> getGenePanels() {
return genePanelMapper.getGenePanels();
}

@Override
public Sample getSampleByStableIdAndStudyId(String stableId, String studyId) {
return genePanelMapper.getSampleByStableIdAndStudyId(stableId, studyId);
}

@Override
public GeneticProfile getGeneticProfileByStableId(String stableId) {
return genePanelMapper.getGeneticProfileByStableId(stableId);
Expand Down Expand Up @@ -138,11 +133,6 @@ public void insertGenePanelListByHugo(Map<String, Object> map) {
genePanelMapper.insertGenePanelListByHugo(map);
}

@Override
public void insertGenePanelSampleProfileMap(Map<String, Object> map) {
genePanelMapper.insertGenePanelSampleProfileMap(map);
}

public void setGenePanelMapper(GenePanelMapper genePanelMapper) {
this.genePanelMapper = genePanelMapper;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ public interface GenePanelRepository {
// removed once a proper import solution is put in place.
List<GenePanel> getGenePanelByStableId(String stableId);
List<GenePanel> getGenePanels();
Sample getSampleByStableIdAndStudyId(String stableId, String studyId);
GeneticProfile getGeneticProfileByStableId(String stableId);
Gene getGeneByEntrezGeneId(Integer geneId);
Gene getGeneByHugoSymbol(String symbol);
Expand All @@ -64,5 +63,4 @@ public interface GenePanelRepository {
void deleteSampleProfileMappingByPanel(Integer panelId);
void insertGenePanelList(Map<String, Object> map);
void insertGenePanelListByHugo(Map<String, Object> map);
void insertGenePanelSampleProfileMap(Map<String, Object> map);
}
Original file line number Diff line number Diff line change
Expand Up @@ -148,43 +148,6 @@
from gene_panel
</select>

<select id="getSampleByStableIdAndStudyId" resultMap="sampleResultMap">
select
sample.INTERNAL_ID,
sample.STABLE_ID,
sample.SAMPLE_TYPE,
sample.PATIENT_ID,
patient.INTERNAL_ID,
patient.STABLE_ID,
patient.CANCER_STUDY_ID,
sample.TYPE_OF_CANCER_ID,
type_of_cancer.TYPE_OF_CANCER_ID,
type_of_cancer.NAME,
type_of_cancer.CLINICAL_TRIAL_KEYWORDS,
type_of_cancer.DEDICATED_COLOR,
type_of_cancer.SHORT_NAME,
type_of_cancer.PARENT,
cancer_study.CANCER_STUDY_ID,
cancer_study.CANCER_STUDY_IDENTIFIER,
cancer_study.TYPE_OF_CANCER_ID,
cancer_study.NAME,
cancer_study.SHORT_NAME,
cancer_study.DESCRIPTION,
cancer_study.PUBLIC,
cancer_study.PMID,
cancer_study.CITATION,
cancer_study.GROUPS,
cancer_study.STATUS
from sample
inner join patient on sample.PATIENT_ID = patient.INTERNAL_ID
inner join type_of_cancer on sample.TYPE_OF_CANCER_ID = type_of_cancer.TYPE_OF_CANCER_ID
inner join cancer_study on patient.CANCER_STUDY_ID = cancer_study.CANCER_STUDY_ID
where
sample.STABLE_ID = #{stableId}
and
cancer_study.CANCER_STUDY_IDENTIFIER=#{studyId}
</select>

<select id="getGeneByHugoSymbol" resultMap="geneResultMap">
select
gene.ENTREZ_GENE_ID,
Expand Down Expand Up @@ -313,8 +276,4 @@
(#{panelId}, (select ENTREZ_GENE_ID from gene where HUGO_GENE_SYMBOL = #{gene}))
</foreach>
</insert>

<insert id="insertGenePanelSampleProfileMap" parameterType="map" useGeneratedKeys="false">
update sample_profile set PANEL_ID = #{panelId} where SAMPLE_ID = #{sampleId} and GENETIC_PROFILE_ID = #{profileId}
</insert>
</mapper>
2 changes: 1 addition & 1 deletion core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<artifactId>master</artifactId>
<groupId>org.mskcc.cbio</groupId>
<version>1.6.2</version>
<version>1.6.3</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>core</artifactId>
Expand Down
84 changes: 84 additions & 0 deletions core/src/main/java/org/mskcc/cbio/portal/dao/DaoGenePanel.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
/*
* Copyright (c) 2017 Memorial Sloan-Kettering Cancer Center.
*
* This library 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. The software and documentation provided hereunder
* is on an "as is" basis, and Memorial Sloan-Kettering Cancer Center has no
* obligations to provide maintenance, support, updates, enhancements or
* modifications. In no event shall Memorial Sloan-Kettering Cancer Center be
* liable to any party for direct, indirect, special, incidental or
* consequential damages, including lost profits, arising out of the use of this
* software and its documentation, even if Memorial Sloan-Kettering Cancer
* Center has been advised of the possibility of such damage.
*/

/*
* 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/>.
*/

package org.mskcc.cbio.portal.dao;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.*;
import org.mskcc.cbio.portal.model.CancerStudy;
import org.mskcc.cbio.portal.model.GenePanel;

/**
*
* @author heinsz
*/
public class DaoGenePanel {
private static Map<String, GenePanel> genePanelMap = initMap();

public static GenePanel getGenePanelByStableId(String stableId) {
return genePanelMap.get(stableId);
}

private static Map<String, GenePanel> initMap() {
Map<String, GenePanel> genePanelMap = null;
Connection con = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
try {
con = JdbcUtil.getDbConnection(DaoCancerStudy.class);
pstmt = con.prepareStatement("SELECT * FROM gene_panel");
rs = pstmt.executeQuery();
genePanelMap = extractGenePanelMap(rs);
} catch (SQLException e) {
e.printStackTrace();
} finally {
JdbcUtil.closeAll(DaoCancerStudy.class, con, pstmt, rs);
}
return genePanelMap;
}

private static Map<String, GenePanel> extractGenePanelMap(ResultSet rs) throws SQLException {
Map<String, GenePanel> genePanelMap = new HashMap<>();
while(rs.next()) {
GenePanel gp = new GenePanel();
gp.setInternalId(rs.getInt("INTERNAL_ID"));
gp.setStableId(rs.getString("STABLE_ID"));
gp.setDescription(rs.getString("DESCRIPTION"));
genePanelMap.put(gp.getStableId(), gp);
}
return genePanelMap;
}

}
45 changes: 39 additions & 6 deletions core/src/main/java/org/mskcc/cbio/portal/dao/DaoSampleProfile.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,24 @@
*/
public final class DaoSampleProfile {
private DaoSampleProfile() {}

private static final int NO_SUCH_PROFILE_ID = -1;
private static final String TABLE_NAME = "sample_profile";

public static int addSampleProfile(int sampleId, int geneticProfileId, Integer panelId) throws DaoException {
public static int addSampleProfile(Integer sampleId, Integer geneticProfileId, Integer panelId) throws DaoException {
if (MySQLbulkLoader.isBulkLoad()) {
if (panelId != null) {
MySQLbulkLoader.getMySQLbulkLoader(TABLE_NAME).insertRecord(Integer.toString(sampleId),
Integer.toString(geneticProfileId),
Integer.toString(panelId));
}
else {
MySQLbulkLoader.getMySQLbulkLoader(TABLE_NAME).insertRecord(Integer.toString(sampleId),
Integer.toString(geneticProfileId), null);
}

return 1;
}

Connection con = null;
PreparedStatement pstmt = null;
Expand All @@ -65,7 +79,7 @@ public static int addSampleProfile(int sampleId, int geneticProfileId, Integer p
pstmt.setInt(3, panelId);
}
else {
pstmt.setNull(3, java.sql.Types.INTEGER);
pstmt.setNull(3, java.sql.Types.INTEGER);
}
return pstmt.executeUpdate();
} else {
Expand Down Expand Up @@ -102,7 +116,7 @@ public static boolean sampleExistsInGeneticProfile(int sampleId, int geneticProf
JdbcUtil.closeAll(DaoSampleProfile.class, con, pstmt, rs);
}
}

public static int countSamplesInProfile(int geneticProfileId) throws DaoException {
Connection con = null;
PreparedStatement pstmt = null;
Expand Down Expand Up @@ -258,8 +272,8 @@ public static List<Map<String, Object>> metaData(List<CancerStudy> cancerStudies
} finally {
JdbcUtil.closeAll(DaoMutation.class, con, pstmt, rs);
}
return data;

return data;
}

public static void deleteAllRecords() throws DaoException {
Expand All @@ -276,4 +290,23 @@ public static void deleteAllRecords() throws DaoException {
JdbcUtil.closeAll(DaoSampleProfile.class, con, pstmt, rs);
}
}

public static void deleteRecords(List<Integer> sampleIds, List<Integer> profileIds) throws DaoException {
Connection con = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
try {
con = JdbcUtil.getDbConnection(DaoSampleProfile.class);
for (int i = 0; i < sampleIds.size(); i++) {
pstmt = con.prepareCall("DELETE FROM sample_profile WHERE sample_id = ? and genetic_profile_id = ?");
pstmt.setInt(1, sampleIds.get(i));
pstmt.setInt(2, profileIds.get(i));
pstmt.executeUpdate();
}
} catch (SQLException e) {
throw new DaoException(e);
} finally {
JdbcUtil.closeAll(DaoSampleProfile.class, con, pstmt, rs);
}
}
}
Loading

0 comments on commit c9d2b7d

Please sign in to comment.