예제 #1
0
 def getDataModelInstance(self, localId, dataPath):
     variantSet = variants.HtslibVariantSet(self._dataset, localId)
     variantSet.populateFromDirectory(dataPath)
     referenceSet = references.AbstractReferenceSet("test")
     variantSet.setReferenceSet(referenceSet)
     variantSet.setPatientId("patient1")
     variantSet.setSampleId("sample1")
     return variantSet
 def __init__(self, rnaQuantificationLocalId, baseDir):
     self._dataset = datasets.Dataset(_datasetName)
     self._repo = datarepo.SqlDataRepository(paths.testDataRepo)
     self._repo.open(datarepo.MODE_READ)
     self._referenceSet = references.AbstractReferenceSet("test_rs")
     rnaQuantificationId = rnaQuantificationLocalId[:-3]  # remove '.db'
     super(RnaQuantificationTest, self).__init__(
         rnaQuantificationId, baseDir)
예제 #3
0
 def testGetReferenceSetByIndexBadIndex(self):
     self.assertRaises(IndexError, self._dataRepo.getReferenceSetByIndex, 0)
     self.assertRaises(TypeError, self._dataRepo.getReferenceSetByIndex,
                       None)
     self.assertRaises(TypeError, self._dataRepo.getReferenceSetByIndex, "")
     referenceSetName = "id"
     referenceSet = references.AbstractReferenceSet(referenceSetName)
     self._dataRepo.addReferenceSet(referenceSet)
     self.assertRaises(IndexError, self._dataRepo.getReferenceSetByIndex, 1)
예제 #4
0
 def testAddMultipleReferenceSet(self):
     firstRSLocalId = "id1"
     firstRS = references.AbstractReferenceSet(firstRSLocalId)
     secondRSLocalId = "id2"
     secondRS = references.AbstractReferenceSet(secondRSLocalId)
     self.assertEqual(self._dataRepo.getNumReferenceSets(), 0)
     self.assertEqual(self._dataRepo.getReferenceSets(), [])
     self._dataRepo.addReferenceSet(firstRS)
     self._dataRepo.addReferenceSet(secondRS)
     self.assertEqual(self._dataRepo.getNumReferenceSets(), 2)
     self.assertEqual(self._dataRepo.getReferenceSets(),
                      [firstRS, secondRS])
     self.assertEqual(self._dataRepo.getReferenceSetByIndex(0), firstRS)
     self.assertEqual(self._dataRepo.getReferenceSetByIndex(1), secondRS)
     self.assertEqual(
         self._dataRepo.getReferenceSetByName(firstRS.getLocalId()),
         firstRS)
     self.assertEqual(
         self._dataRepo.getReferenceSetByName(secondRS.getLocalId()),
         secondRS)
     self.assertEqual(self._dataRepo.getReferenceSet(firstRS.getId()),
                      firstRS)
     self.assertEqual(self._dataRepo.getReferenceSet(secondRS.getId()),
                      secondRS)
예제 #5
0
 def testAddOneReferenceSet(self):
     referenceSetLocalId = "id"
     referenceSet = references.AbstractReferenceSet(referenceSetLocalId)
     self.assertEqual(self._dataRepo.getNumReferenceSets(), 0)
     self.assertEqual(self._dataRepo.getReferenceSets(), [])
     self._dataRepo.addReferenceSet(referenceSet)
     self.assertEqual(self._dataRepo.getNumReferenceSets(), 1)
     self.assertEqual(self._dataRepo.getReferenceSets(), [referenceSet])
     self.assertEqual(self._dataRepo.getReferenceSetByIndex(0),
                      referenceSet)
     self.assertEqual(
         self._dataRepo.getReferenceSetByName(referenceSet.getLocalId()),
         referenceSet)
     self.assertEqual(self._dataRepo.getReferenceSet(referenceSet.getId()),
                      referenceSet)
예제 #6
0
 def __init__(self, featureSetLocalName, dataPath):
     """
     :param localId: Name of the GFF3 resource corresponding to a pair
     of files, .db and .gff3
     :param dataPath: string representing full path to the .db file
     :return:
     """
     self._dataset = datasets.Dataset(_datasetName)
     self._repo = datarepo.SqlDataRepository(paths.testDataRepo)
     self._repo.open(datarepo.MODE_READ)
     self._ontology = self._repo.getOntologyByName(paths.ontologyName)
     self._referenceSet = references.AbstractReferenceSet("test_rs")
     featureSetLocalName = featureSetLocalName[:-3]  # remove '.db'
     self._testData = _testDataForFeatureSetName[featureSetLocalName]
     super(FeatureSetTests, self).__init__(featureSetLocalName, dataPath)
 def getDataModelInstance(self, localId, dataPath):
     dataset = datasets.Dataset("ds")
     variantSet = variants.HtslibVariantSet(dataset, localId)
     variantSet.populateFromDirectory(dataPath)
     referenceSet = references.AbstractReferenceSet("rs")
     variantSet.setReferenceSet(referenceSet)
     variantSet.setPatientId("patient1")
     variantSet.setSampleId("sample1")
     if variantSet.isAnnotated():
         sequenceOntology = ontologies.Ontology(paths.ontologyName)
         sequenceOntology.populateFromFile(paths.ontologyPath)
         annotationSet = variantSet.getVariantAnnotationSets()[0]
         annotationSet.setOntology(sequenceOntology)
         return annotationSet
     else:
         return variantSet
예제 #8
0
 def setUp(self):
     self._backend = backend.Backend(datarepo.AbstractDataRepository())
     self._referenceSet = references.AbstractReferenceSet('refSetId')
     self._reference = references.AbstractReference(self._referenceSet,
                                                    "ref")
예제 #9
0
 def _addReferenceSet(self, referenceSetName):
     self._referenceSet = references.AbstractReferenceSet(referenceSetName)
     self._backend.getDataRepository().addReferenceSet(self._referenceSet)
예제 #10
0
 def getReferenceSet(self):
     return references.AbstractReferenceSet("referenceSet")