Exemplo n.º 1
0
#!/bin/env python27

import sys
from getwiki import GPTWiki

w = GPTWiki()

if len(sys.argv) > 1:

    if sys.argv[1] == "-":

        for p in w.iterpages(exclude_categories=[
                'Transition', 'Peptide', 'Protein', 'TransitionGroup', 'Glycan'
        ]):
            print >> sys.stderr, p.name
            w.refresh(p)

    elif sys.argv[1] in ('Transition', 'Peptide', 'Protein', 'Glycan',
                         'TransitionGroup'):

        for p in w.iterpages(include_categories=sys.argv[1:]):
            print >> sys.stderr, p.name
            w.refresh(p)

    else:

        for p in w.iterpages(regex=sys.argv[1]):
            print >> sys.stderr, p.name
            w.refresh(p)

else:
Exemplo n.º 2
0
fromwiki = sys.argv[1].upper()
towiki = sys.argv[2].upper()

assert fromwiki in ("PROD", "DEV", "TEST")
assert towiki in ("PROD", "DEV", "TEST")
assert fromwiki != towiki

w1 = GPTWiki(smwenv=fromwiki, quiet=True)
print >> sys.stderr, "from: %s" % (w1.title(), )
w2 = GPTWiki(smwenv=towiki, quiet=True)
print >> sys.stderr, "  to: %s" % (w2.title(), )

dummy = raw_input("Enter to proceed, <Ctrl-C> to abort:")

currentids = set()
for page in w1.iterpages(include_categories=('Transition', 'Peptide',
                                             'TransitionGroup')):
    id = page.name
    currentids.add(id)
    it = w1.get(id)
    if w2.put(it):
        print >> sys.stderr, "Pushing %s to %s" % (id, w2.title())
    else:
        print >> sys.stderr, "No change to %s in %s" % (id, w2.title())

for page in w2.iterpages(include_categories=('Transition', 'Peptide',
                                             'TransitionGroup')):
    id = page.name
    if id not in currentids:
        w2.delete(id)
        print >> sys.stderr, "Delete %s from %s" % (id, w2.title())
Exemplo n.º 3
0
import sys, urllib, string, csv, os.path
from collections import defaultdict
import Bio.SeqIO
from util import peptide_mw, mod_mw


def asscan(s):
    t = s.rstrip(')').split('(')
    return [int(t[0])] + t[1].split(',')


w = GPTWiki()

spectra2tg = defaultdict(set)
for tgpage in w.iterpages(include_categories=['TransitionGroup']):
    tg = w.get(tgpage.name)
    spectra = tg.get('spectra')
    spectra2tg[spectra].add(tg.get('id'))

allspectra = set()

for transfile in sys.argv[1:]:
    spectra, sample, method, index, extn = transfile.rsplit('.', 4)
    spectra = os.path.split(spectra)[1]
    allspectra.add(spectra)
    w.addacquisition(name=spectra, method=method, sample=sample)
    tgroup = defaultdict(dict)
    for l in csv.DictReader(open(transfile), dialect='excel-tab'):
        seq = l['PeptideSequence']
        glyspec = l['Glycans']
Exemplo n.º 4
0
#!/bin/env python27

from getwiki import GPTWiki, Peptide

import sys, urllib, string
import Bio.SeqIO
from util import peptide_mw, mod_mw

seen = set()

w = GPTWiki()
peps = []
for p in w.iterpages(include_categories=['Peptide']):
    pep = w.get(p.name)
    pepkey = Peptide.key(pep.get('sequence'), pep.get('glycan', []),
                         pep.get('mod', []))
    if pepkey in seen:
        print >> sys.stderr, p.name
        w.delete(p.name)
    seen.add(pepkey)