def getSequencing(pair, sharedPeaks, paramsDict, outFile, res):
    global print_lock, spectrum_lock

    result = []

    scanData = {}
    lightSpecs = [DataFile.getMassIntPairs(scanFDict[lightScanF]['dta']) for lightScanF in samePeptideClusters[pair[0]]]
    heavySpecs = [DataFile.getMassIntPairs(scanFDict[heavyScanF]['dta']) for heavyScanF in samePeptideClusters[pair[1]]]
    precMass = np.average(np.array([scanFDict[lightScanF]['precMass'] for lightScanF in samePeptideClusters[pair[0]]]))
    
    epMean = options.ppmsyserror * precMass * 10**-6
    epSTD = options.ppmstd * precMass * 10**-6
                
    scanData['shared peaks ratio'] = sharedPeaks

    s1 = time.time()
    sharedInfo, starts, ends, deltas, G = DNS.prepPairedSpectrumGraph(lightSpecs, heavySpecs, precMass, addEnds, ppmSTD=options.ppmstd, Nmod=pairConfig['NMod'], Cmod=pairConfig['CMod'], verbose=options.verbose)
    scanData['M+H'] = precMass
    
    specs = []
    for massIntPairs in lightSpecs:
        specs += [PN.Spectrum(PNet, precMass, Nmod=0.0, Cmod=0.0, epsilon=2*epSTD, spectrum=massIntPairs)]
    for massIntPairs in heavySpecs:
        specs += [PN.Spectrum(PNet, precMass + pairConfig['NMod'] + pairConfig['CMod'], Nmod=pairConfig['NMod'], Cmod=pairConfig['CMod'], epsilon=2*epSTD, spectrum=massIntPairs)]
    for spec in specs:
        spec.initializeNoiseModel()

    # with spectrum_lock:
    temp = DNS.getSpectrumGraphDataThread(G, deltas, specs, starts, ends, precMass - Constants.mods['H+'] - Constants.mods['H2O'], ambigPenaltyFun, ppmPenaltyFun, hashedAAs, termModHash=termModHash, maxEdge=options.maxedge, minEdge=options.minedge, subGraphCut=options.subgraphcut, subAlpha=0.3, alpha=options.alpha, epMean=epMean, epSTD=epSTD, epStep=epStep, verbose=options.verbose)
    temp_scan = temp[0]
    peps = temp[1]
    scanData.update(temp_scan)
    
    scanData['pair configuration'] = pairConfigName

    with print_lock:
        print 'Now sequencing light scan(s) %s, heavy scan(s) %s with shared peaks ratio %f \n' % (str(samePeptideClusters[pair[0]]), str(samePeptideClusters[pair[1]]), scanData['shared peaks ratio'])
        # out.append('Now sequencing light scan(s) ' + str(samePeptideClusters[pair[0]]) + ', heavy scan(s) ' + str(samePeptideClusters[pair[1]]) + ' with shared peaks ratio ' + str(scanData['shared peaks ratio']) + ' \n' )
        Ord = np.argsort(-1 * np.array(scanData['over_scores']))
        if scanData['blind'] == 0:
            for i in range(min(Ord.size, 10)):
                try:
                    print 'Score: ', peps[0][Ord[i]], 'Seq: ', ''.join(peps[1][Ord[i]])
                    # out.append('Score: ' + str(peps[0][Ord[i]]) + ' Seq: ' + ''.join(peps[1][Ord[i]]))
                except TypeError:
                    print 'Score: ', peps[0][Ord[i]], 'Seq: ', peps[1][Ord[i]]
                    # out.append('Score: ' + str(peps[0][Ord[i]]) + ' Seq: ' + str(peps[1][Ord[i]]))
        elif scanData['blind'] == 1:
            for i in range(min(Ord.size, maxNum)):
                try:
                    print 'Score: ', peps[0][Ord[i]], 'Seq: ', ''.join(peps[1][Ord[i]][0]), 'Mod Names: ', peps[2][Ord[i]][1]
                    # out.append('Score: ' + str(peps[0][Ord[i]]) + ' Seq: ' + ''.join(peps[1][Ord[i]][0]) + ' Mod Names: ' + peps[2][Ord[i]][1])
                except TypeError:
                    print 'Score: ', peps[0][Ord[i]], 'Seq: ', peps[1][Ord[i]][0], 'Mod Names: ', peps[2][1]
                    # out.append('Score: ' + str(peps[0][Ord[i]]) + ' Seq: ' + peps[1][Ord[i]][0] +  ' Mod Names: ' + peps[2][1])
        
        scanData['sequencing time'] = time.time() - s1
        print '\nTime Taken:', time.time() - s1, '\n'    
    # out.append('\nTime Taken: ' + str(time.time() - s1) + '\n')

    if validateHeavySequence(scanData['seq'], heavySeqMap, scanData['ambiguous edges']):
        for scanF in samePeptideClusters[pair[0]] + samePeptideClusters[pair[1]]:
            scanFDict[scanF]['sequenced'] = True
        if options.output:
            for pair in [(lightScanF, heavyScanF) for lightScanF in samePeptideClusters[pair[0]] for heavyScanF in samePeptideClusters[pair[1]]]:
                scanData['light scan'] = int(pair[0])
                scanData['heavy scan'] = int(pair[1])                  
                # outFile.write('\t'.join([str(scanData[col]) for col in cols]) + '\n')
                # print str(scanData[col])
                res.append([str(scanData[col]) for col in cols])
        else:
            print 'WARNING: Invalid sequence! Unsuccessful sequencing of %s and %s with pair configuration %s' % (str(samePeptideClusters[pair[0]]), str(samePeptideClusters[pair[1]]), pairConfigName)

    exit(0)