Beispiel #1
0
 def __init__(self, id_, dataFile):
     super(HtslibReference, self).__init__(id_)
     self._fastaFilePath = dataFile
     fastaFile = self.openFile(dataFile)
     numReferences = len(fastaFile.references)
     if numReferences != 1:
         raise exceptions.NotExactlyOneReferenceException(
             self._id, numReferences)
     self._refName = fastaFile.references[0]
     # refData = fastaFile.fetch(self._refName)
     self._md5checksum = "TODO"  # hashlib.md5(refData).hexdigest()
 def __init__(self, parentContainer, name, dataFile):
     super(HtslibReference, self).__init__(parentContainer, name)
     self._fastaFilePath = dataFile
     fastaFile = self.openFile(dataFile)
     numReferences = len(fastaFile.references)
     if numReferences != 1:
         raise exceptions.NotExactlyOneReferenceException(
             self.getId(), numReferences)
     self._refName = fastaFile.references[0]
     self._length = fastaFile.lengths[0]
     # refData = fastaFile.fetch(self._refName)
     self._md5checksum = "TODO"  # hashlib.md5(refData).hexdigest()
     fastaFile.close()
Beispiel #3
0
 def __init__(self, parentContainer, localId, dataFile, metadata):
     super(HtslibReference, self).__init__(parentContainer, localId)
     self._fastaFilePath = dataFile
     fastaFile = self.getFileHandle(dataFile)
     numReferences = len(fastaFile.references)
     if numReferences != 1:
         raise exceptions.NotExactlyOneReferenceException(
             self._fastaFilePath, numReferences)
     if fastaFile.references[0] != localId:
         raise exceptions.InconsistentReferenceNameException(
             self._fastaFilePath)
     self._length = fastaFile.lengths[0]
     try:
         self._md5checksum = metadata["md5checksum"]
         self._sourceUri = metadata["sourceUri"]
         self._ncbiTaxonId = metadata["ncbiTaxonId"]
         self._isDerived = metadata["isDerived"]
         self._sourceDivergence = metadata["sourceDivergence"]
         self._sourceAccessions = metadata["sourceAccessions"]
     except KeyError as err:
         raise exceptions.MissingReferenceMetadata(dataFile, str(err))