Skip to content

Commit

Permalink
Remove functionality unrelated to cna long format
Browse files Browse the repository at this point in the history
  • Loading branch information
Bas Leenknegt committed Oct 13, 2022
1 parent 550cb0b commit 77adf0c
Show file tree
Hide file tree
Showing 19 changed files with 557 additions and 709 deletions.
406 changes: 203 additions & 203 deletions core/src/main/java/org/mskcc/cbio/maf/TabDelimitedFileUtil.java

Large diffs are not rendered by default.

210 changes: 100 additions & 110 deletions core/src/main/java/org/mskcc/cbio/portal/dao/DaoGeneticAlteration.java

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@
* <br>
* @author Selcuk Onur Sumer
*/

public class ImportExtendedMutationData{

private File mutationFile;
private int geneticProfileId;
private boolean swissprotIsAccession;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,10 @@
package org.mskcc.cbio.portal.scripts;

import java.io.*;
import java.util.ArrayList;
import java.util.Date;
import java.util.Set;

import com.fasterxml.jackson.databind.ObjectMapper;
import joptsimple.*;

import org.cbioportal.model.EntityType;
import org.mskcc.cbio.portal.model.*;
import org.mskcc.cbio.portal.util.*;

Expand Down Expand Up @@ -126,7 +122,7 @@ public void run() {
if (pdAnnotationsFilename != null && !"".equals(pdAnnotationsFilename)) {
importer.setPdAnnotationsFile(new File(dataFile.getParent(), pdAnnotationsFilename));
}
importer.importData(numLines);
importer.importData(numLines);
}
}
catch (Exception e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
*/

public class ImportStructuralVariantData {

// Initialize variables
private File structuralVariantFile;
private int geneticProfileId;
Expand Down
433 changes: 211 additions & 222 deletions core/src/main/java/org/mskcc/cbio/portal/scripts/ImportTabDelimData.java

Large diffs are not rendered by default.

17 changes: 1 addition & 16 deletions core/src/main/scripts/importer/cbioportal_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ class MetaFileTypes(object):
SAMPLE_ATTRIBUTES = 'meta_clinical_sample'
PATIENT_ATTRIBUTES = 'meta_clinical_patient'
CNA_DISCRETE = 'meta_CNA'
CNA_DISCRETE_LONG = 'meta_CNA'
CNA_LOG2 = 'meta_log2CNA'
CNA_CONTINUOUS = 'meta_contCNA'
SEG = 'meta_segment'
Expand Down Expand Up @@ -112,20 +111,7 @@ class MetaFileTypes(object):
'profile_description': True,
'data_filename': True,
'gene_panel': False,
'pd_annotations_filename': False,
'namespaces': False
},
MetaFileTypes.CNA_DISCRETE_LONG: {
'cancer_study_identifier': True,
'genetic_alteration_type': True,
'datatype': True,
'stable_id': True,
'show_profile_in_analysis_tab': True,
'profile_name': True,
'profile_description': True,
'data_filename': True,
'gene_panel': False,
'namespaces': False
'pd_annotations_filename': False
},
MetaFileTypes.CNA_LOG2: {
'cancer_study_identifier': True,
Expand Down Expand Up @@ -631,7 +617,6 @@ def get_meta_file_type(meta_dictionary, logger, filename):
("PROTEIN_LEVEL", "CONTINUOUS"): MetaFileTypes.PROTEIN,
# cna
("COPY_NUMBER_ALTERATION", "DISCRETE"): MetaFileTypes.CNA_DISCRETE,
("COPY_NUMBER_ALTERATION", "DISCRETE_LONG"): MetaFileTypes.CNA_DISCRETE,
("COPY_NUMBER_ALTERATION", "CONTINUOUS"): MetaFileTypes.CNA_CONTINUOUS,
("COPY_NUMBER_ALTERATION", "LOG2-VALUE"): MetaFileTypes.CNA_LOG2,
("COPY_NUMBER_ALTERATION", "SEG"): MetaFileTypes.SEG,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
import static java.util.stream.Collectors.joining;
import static java.util.stream.Collectors.toList;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {"classpath:/applicationContext-dao.xml"})
Expand Down Expand Up @@ -132,7 +133,7 @@ public void testImportCnaDiscreteLongDataAddsCnaEvents() throws Exception {
.map(e -> e.getAlteration().getDescription())
.collect(toList());
assertEquals(2, cnaEvents.size());
assertEquals("Amplified,Homozygously deleted", String.join(",", cnaEvents));
assertTrue(newArrayList("Amplified", "Homozygously deleted").containsAll(cnaEvents));

// Test gene with partial deletion and amplification has two cna events:
List<String> convertedCnaEvents = resultCnaEvents
Expand All @@ -141,7 +142,7 @@ public void testImportCnaDiscreteLongDataAddsCnaEvents() throws Exception {
.map(e -> e.getAlteration().getDescription())
.collect(toList());
assertEquals(2, cnaEvents.size());
assertEquals("Amplified,Homozygously deleted", String.join(",", cnaEvents));
assertTrue( newArrayList("Amplified", "Homozygously deleted").containsAll(cnaEvents));

// Test gene with homozygous deletion and amplification has no cna events:
List<CnaEvent.Event> skippedCnaEvents = resultCnaEvents
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*
* 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.scripts;

Expand Down Expand Up @@ -62,45 +62,45 @@
@Transactional
public class TestImportCopyNumberSegmentData {

@Autowired
ApplicationContext applicationContext;

//To use in test cases where we expect an exception:
@Rule
public ExpectedException exception = ExpectedException.none();


@Before
public void setUp() throws DaoException
{
//set it, to avoid this being set to the runtime (not for testing) application context:
SpringUtil.setApplicationContext(applicationContext);
}

/**
@Autowired
ApplicationContext applicationContext;
//To use in test cases where we expect an exception:
@Rule
public ExpectedException exception = ExpectedException.none();
@Before
public void setUp() throws DaoException
{
//set it, to avoid this being set to the runtime (not for testing) application context:
SpringUtil.setApplicationContext(applicationContext);
}
/**
* Test importing of Clinical Data File.
*
* @throws DaoException Database Access Error.
* @throws IOException IO Error.
*/
@Test
@Test
public void testImportSegmentDataNewStudy() throws Exception {
//new dummy study to simulate importing clinical data in empty study:
CancerStudy cancerStudy = new CancerStudy("testnewseg","testnewseg","testnewseg","brca",true);
//new dummy study to simulate importing clinical data in empty study:
CancerStudy cancerStudy = new CancerStudy("testnewseg","testnewseg","testnewseg","brca",true);
cancerStudy.setReferenceGenome("hg19");
DaoCancerStudy.addCancerStudy(cancerStudy);
DaoCancerStudy.addCancerStudy(cancerStudy);
addTestPatientAndSampleRecords(new File("src/test/resources/segment/data_cna_hg19.seg"), cancerStudy);

String[] args = {
"--data","src/test/resources/segment/data_cna_hg19.seg",
"--meta","src/test/resources/segment/meta_cna_hg19_seg.txt",
"--loadMode", "bulkLoad"
};
"--data","src/test/resources/segment/data_cna_hg19.seg",
"--meta","src/test/resources/segment/meta_cna_hg19_seg.txt",
"--loadMode", "bulkLoad"
};
ImportCopyNumberSegmentData runner = new ImportCopyNumberSegmentData(args);
runner.run();
runner.run();
//TODO : fix test to actually store data and add some checks

}
}

private void addTestPatientAndSampleRecords(File file, CancerStudy cancerStudy) throws FileNotFoundException, IOException, DaoException {
// extract sample ids from first column
Expand All @@ -124,4 +124,4 @@ private void addTestPatientAndSampleRecords(File file, CancerStudy cancerStudy)
}
MySQLbulkLoader.flushAll();
}
}
}
3 changes: 1 addition & 2 deletions db-scripts/src/main/resources/cgds.sql
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,6 @@ CREATE TABLE `cna_event` (
`CNA_EVENT_ID` int(255) NOT NULL auto_increment,
`ENTREZ_GENE_ID` int(11) NOT NULL,
`ALTERATION` tinyint NOT NULL,
`ANNOTATION_JSON` JSON,
PRIMARY KEY (`CNA_EVENT_ID`),
UNIQUE (`ENTREZ_GENE_ID`, `ALTERATION`),
FOREIGN KEY (`ENTREZ_GENE_ID`) REFERENCES `gene` (`ENTREZ_GENE_ID`),
Expand Down Expand Up @@ -761,4 +760,4 @@ CREATE TABLE `resource_study` (
);

-- THIS MUST BE KEPT IN SYNC WITH db.version PROPERTY IN pom.xml
INSERT INTO info VALUES ('2.12.15', NULL);
INSERT INTO info VALUES ('2.12.14', NULL);
4 changes: 0 additions & 4 deletions db-scripts/src/main/resources/migration.sql
Original file line number Diff line number Diff line change
Expand Up @@ -992,7 +992,3 @@ ALTER TABLE `structural_variant` DROP COLUMN `SITE2_EXON`;
ALTER TABLE `structural_variant` DROP COLUMN `CENTER`;
ALTER TABLE `structural_variant` DROP COLUMN `EXTERNAL_ANNOTATION`;
UPDATE `info` SET `DB_SCHEMA_VERSION`="2.12.14";

##version: 2.12.15
ALTER TABLE `cna_event` ADD COLUMN `ANNOTATION_JSON` JSON AFTER `ALTERATION`;
UPDATE `info` SET `DB_SCHEMA_VERSION`="2.12.15";
Original file line number Diff line number Diff line change
@@ -1,33 +1,18 @@
package org.cbioportal.model;

import com.fasterxml.jackson.annotation.JsonRawValue;
import io.swagger.annotations.ApiModelProperty;

import java.io.Serializable;
import javax.validation.constraints.NotNull;

public class DiscreteCopyNumberData extends Alteration implements Serializable {

@NotNull
private Integer alteration;

@JsonRawValue
@ApiModelProperty(dataType = "java.util.Map")
private String annotationJson;


public Integer getAlteration() {
return alteration;
}

public void setAlteration(Integer alteration) {
this.alteration = alteration;
}

public String getAnnotationJson() {
return annotationJson;
}

public void setAnnotationJson(String annotationJson) {
this.annotationJson = annotationJson;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
<sql id="select">
cna_event.ENTREZ_GENE_ID as entrezGeneId,
cna_event.ALTERATION AS alteration,
cna_event.ANNOTATION_JSON as annotationJson,
genetic_profile.STABLE_ID AS molecularProfileId,
sample.STABLE_ID AS sampleId,
patient.STABLE_ID AS patientId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -417,9 +417,9 @@ INSERT INTO genetic_alteration (GENETIC_PROFILE_ID,GENETIC_ENTITY_ID,`VALUES`) V
INSERT INTO genetic_alteration (GENETIC_PROFILE_ID,GENETIC_ENTITY_ID,`VALUES`) VALUES (2,2,'1.4146,-0.0662,-0.8585,-1.6576,-0.3552,-0.8306,0.8102,0.1146,0.3498,0.0349,0.4927,-0.8665,-0.4754,-0.7221,');
INSERT INTO genetic_alteration (GENETIC_PROFILE_ID,GENETIC_ENTITY_ID,`VALUES`) VALUES (3,2,'-0.8097,0.7360,-1.0225,-0.8922,0.7247,0.3537,1.2702,-0.1419,');

INSERT INTO cna_event (CNA_EVENT_ID,ENTREZ_GENE_ID,ALTERATION,ANNOTATION_JSON) VALUES (1,207,-2, '{"columnName":{"fieldName":"fieldValue"}}');
INSERT INTO cna_event (CNA_EVENT_ID,ENTREZ_GENE_ID,ALTERATION,ANNOTATION_JSON) VALUES (2,208,2, '{"columnName":{"fieldName":"fieldValue"}}');
INSERT INTO cna_event (CNA_EVENT_ID,ENTREZ_GENE_ID,ALTERATION,ANNOTATION_JSON) VALUES (3,207,2, '{"columnName":{"fieldName":"fieldValue"}}');
INSERT INTO cna_event (CNA_EVENT_ID,ENTREZ_GENE_ID,ALTERATION) VALUES (1,207,-2);
INSERT INTO cna_event (CNA_EVENT_ID,ENTREZ_GENE_ID,ALTERATION) VALUES (2,208,2);
INSERT INTO cna_event (CNA_EVENT_ID,ENTREZ_GENE_ID,ALTERATION) VALUES (3,207,2);

INSERT INTO sample_cna_event (CNA_EVENT_ID,SAMPLE_ID,GENETIC_PROFILE_ID) VALUES (1,1,2);
INSERT INTO sample_cna_event (CNA_EVENT_ID,SAMPLE_ID,GENETIC_PROFILE_ID) VALUES (2,1,2);
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@
<tomcat.session.timeout>720</tomcat.session.timeout>

<!-- THIS SHOULD BE KEPT IN SYNC TO VERSION IN CGDS.SQL -->
<db.version>2.12.15</db.version>
<db.version>2.12.14</db.version>
</properties>

<modules>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,65 +64,6 @@ public void getDiscreteCopyNumbersInMultipleMolecularProfilesHomdelOrAmp() {
Assert.assertEquals(toStrings(returned), toStrings(actual));
}

@Test
public void getDiscreteCopyNumbersWithAnnotationJson() {
List<DiscreteCopyNumberData> returned = Arrays.asList(
discreteCopyNumberData("sample1", "study1", -2),
discreteCopyNumberData("sample2", "study2", 2)
);
returned.get(0).setAnnotationJson("{\"columnName\":{\"fieldName\":\"fieldValue\"}}");
List<String> profiles = Arrays.asList("profile1", "profile2");
List<String> samples = Arrays.asList("sample1", "sample2");
List<Integer> geneIds = Arrays.asList(0, 1);
List<Integer> alterationTypes = Arrays.asList(-2, 2);

Mockito.when(discreteCopyNumberRepository.getDiscreteCopyNumbersInMultipleMolecularProfiles(
profiles,
samples,
geneIds,
alterationTypes,
PROJECTION
))
.thenReturn(
returned
);

List<DiscreteCopyNumberData> actual = discreteCopyNumberService.getDiscreteCopyNumbersInMultipleMolecularProfiles(
profiles, samples, geneIds, alterationTypes, PROJECTION
);

Assert.assertEquals(toStrings(returned), toStrings(actual));
}
@Test
public void getDiscreteCopyNumbersWithoutAnnotationJson() {
List<DiscreteCopyNumberData> returned = Arrays.asList(
discreteCopyNumberData("sample1", "study1", -2),
discreteCopyNumberData("sample2", "study2", 2)
);
// returned.get(0).setAnnotationJson("{\"columnName\":{\"fieldName\":\"fieldValue\"}}");
List<String> profiles = Arrays.asList("profile1", "profile2");
List<String> samples = Arrays.asList("sample1", "sample2");
List<Integer> geneIds = Arrays.asList(0, 1);
List<Integer> alterationTypes = Arrays.asList(-2, 2);

Mockito.when(discreteCopyNumberRepository.getDiscreteCopyNumbersInMultipleMolecularProfiles(
profiles,
samples,
geneIds,
alterationTypes,
PROJECTION
))
.thenReturn(
returned
);

List<DiscreteCopyNumberData> actual = discreteCopyNumberService.getDiscreteCopyNumbersInMultipleMolecularProfiles(
profiles, samples, geneIds, alterationTypes, PROJECTION
);
Assert.assertNull(returned.get(0).getAnnotationJson());
Assert.assertEquals(toStrings(returned), toStrings(actual));
}

@Test
public void getDiscreteCopyNumbersInMultipleMolecularProfilesAllAlterationTypes() {
List<GeneMolecularData> returned = Arrays.asList(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
import org.cbioportal.model.ClinicalEvent;
import org.cbioportal.model.ClinicalEventData;
import org.cbioportal.model.DataAccessToken;
import org.cbioportal.model.DiscreteCopyNumberData;
import org.cbioportal.model.CopyNumberSeg;
import org.cbioportal.model.Gene;
import org.cbioportal.model.GenePanel;
Expand Down Expand Up @@ -83,7 +82,6 @@
import org.cbioportal.web.mixin.ClinicalEventMixin;
import org.cbioportal.web.mixin.CopyNumberSegMixin;
import org.cbioportal.web.mixin.DataAccessTokenMixin;
import org.cbioportal.web.mixin.DiscreteCopyNumberDataMixin;
import org.cbioportal.web.mixin.GeneMixin;
import org.cbioportal.web.mixin.GenePanelMixin;
import org.cbioportal.web.mixin.GenePanelToGeneMixin;
Expand Down Expand Up @@ -120,7 +118,6 @@ public CustomObjectMapper() {
mixinMap.put(ClinicalEventData.class, ClinicalEventDataMixin.class);
mixinMap.put(CopyNumberSeg.class, CopyNumberSegMixin.class);
mixinMap.put(DataAccessToken.class, DataAccessTokenMixin.class);
mixinMap.put(DiscreteCopyNumberData.class, DiscreteCopyNumberDataMixin.class);
mixinMap.put(Gene.class, GeneMixin.class);
mixinMap.put(GenePanel.class, GenePanelMixin.class);
mixinMap.put(GenePanelToGene.class, GenePanelToGeneMixin.class);
Expand Down

This file was deleted.

Loading

0 comments on commit 77adf0c

Please sign in to comment.