def main(args):
    count = 0
    with open(args.wordlist) as f:
        for _ in f:
            count += 1

    i = 0
    bar = progress.ProgressMeter(count)
    with open(args.wordlist) as f:
        for pwd in f:
            pwd = pwd.strip()

            if try_password(args.keychain, pwd):
                print '\n\nfound password: %s' % pwd
                break

            bar.nextItem()

            i += 1
            if i >= 16:
                i = 0
                sys.stdout.write('\r%s %s    ' % (bar, pwd))
                sys.stdout.flush()
Beispiel #2
0
    parbg.transition_table = 'hroest.srmTransitions_' + background
    parbg.peptide_table = 'hroest.srmPeptides_' + background
    background = True
    cmadd = parbg.peptide_table.split('.')[1]
    bgpar = parbg

else: bgpar = par


self = mycollider
self.pepids = self._get_unique_pepids_toptransitions(par, cursor)
MAX_UIS = par.max_uis
common_filename = par.get_common_filename()
self.min_transitions = []
start = time.time()
progressm = progress.ProgressMeter(total=len(self.pepids), unit='peptides')
for i, pep in enumerate(self.pepids):
    p_id = pep['parent_id']
    q1 = pep['q1']
    if not use_randomized_transitions and not use_above_precursor: 
        transitions = self._get_all_transitions_toptransitions(par, pep, cursor)
    elif use_above_precursor: 
        import c_getnonuis
        transitions = c_getnonuis.calculate_transitions_ch(
            ((pep['q1'], pep['mod_sequence'], p_id),), [1], 0, 20000)
        #get all singly charged y ions above the precursor
        y_series = [(t[0], 0) for t in transitions[:len(transitions)/2] if t[0] > q1]
        y_series.reverse()
        y_series = y_series[:5]
        transitions = y_series
    elif use_randomized_transitions: 
q =  """
select modified_sequence, peptide_key, parent_id, q1_charge, q1, ssrcalc, isotope_nr
from %(peptide_table)s where q1 between %(lowq1)s and %(highq1)s
%(qadd)s
""" % {'peptide_table' : peptide_table, 
              'lowq1'  : min_q1 ,
              'highq1' : max_q1,
              'qadd'   : qadd
} 
print q
cursor.execute(q)
print "Obtained all peptides"

alltuples =  list(cursor.fetchall() )

progressm = progress.ProgressMeter(total=len(alltuples), unit='peptides')
prepare  = []
total_transitions = 0
total_assays = 0
for kk, pep in enumerate(alltuples):
    q3_low, q3_high = [400, 1200]
    q3_low, q3_high = [400, 1400]
    q3charges = [1,2]
    q3charges = [1]
    #q3_low, q3_high = [0, 12000]
    #
    #new way to calculate the precursors
    transitions = c_getnonuis.calculate_transitions_ch(
        ((-2, pep[0], -1),), q3charges, q3_low, q3_high)
    #print pep, len(pep[0]), len(transitions)
    total_transitions += len(transitions)
Beispiel #4
0
    def refresh(self, **kw):
        # Clear line
        sys.stdout.write(self.ESC + '[2K')
        self.reset_cursor()
        sys.stdout.write(self.get_meter(**kw))
        # Are we finished?
        if self.count >= self.total:
            sys.stdout.write('\n')
        sys.stdout.flush()
        # Timestamp
        self.last_refresh = time.time()

if __name__ == '__main__':
    import progress
    import time
    import random

    total = 100
    p = progress.ProgressMeter(total=total)

##     for i in range(total):
##         p.update(1)
##         time.sleep(.1)

    while total > 0:
        cnt = random.randint(1,10)
        p.update(cnt)
        total -= cnt
        time.sleep(random.random()*1.)