def test_copy(self): """Test annotation copy """ m = MutationData() m.createAnnotation("foo", "3", "blah_source", annotationDescription="testing", tags=["superblah"], number="A") m.createCopyAnnotation(m.getAnnotation("foo"), "bar") # Note that getAnnotation returns an instance of Annotation, not simply the value self.assertEqual(m.getAnnotation("foo"), m.getAnnotation("bar"))
def testAnnotationSourceIsPopulated(self): ''' Tests that the annotation source is not blank for the example tsv datasource. ''' geneDS = DatasourceFactory.createDatasource("testdata/small_tsv_ds/small_tsv_ds.config", "testdata/small_tsv_ds/") self.assertTrue(geneDS <> None, "gene indexed datasource was None.") m = MutationData() m.createAnnotation('gene',"ABL1") m = geneDS.annotate_mutation(m) self.assertTrue(m['CGC_Abridged_Name'] == "v-abl Abelson murine leukemia viral oncogene homolog 1","Test gene TSV datasource did not annotate properly.") self.assertTrue(m.getAnnotation('CGC_Abridged_Name').getDatasource() <> "Unknown", "Annotation source was unknown") self.assertTrue(m.getAnnotation('CGC_Abridged_Name').getDatasource().strip() <> "", "Annotation source was blank")
def testAnnotationSourceIsPopulated(self): ''' Tests that the annotation source is not blank for the example tsv datasource. ''' geneDS = DatasourceFactory.createDatasource("testdata/small_tsv_ds/small_tsv_ds.config", "testdata/small_tsv_ds/") self.assertTrue(geneDS <> None, "gene indexed datasource was None.") m = MutationData() m.createAnnotation('gene',"ABL1") m = geneDS.annotate_mutation(m) self.assertTrue(m['CGC_Abridged_Name'] == "v-abl Abelson murine leukemia viral oncogene homolog 1","Test gene TSV datasource did not annotate properly.") self.assertTrue(m.getAnnotation('CGC_Abridged_Name').getDatasource() <> "Unknown", "Annotation source was unknown") self.assertTrue(m.getAnnotation('CGC_Abridged_Name').getDatasource().strip() <> "", "Annotation source was blank")
def test_copy(self): """Test annotation copy """ m = MutationData() m.createAnnotation("foo", "3", "blah_source", annotationDescription="testing", tags=["superblah"], number="A") m.createCopyAnnotation(m.getAnnotation("foo"), "bar") # Note that getAnnotation returns an instance of Annotation, not simply the value self.assertEqual(m.getAnnotation("foo"), m.getAnnotation("bar"))
def testAddTag(self): ''' Test adding a tag to an annotation ''' m = MutationData() m.createAnnotation("fake1", "1") m.addTagToAnnotation("fake1", "fakeTag") self.assertTrue("fakeTag" in m.getAnnotation("fake1").getTags(), "Tag was not added properly.")
def testAddTag(self): ''' Test adding a tag to an annotation ''' m = MutationData() m.createAnnotation("fake1", "1") m.addTagToAnnotation("fake1", "fakeTag") self.assertTrue("fakeTag" in m.getAnnotation("fake1").getTags(), "Tag was not added properly.")
def test_hash(self): """Test that hashing works for a mutation data""" m = MutationData() m.start = 1 m.createAnnotation("foo", "3", "blah_source", annotationDescription="testing", tags=["superblah"], number="A") m.createCopyAnnotation(m.getAnnotation("foo"), "bar") # Not unique m2 = MutationData() m2.start = 1 m2.createAnnotation("foo", "3", "blah_source", annotationDescription="testing", tags=["superblah"], number="A") m2.createCopyAnnotation(m.getAnnotation("foo"), "bar") m3 = MutationData() m3.start = 1 m3.createAnnotation("foo", "3", "blah_source", annotationDescription="testing 2", tags=["superblah"], number="A") m3.createCopyAnnotation(m.getAnnotation("foo"), "bar") m4 = MutationData() m4.start = 1 m4.createAnnotation("foo", "3", "blah_source", annotationDescription="testing 2", tags=["superblah", "testy blah"], number="A") m4.createCopyAnnotation(m.getAnnotation("foo"), "bar") m5 = MutationData() m5.start = 10 m5.createAnnotation("foo", "3", "blah_source", annotationDescription="testing 2", tags=["superblah", "testy blah"], number="A") m5.createCopyAnnotation(m.getAnnotation("foo"), "bar") result = set() result.add(m) result.add(m2) result.add(m3) result.add(m4) result.add(m5) self.assertEqual(len(result), 4)