Exemplo n.º 1
0
 def test_fragend_pairs(self):
     ''' Test identification of acceptable fragend pairs. '''
     pairData = fragendPair.fragendPairs(pairIn = self.pairIn,
         fasta = self.fastaIn, resite = 'gATc', maxDistance = 20,
         fragendOut = self.fragendOut)
     output = []
     with open(self.fragendOut) as fileIn:
         for line in fileIn:
             output.append(line.strip().split('\t'))
     self.assertEqual(
         output,
         [['chr1','10','+','chr3','32','+'],
          ['chr2','20','-','chr2','16','-'],
          ['chr3','32','+','chr3','3','-']]
     )
     self.assertEqual(
         pairData,
         collections.defaultdict(int, {'total':6, 'none':2, 'distant':1,
             'intrachromosomal':2, 'interchromosomal':1,
             'fragDist':[8,8,8,21,8,11,8,8], 'ligDist':[4,29]})
     )
Exemplo n.º 2
0
    'unique: %s' %(pairMetrics['unique']),
    'discordant: %s' %(pairMetrics['discord']),
    'unique discordant: %s' %(pairMetrics['discorduni']),
    'duplication rate: %.4f' %(1 - (pairMetrics['unique'] /
        float(pairMetrics['total']))),
    'concordant rate: %.4f' %(1 - (pairMetrics['discorduni'] /
        float(pairMetrics['unique'])))
)

##############################################################################
## Extract fragend pairs
##############################################################################
fragendMetrics = fragendPair.fragendPairs(
    pairIn = args.outPairs,
    fragendOut = args.outFrags,
    fasta = args.bwaFasta,
    maxDistance = args.maxDistance,
    resite = args.cutSite
)
# Print fragend metrics
print '\nFragend Data:\n\t%s\n\t%s\n\t%s\n\t%s\n\t%s' %(
    'total: %s' %(fragendMetrics['total']),
    'no fragend: %s' %(fragendMetrics['none']),
    'too distant: %s' %(fragendMetrics['distant']),
    'interchromosomal: %s' %(fragendMetrics['interchromosomal']),
    'intrachromosomal: %s' %(fragendMetrics['intrachromosomal'])
)
# Extract fragned and ligation metrics
fragendDist = fragendMetrics['fragDist']
ligationDist = fragendMetrics['ligDist']
fragendCount = len(fragendDist)