Exemple #1
0
 def testCommandsWithSpacesNotParsed(self):
     header = {'CL': 'bwa aln -q 15 -f $sai_file ' +
                     '$reference_fasta $fastq_file\tPP:bwa_index',
               'ID': 'bwa_aln_fastq',
               'PN': 'bwa',
               'VN': '0.5.9-r16'}
     self.assertEqual(header, reads.parseMalformedBamHeader(header))
Exemple #2
0
 def testOriginalTypesUnmodified(self):
     # note real field tags, just checking that types are preserved
     header = {'int': 2845856850,
               'float': 206.6,
               'bool': True,
               'string': '123'}
     self.assertEqual(header, reads.parseMalformedBamHeader(header))
Exemple #3
0
 def _readReferences(self):
     # Read the reference information from the samfile
     referenceSetName = None
     for referenceInfo in self._samFile.header['SQ']:
         if 'AS' not in referenceInfo:
             infoDict = reads.parseMalformedBamHeader(referenceInfo)
         # If there's still no reference set name in there we use
         # a default name.
         name = infoDict.get("AS", "Default")
         if referenceSetName is None:
             referenceSetName = name
             self._addReferenceSet(referenceSetName)
         else:
             self.assertEqual(referenceSetName, name)
         self._addReference(infoDict['SN'])
Exemple #4
0
 def _readReferences(self):
     # Read the reference information from the samfile
     referenceSetName = None
     for referenceInfo in self._samFile.header['SQ']:
         if 'AS' not in referenceInfo:
             infoDict = reads.parseMalformedBamHeader(referenceInfo)
         # If there's still no reference set name in there we use
         # a default name.
         name = infoDict.get("AS", "Default")
         if referenceSetName is None:
             referenceSetName = name
             self._addReferenceSet(referenceSetName)
         else:
             self.assertEqual(referenceSetName, name)
         self._addReference(infoDict['SN'])
Exemple #5
0
 def testSpaceSeparatedUnparsedFieldsParsed(self):
     header = {'LN': 249250621,
               'M5': '1b22b98cdeb4a9304cb5d48026a85128',
               'SN': '1',
               'UR': 'ftp://ftp.1000genomes.ebi.ac.uk/vol1/ftp/' +
                     'technical/reference/phase2_reference_assembly' +
                     '_sequence/hs37d5.fa.gz        AS:NCBI37' +
                     '       SP:Human'}
     expected = {'LN': 249250621,
                 'M5': '1b22b98cdeb4a9304cb5d48026a85128',
                 'SN': '1',
                 'UR': 'ftp://ftp.1000genomes.ebi.ac.uk/vol1/ftp/' +
                       'technical/reference/phase2_reference_assembly' +
                       '_sequence/hs37d5.fa.gz',
                 'AS': 'NCBI37',
                 'SP': 'Human'}
     self.assertEqual(expected, reads.parseMalformedBamHeader(header))
Exemple #6
0
 def testGoodHeaderUnmodified(self):
     header = {'SO': 'coordinate', 'VN': '1.0'}
     self.assertEqual(header, reads.parseMalformedBamHeader(header))