All Samples(9509) | Call(9081) | Derive(0) | Import(428)
split(s [,sep [,maxsplit]]) -> list of strings Return a list of the words in the string s, using sep as the delimiter string. If maxsplit is given, splits at no more than maxsplit places (resulting in at most maxsplit+1 words). If sep is not specified or is None, any whitespace string is a separator. (split and splitfields are synonymous)
def split(s, sep=None, maxsplit=-1):
"""split(s [,sep [,maxsplit]]) -> list of strings
Return a list of the words in the string s, using sep as the
delimiter string. If maxsplit is given, splits at no more than
maxsplit places (resulting in at most maxsplit+1 words). If sep
is not specified or is None, any whitespace string is a separator.
(split and splitfields are synonymous)
"""
return s.split(sep, maxsplit)
# the text file should have one extra column that is not used
# so that there are no \n's in the last column of data
for line in data.readlines():
list = string.split(line, sep="\t",maxsplit = -1)
output.append(" "+list[0]+' = db.Citation()')
output.append(" "+list[0]+'.setName("'+list[0]+'")')
output.append(" "+list[0]+'.setAuthors(\''+list[1]+'\')')
output.append(" print 'gene_data'")
for line in data.readlines():
list = string.split(line, sep="\t",maxsplit = -1)
output.append(" "+list[0]+' = db.Gene()')
#output.append(" "+list[0]+'.setName("'+list[0]+'")')
output.append(" "+list[0]+'.commit()')
output.append(" print 'protein_data'")
for line in data.readlines():
list = string.split(line, sep="\t",maxsplit = -1)
output.append(" "+list[0]+' = db.Protein()')
output.append(" "+list[0]+".setName('"+list[0]+"')")
output.append(" "+list[0]+'.setNotes(\''+list[1]+'\')')
output.append(" print 'enzyme_data'")
for line in data.readlines():
list = string.split(line, sep="\t",maxsplit = -1)
output.append(" "+list[0]+'_enzyme = db.Enzyme()')
output.append(" "+list[0]+'_enzyme.setName("'+list[0]+'_enzyme")')
output.append(" "+list[0]+'_enzyme.commit()')
output.append(" print 'reactant_data'")
for line in data.readlines():
list = string.split(line, sep="\t",maxsplit = -1)
output.append(" "+list[1]+' = db.Reactant()')
output.append(" "+list[1]+'.setName("'+list[1]+'")')
output.append(" "+list[1]+'.setDescription(\''+list[3]+'\')')
output.append(" print 'reaction_data'")
output.append(" count = 0")
for line in data.readlines():
list = string.split(line, sep="\t",maxsplit = -1)
# If this is a non-catalytic reaction
output.append(" print 'line #', count")
output.append(" count += 1")
for line in data.readlines():
output.append(" print 'line #', count")
output.append(" count += 1")
list = string.split(line, sep="\t",maxsplit = -1)
output.append(" "+list[1]+' = db.Transcription()')
output.append(" "+list[1]+'.setName("'+list[1]+'")')
output.append(" "+list[1]+'_link = db.TranscribesLink()')
src/m/g/mged-HEAD/lib/Python/pymerase/examples/ReactionDB/text_parser.py mged(Download)
# the text file should have one extra column that is not used
# so that there are no \n's in the last column of data
for line in data.readlines():
list = string.split(line, sep="\t",maxsplit = -1)
output.append(" "+list[0]+' = db.Citation()')
output.append(" "+list[0]+'.setName("'+list[0]+'")')
output.append(" "+list[0]+'.setAuthors(\''+list[1]+'\')')
output.append(" print 'gene_data'")
for line in data.readlines():
list = string.split(line, sep="\t",maxsplit = -1)
output.append(" "+list[0]+' = db.Gene()')
#output.append(" "+list[0]+'.setName("'+list[0]+'")')
output.append(" "+list[0]+'.commit()')
output.append(" print 'protein_data'")
for line in data.readlines():
list = string.split(line, sep="\t",maxsplit = -1)
output.append(" "+list[0]+' = db.Protein()')
output.append(" "+list[0]+".setName('"+list[0]+"')")
output.append(" "+list[0]+'.setNotes(\''+list[1]+'\')')
output.append(" print 'enzyme_data'")
for line in data.readlines():
list = string.split(line, sep="\t",maxsplit = -1)
output.append(" "+list[0]+'_enzyme = db.Enzyme()')
output.append(" "+list[0]+'_enzyme.setName("'+list[0]+'_enzyme")')
output.append(" "+list[0]+'_enzyme.commit()')
output.append(" print 'reactant_data'")
for line in data.readlines():
list = string.split(line, sep="\t",maxsplit = -1)
output.append(" "+list[1]+' = db.Reactant()')
output.append(" "+list[1]+'.setName("'+list[1]+'")')
output.append(" "+list[1]+'.setDescription(\''+list[3]+'\')')
output.append(" print 'reaction_data'")
output.append(" count = 0")
for line in data.readlines():
list = string.split(line, sep="\t",maxsplit = -1)
# If this is a non-catalytic reaction
output.append(" print 'line #', count")
output.append(" count += 1")
for line in data.readlines():
output.append(" print 'line #', count")
output.append(" count += 1")
list = string.split(line, sep="\t",maxsplit = -1)
output.append(" "+list[1]+' = db.Transcription()')
output.append(" "+list[1]+'.setName("'+list[1]+'")')
output.append(" "+list[1]+'_link = db.TranscribesLink()')
src/p/k/pksampler-HEAD/pk/stereo/PyCDDB.py pksampler(Download)
def query(self, discid):
if discid != "":
result = []
self.track_offset = map(string.atoi, string.split(discid)[2:-1])
self.disc_length = string.atoi(string.split(discid)[-1:][0]) * 75
query = urllib.quote_plus(string.rstrip(discid))
url = "%s?cmd=cddb+query+%s&hello=%s+%s+%s+%s&proto=%d" % \
(self.cddb_server, query, self.user, self.host, self.app,
self.version, self.protocol)
response = urllib.urlopen(url)
header = response.readline()
if re.match("[0-9]+.*", header):
self.code = string.atoi(string.split(header, ' ', 1)[0])
if re.match("[0-9]+.*", header):
self.code = string.atoi(string.split(header, ' ', 1)[0])
if self.code == 200: # Exact match
info = string.split(header, ' ', 3)
result.append( { 'category': info[1], 'disc_id': info[2], 'title': info[3] } )
elif self.code == 210 or self.code == 211: # Multiple exact mattches or inexact match
line = string.rstrip(response.readline())
while line != ".":
info = string.split(line, ' ', 2)
self.user, self.host, self.app, self.version, self.protocol)
response = urllib.urlopen(url)
header = response.readline()
self.code = string.atoi(string.split(header, ' ', 1)[0])
if self.code == 210:
re_indexed_key = re.compile("([^=0123456789]+)([0-9]+)=(.*)")
re_key = re.compile("([^=]+)=(.*)")
src/b/i/biopython-doc-ja-HEAD/old_doc_jp/examples/getgene.py biopython-doc-ja(Download)
if not line or not len(line): break
if line[:3] == 'ID ':
id = string.split(line)[1]
start = fid.tell() - len(line)
elif line[:3] == 'AC ':
acc = string.split(line)[1]
def Get(self, id):
try:
values = self.db[id]
except:
return None
start, stop= map(int,string.split(values))
self.fid.seek(start)
txt = self.fid.read(stop - start)
return txt
def Get_Organism(self, id):
entry = self.Get(id)
if not entry: return None
for line in string.split(entry, '\n'):
def FixOS(self, os):
os = string.split(os,',')[0]
os = string.split(os,'(')[0]
return string.strip(os)
def Get_Taxonomy(self, id):
entry = self.Get(id)
if not entry: return None
OC = ""
for line in string.split(entry, '\n'):
def Get_Kingdom(self, id):
res = self.Get_Taxonomy(id)
#print id, res
if not res: return "U"
kd = string.strip(string.split(res,";")[0])
if kd == "Eubacteria" or kd == "Prokaryota" or kd == "Bacteria": return "B"
elif kd == "Eukaryota" or kd =="Eukaryotae": return "E"
def Get_Gene(self, id):
entry = self.Get(id)
if not entry: return None
GN = ''
for line in string.split(entry, '\n'):
if line[0:5] == 'GN ':
GN = string.strip(line[5:])
def Get_OS_OC_GN(self, id):
entry = self.Get(id)
if not entry: return None, None, None
OS, OC, GN = "","",""
for line in string.split(entry, '\n'):
if line[0:5] == 'OS ':
OS = string.strip(line[5:])
def Get_OS_OC_OG(self, id):
entry = self.Get(id)
if not entry: return None, None, None
OS, OC, OG = "","",""
for line in string.split(entry, '\n'):
if line[0:5] == 'OS ':
OS = string.strip(line[5:])
def Get_SQ(self, id, fasta = 1):
entry = self.Get(id)
if not entry: return ""
SQ = ""
record = 0
for line in string.split(entry, '\n'):
if record: SQ = SQ + string.strip(line[5:])
def Get_XX(self, id, xx):
entry = self.Get(id)
if not entry: return ""
XX = ""
for line in string.split(entry, '\n'):
if line[0:5] == '%s ' % xx:
XX = XX + string.strip(line[5:])
def Get_Keywords(self, id):
entry = self.Get(id)
if not entry: return []
keywords = []
for line in string.split(entry, '\n'):
if line[0:5] == 'KW ':
for i in string.split(string.strip(line[5:]),';'):
src/d/i/digest-HEAD/lib/reportlab/graphics/samples/runall.py digest(Download)
def run(format, VERBOSE=0):
formats = string.split(format, ',')
for i in range(0, len(formats)):
formats[i] == string.lower(string.strip(formats[i]))
allfiles = glob.glob('*.py')
allfiles.sort()
for fn in allfiles:
f = string.split(fn, '.')[0]
src/p/r/productiontrack-HEAD/pt1/tools/reportlab/graphics/samples/runall.py productiontrack(Download)
def run(format, VERBOSE=0):
formats = string.split(format, ',')
for i in range(0, len(formats)):
formats[i] == string.lower(string.strip(formats[i]))
allfiles = glob.glob('*.py')
allfiles.sort()
for fn in allfiles:
f = string.split(fn, '.')[0]
src/b/i/biopython-1.55/Doc/examples/getgene.py biopython(Download)
if not line or not len(line): break
if line[:3] == 'ID ':
id = string.split(line)[1]
start = fid.tell() - len(line)
elif line[:3] == 'AC ':
acc = string.split(line)[1]
def Get(self, id):
try:
values = self.db[id]
except:
return None
start, stop= map(int,string.split(values))
self.fid.seek(start)
txt = self.fid.read(stop - start)
return txt
def Get_Organism(self, id):
entry = self.Get(id)
if not entry: return None
for line in string.split(entry, '\n'):
def FixOS(self, os):
os = string.split(os,',')[0]
os = string.split(os,'(')[0]
return string.strip(os)
def Get_Taxonomy(self, id):
entry = self.Get(id)
if not entry: return None
OC = ""
for line in string.split(entry, '\n'):
def Get_Kingdom(self, id):
res = self.Get_Taxonomy(id)
#print id, res
if not res: return "U"
kd = string.strip(string.split(res,";")[0])
if kd == "Eubacteria" or kd == "Prokaryota" or kd == "Bacteria": return "B"
elif kd == "Eukaryota" or kd =="Eukaryotae": return "E"
def Get_Gene(self, id):
entry = self.Get(id)
if not entry: return None
GN = ''
for line in string.split(entry, '\n'):
if line[0:5] == 'GN ':
GN = string.strip(line[5:])
def Get_OS_OC_GN(self, id):
entry = self.Get(id)
if not entry: return None, None, None
OS, OC, GN = "","",""
for line in string.split(entry, '\n'):
if line[0:5] == 'OS ':
OS = string.strip(line[5:])
def Get_OS_OC_OG(self, id):
entry = self.Get(id)
if not entry: return None, None, None
OS, OC, OG = "","",""
for line in string.split(entry, '\n'):
if line[0:5] == 'OS ':
OS = string.strip(line[5:])
def Get_SQ(self, id, fasta = 1):
entry = self.Get(id)
if not entry: return ""
SQ = ""
record = 0
for line in string.split(entry, '\n'):
if record: SQ = SQ + string.strip(line[5:])
def Get_XX(self, id, xx):
entry = self.Get(id)
if not entry: return ""
XX = ""
for line in string.split(entry, '\n'):
if line[0:5] == '%s ' % xx:
XX = XX + string.strip(line[5:])
def Get_Keywords(self, id):
entry = self.Get(id)
if not entry: return []
keywords = []
for line in string.split(entry, '\n'):
if line[0:5] == 'KW ':
for i in string.split(string.strip(line[5:]),';'):
src/p/r/productiontrack-HEAD/tools/reportlab/graphics/samples/runall.py productiontrack(Download)
def run(format, VERBOSE=0):
formats = string.split(format, ',')
for i in range(0, len(formats)):
formats[i] == string.lower(string.strip(formats[i]))
allfiles = glob.glob('*.py')
allfiles.sort()
for fn in allfiles:
f = string.split(fn, '.')[0]
src/w/s/wsfuzzer-HEAD/trunk/WSFuzzer/reportlab/graphics/samples/runall.py wsfuzzer(Download)
def run(format, VERBOSE=0):
formats = string.split(format, ',')
for i in range(0, len(formats)):
formats[i] == string.lower(string.strip(formats[i]))
allfiles = glob.glob('*.py')
allfiles.sort()
for fn in allfiles:
f = string.split(fn, '.')[0]
src/m/w/mwlib.ext-0.12.3/upstream-src/src/reportlab/graphics/samples/runall.py mwlib.ext(Download)
def run(format, VERBOSE=0):
formats = string.split(format, ',')
for i in range(0, len(formats)):
formats[i] == string.lower(string.strip(formats[i]))
allfiles = glob.glob('*.py')
allfiles.sort()
for fn in allfiles:
f = string.split(fn, '.')[0]
1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 Next