コード例 #1
0
ファイル: datasets.py プロジェクト: UMMS-Biocore/ga4gh-server
    def __init__(
            self, localId, randomSeed=1, numCalls=1,
            variantDensity=1, numVariantSets=1, numAlignments=1):
        super(SimulatedDataset, self).__init__(localId)
        self._randomSeed = randomSeed
        self._randomGenerator = random.Random()
        self._randomGenerator.seed(self._randomSeed)

        # Variants
        for i in range(numVariantSets):
            localId = "simVs{}".format(i)
            seed = self._randomGenerator.randint(0, 2**32 - 1)
            variantSet = variants.SimulatedVariantSet(
                self, localId, seed, numCalls, variantDensity)
            self._variantSetIdMap[variantSet.getId()] = variantSet
        self._variantSetIds = sorted(self._variantSetIdMap.keys())

        # Reads
        localId = 'aReadGroupSet'
        readGroupSet = reads.SimulatedReadGroupSet(
            self, localId, numAlignments)
        self._readGroupSetIdMap[readGroupSet.getId()] = readGroupSet
        for readGroup in readGroupSet.getReadGroups():
            self._readGroupIdMap[readGroup.getId()] = readGroup
        self._readGroupSetIds = sorted(self._readGroupSetIdMap.keys())
        self._readGroupIds = sorted(self._readGroupIdMap.keys())
コード例 #2
0
ファイル: datasets.py プロジェクト: jbu/server
    def __init__(
            self, datasetId, randomSeed, numCalls,
            variantDensity, numVariantSets, numAlignments):
        super(SimulatedDataset, self).__init__()
        self._id = datasetId
        self._randomSeed = randomSeed
        self._randomGenerator = random.Random()
        self._randomGenerator.seed(self._randomSeed)

        # Variants
        for i in range(numVariantSets):
            variantSetId = "{}:simVs{}".format(self._id, i)
            seed = self._randomGenerator.randint(0, 2**32 - 1)
            variantSet = variants.SimulatedVariantSet(
                seed, numCalls, variantDensity, variantSetId)
            self._variantSetIdMap[variantSetId] = variantSet
        self._variantSetIds = sorted(self._variantSetIdMap.keys())

        # Reads
        readGroupSetId = "{}:aReadGroupSet".format(self._id)
        readGroupSet = reads.SimulatedReadGroupSet(
            readGroupSetId, numAlignments)
        self._readGroupSetIdMap[readGroupSetId] = readGroupSet
        for readGroup in readGroupSet.getReadGroups():
            self._readGroupIdMap[readGroup.getId()] = readGroup
        self._readGroupSetIds = sorted(self._readGroupSetIdMap.keys())
        self._readGroupIds = sorted(self._readGroupIdMap.keys())
コード例 #3
0
ファイル: datasets.py プロジェクト: alexanderDoria/server
 def __init__(self,
              localId,
              referenceSet,
              randomSeed=0,
              numVariantSets=1,
              numCalls=1,
              variantDensity=0.5,
              numReadGroupSets=1,
              numReadGroupsPerReadGroupSet=1,
              numAlignments=1,
              numFeatureSets=1):
     super(SimulatedDataset, self).__init__(localId)
     self._description = "Simulated dataset {}".format(localId)
     # TODO create a simulated Ontology
     # Variants
     for i in range(numVariantSets):
         localId = "simVs{}".format(i)
         seed = randomSeed + i
         variantSet = variants.SimulatedVariantSet(self, referenceSet,
                                                   localId, seed, numCalls,
                                                   variantDensity)
         callSets = variantSet.getCallSets()
         # Add biosamples
         for callSet in callSets:
             bioSample = biodata.BioSample(self, callSet.getLocalId())
             bioSample2 = biodata.BioSample(self,
                                            callSet.getLocalId() + "2")
             individual = biodata.Individual(self, callSet.getLocalId())
             bioSample.setIndividualId(individual.getId())
             bioSample2.setIndividualId(individual.getId())
             self.addIndividual(individual)
             self.addBioSample(bioSample)
             self.addBioSample(bioSample2)
         self.addVariantSet(variantSet)
         variantAnnotationSet = variants.SimulatedVariantAnnotationSet(
             variantSet, "simVas{}".format(i), seed)
         variantSet.addVariantAnnotationSet(variantAnnotationSet)
     # Reads
     for i in range(numReadGroupSets):
         localId = 'simRgs{}'.format(i)
         seed = randomSeed + i
         readGroupSet = reads.SimulatedReadGroupSet(
             self, localId, referenceSet, seed,
             numReadGroupsPerReadGroupSet, numAlignments)
         for rg in readGroupSet.getReadGroups():
             bioSample = biodata.BioSample(self, rg.getLocalId())
             individual = biodata.Individual(self, rg.getLocalId())
             bioSample.setIndividualId(individual.getId())
             rg.setBioSampleId(bioSample.getId())
             self.addIndividual(individual)
             self.addBioSample(bioSample)
         self.addReadGroupSet(readGroupSet)
     # Features
     for i in range(numFeatureSets):
         localId = "simFs{}".format(i)
         seed = randomSeed + i
         featureSet = sequenceAnnotations.SimulatedFeatureSet(
             self, localId, seed)
         featureSet.setReferenceSet(referenceSet)
         self.addFeatureSet(featureSet)
コード例 #4
0
ファイル: datasets.py プロジェクト: snehitp/server
 def __init__(self,
              localId,
              referenceSet,
              randomSeed=0,
              numVariantSets=1,
              numCalls=1,
              variantDensity=0.5,
              numReadGroupSets=1,
              numReadGroupsPerReadGroupSet=1,
              numAlignments=1):
     super(SimulatedDataset, self).__init__(localId)
     self._description = "Simulated dataset {}".format(localId)
     # Variants
     for i in range(numVariantSets):
         localId = "simVs{}".format(i)
         seed = randomSeed + i
         variantSet = variants.SimulatedVariantSet(self, localId, seed,
                                                   numCalls, variantDensity)
         self.addVariantSet(variantSet)
     # Reads
     for i in range(numReadGroupSets):
         localId = 'simRgs{}'.format(i)
         seed = randomSeed + i
         readGroupSet = reads.SimulatedReadGroupSet(
             self, localId, referenceSet, seed,
             numReadGroupsPerReadGroupSet, numAlignments)
         self.addReadGroupSet(readGroupSet)
コード例 #5
0
 def testCreation(self):
     dataset = datasets.AbstractDataset('dataset1')
     localId = "readGroupSetId"
     simulatedReadGroupSet = reads.SimulatedReadGroupSet(
             dataset, localId)
     for readGroup in simulatedReadGroupSet.getReadGroups():
         alignments = list(readGroup.getReadAlignments())
         self.assertGreater(len(alignments), 0)
コード例 #6
0
ファイル: test_simulator.py プロジェクト: ga4ghpoc/server
 def testCreation(self):
     dataset = datasets.Dataset('dataset1')
     localId = "readGroupSetId"
     referenceSet = references.SimulatedReferenceSet("srs1")
     simulatedReadGroupSet = reads.SimulatedReadGroupSet(
         dataset, localId, referenceSet)
     for readGroup in simulatedReadGroupSet.getReadGroups():
         alignments = list(readGroup.getReadAlignments())
         self.assertGreater(len(alignments), 0)
コード例 #7
0
ファイル: backend.py プロジェクト: afirth/server
    def __init__(self, randomSeed=0, numCalls=1, variantDensity=0.5,
                 numVariantSets=1):
        super(SimulatedBackend, self).__init__()
        self._randomSeed = randomSeed
        self._randomGenerator = random.Random()
        self._randomGenerator.seed(self._randomSeed)
        for i in range(numVariantSets):
            variantSetId = "simVs{}".format(i)
            seed = self._randomGenerator.randint(0, 2**32 - 1)
            variantSet = variants.SimulatedVariantSet(
                seed, numCalls, variantDensity, variantSetId)
            self._variantSetIdMap[variantSetId] = variantSet
        self._variantSetIds = sorted(self._variantSetIdMap.keys())

        # Reads
        readGroupSetId = "aReadGroupSet"
        readGroupSet = reads.SimulatedReadGroupSet(readGroupSetId)
        self._readGroupSetIdMap[readGroupSetId] = readGroupSet
        for readGroup in readGroupSet.getReadGroups():
            self._readGroupIdMap[readGroup.getId()] = readGroup
        self._readGroupSetIds = sorted(self._readGroupSetIdMap.keys())
        self._readGroupIds = sorted(self._readGroupIdMap.keys())
コード例 #8
0
 def testCreation(self):
     readGroupSetId = "readGroupSetId"
     simulatedReadGroupSet = reads.SimulatedReadGroupSet(readGroupSetId)
     for readGroup in simulatedReadGroupSet.getReadGroups():
         alignments = list(readGroup.getReadAlignments())
         self.assertGreater(len(alignments), 0)