code
stringlengths
1
1.72M
language
stringclasses
1 value
# -*- coding: utf-8 -*- ''' Created on 2011-11-21 @author: Administrator ''' import shutil import struct import os from setting import * import time from pinyin import * import zipfile def myfloat(src): if len(src.strip())==0:return 0 return float(src) def str2date(src): # print src ...
Python
''' Created on 2011-11-14 @author: Administrator ''' import os import Queue import struct import datetime foxtrader='d:\\foxtrader' foxdata_rootpath='e:\\foxdata' foxdata_backuppath=os.path.join(foxdata_rootpath,'backup') shareholderpath=os.path.join(foxdata_rootpath,'shareholder') shareholderresultpath=o...
Python
''' Created on 2011-10-26 @author: Administrator ''' import os import urllib2 import sqlite3 import datetime import threading import Queue import time import shutil from setting import * class ThreadStockDataDownload(threading.Thread): def __init__(self): threading.Thread.__init__(...
Python
# -*- coding: utf-8 -*- ''' Created on 2011-11-14 @author: Administrator ''' from setting import * import urllib2 import os from stockdatadownload import * import datetime from foxtrader import * from sinastock import * from ibstock import * from bloombergstock import * def updateFoxAHstockdata():...
Python
''' Created on 2011-11-14 @author: Administrator ''' from setting import * import urllib2 import os from stockdatadownload import * import datetime from foxtrader import * from sinastock import * from ibstock import * from bloombergstock import * def updateFoxUSstockdata(): # regdict={'NS':'nyse'...
Python
''' Created on 2011-11-23 @author: Administrator ''' from foxtrader import * import datetime from processbydate import * def date2int(sdate): return sdate.year*10000+sdate.month*100+sdate.day def str2date(sdate): return sdate return datetime.date(int(sdate[:4]),int(sdate[4:6]),int(sdate[6:8])) ...
Python
''' Created on 2011-11-21 @author: Administrator ''' import urllib2 import datetime class IBStock(): #reg=['AMEX'NASDAQ,NYSE def getstocklist(self,reg): def getonepagelist(snum): url='http://www.interactivebrokers.com.hk/en/trading/exchanges.php?exch='+reg+'&showcategories=STK&sh...
Python
# -*- coding: utf-8 -*- ''' Created on 2011-11-21 @author: Administrator ''' import struct import os from setting import * import time from pinyin import * def myfloat(src): if len(src.strip())==0:return 0 return float(src) def str2date(src): # print src return datetime.datetime(int(src[...
Python
# -*- coding: utf-8 -*- #!/usr/bin/env python # coding : utf-8 # author : binux(17175297.hk@gmail.com) from sinastock import * #!/usr/bin/env python # encoding: utf-8 """ Created by Eric Lo on 2010-05-20. Copyright (c) 2010 __lxneng@gmail.com__. http://lxneng.com All rights reserved. """ class Pinyin(): ...
Python
''' Created on 2011-11-21 @author: Administrator ''' import urllib2 import datetime class BBStock(): def stocklist(self,reg): pass def getAstocklistfrombloomberg(self): def parseonestock(src): nlist=src.split('<td') ret=[] for n in nlist: ...
Python
# -*- coding: utf-8 -*- ''' Created on 2011-11-23 @author: Administrator ''' from sinastock import * import urllib2 import simplejson import os import urllib2 import sqlite3 import datetime import threading import Queue import time import shutil from setting import * def myfloat(src): if len(...
Python
''' Created on 2011-11-21 @author: Administrator ''' import urllib2 import datetime class SINAStock(): ''' get A,HK,US stock list from all vendor ''' def getstocklist(self,reg): if reg=='SH':return self.getSHstocklistfromSINA() elif reg=='HK':return self.getHKstocklistfro...
Python
''' Created on 2011-10-26 test for rawcontent ,errlist,jobslist use dict instead of file @author: Administrator ''' import os import urllib2 import sqlite3 import datetime import threading import Queue import time import shutil import simplejson from setting import * joblist={1:1} loglist={1:1} class ...
Python
# -*- coding: utf-8 -*- ''' Created on 2011-11-21 @author: Administrator ''' import struct import os from setting import * import time from pinyin import * def myfloat(src): if len(src.strip())==0:return 0 return float(src) def str2date(src): # print src return datetime.datetime(int(src[...
Python
''' Created on 2011-11-14 @author: Administrator ''' import os import Queue import struct import datetime foxtrader='d:\\foxtrader' foxdata_rootpath='e:\\foxdata' shareholderpath=os.path.join(foxdata_rootpath,'shareholder') shareholderresultpath=os.path.join(foxdata_rootpath,'shareholderresult') rawconten...
Python
''' Created on 2011-10-26 @author: Administrator ''' import os import urllib2 import sqlite3 import datetime import threading import Queue import time import shutil from setting import * class ThreadStockDataDownload(threading.Thread): def __init__(self): threading.Thread.__init__(...
Python
# -*- coding: utf-8 -*- ''' Created on 2011-11-14 @author: Administrator ''' from setting import * import urllib2 import os from stockdatadownload import * import datetime from foxtrader import * from sinastock import * from ibstock import * from bloombergstock import * def updateFoxAHstockdata():...
Python
''' Created on 2011-11-14 @author: Administrator ''' from setting import * import urllib2 import os from stockdatadownload import * import datetime from foxtrader import * from sinastock import * from ibstock import * from bloombergstock import * def updateFoxAHstockdata(): reglist=['SZ','SH',...
Python
''' Created on 2011-11-21 @author: Administrator ''' import urllib2 import datetime class IBStock(): #reg=['AMEX'NASDAQ,NYSE def getstocklist(self,reg): def getonepagelist(snum): url='http://www.interactivebrokers.com.hk/en/trading/exchanges.php?exch='+reg+'&showcategories=STK&sh...
Python
#!/usr/bin/env python # # Copyright 2007 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law o...
Python
#!/usr/bin/env python # # Copyright 2007 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law o...
Python
#!/usr/bin/env python # # Copyright 2007 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law o...
Python
#!/usr/bin/env python # # Copyright 2007 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law o...
Python
#!/usr/bin/env python # # Copyright 2007 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law o...
Python
#!/usr/bin/env python # # Copyright 2007 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law o...
Python
#!/usr/bin/env python # # Copyright 2007 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law o...
Python
#!/usr/bin/env python # # Copyright 2007 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law o...
Python
#!/usr/bin/env python # # Copyright 2007 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law o...
Python
#!/usr/bin/env python # # Copyright 2007 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law o...
Python
#!/usr/bin/env python # # Copyright 2007 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law o...
Python
#!/usr/bin/env python # # Copyright 2007 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law o...
Python
#!/usr/bin/env python # # Copyright 2007 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law o...
Python
#!/usr/bin/env python # # Copyright 2007 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law o...
Python
# -*- coding: utf-8 -*- #!/usr/bin/env python # coding : utf-8 # author : binux(17175297.hk@gmail.com) from sinastock import * #!/usr/bin/env python # encoding: utf-8 """ Created by Eric Lo on 2010-05-20. Copyright (c) 2010 __lxneng@gmail.com__. http://lxneng.com All rights reserved. """ class Pinyin(): ...
Python
''' Created on 2011-11-21 @author: Administrator ''' import urllib2 import datetime class BBStock(): def stocklist(self,reg): pass def getAstocklistfrombloomberg(self): def parseonestock(src): nlist=src.split('<td') ret=[] for n in nlist: ...
Python
# -*- coding: utf-8 -*- ''' Created on 2011-11-23 @author: Administrator ''' from sinastock import * import urllib2 import simplejson import os import urllib2 import sqlite3 import datetime import threading import Queue import time import shutil from setting import * def myfloat(src): if len(...
Python
''' Created on 2011-11-21 @author: Administrator ''' import urllib2 import datetime class SINAStock(): ''' get A,HK,US stock list from all vendor ''' def getstocklist(self,reg): if reg=='SH':return self.getSHstocklistfromSINA() elif reg=='HK':return self.getHKstocklistfro...
Python
''' Created on 2011-10-26 test for rawcontent ,errlist,jobslist use dict instead of file @author: Administrator ''' import os import urllib2 import sqlite3 import datetime import threading import Queue import time import shutil import simplejson from setting import * joblist={1:1} loglist={1:1} class ...
Python
# -*- coding: utf-8 -*- ''' Created on 2011-11-21 @author: Administrator ''' import struct import os from setting import * import time from pinyin import * def myfloat(src): if len(src.strip())==0:return 0 return float(src) def str2date(src): # print src return datetime.datetime(int(src[...
Python
''' Created on 2011-11-14 @author: Administrator ''' import os import Queue import struct import datetime foxtrader='d:\\foxtrader' foxdata_rootpath='e:\\foxdata' shareholderpath=os.path.join(foxdata_rootpath,'shareholder') shareholderresultpath=os.path.join(foxdata_rootpath,'shareholderresult') rawconten...
Python
''' Created on 2011-10-26 @author: Administrator ''' import os import urllib2 import sqlite3 import datetime import threading import Queue import time import shutil from setting import * class ThreadStockDataDownload(threading.Thread): def __init__(self): threading.Thread.__init__(...
Python
# -*- coding: utf-8 -*- ''' Created on 2011-11-14 @author: Administrator ''' from setting import * import urllib2 import os from stockdatadownload import * import datetime from foxtrader import * from sinastock import * from ibstock import * from bloombergstock import * def updateFoxAHstockdata():...
Python
''' Created on 2011-11-14 @author: Administrator ''' from setting import * import urllib2 import os from stockdatadownload import * import datetime from foxtrader import * from sinastock import * from ibstock import * from bloombergstock import * def updateFoxAHstockdata(): reglist=['SZ','SH',...
Python
''' Created on 2011-11-21 @author: Administrator ''' import urllib2 import datetime class IBStock(): #reg=['AMEX'NASDAQ,NYSE def getstocklist(self,reg): def getonepagelist(snum): url='http://www.interactivebrokers.com.hk/en/trading/exchanges.php?exch='+reg+'&showcategories=STK&sh...
Python
#!/usr/bin/python # # Copyright (C) 2012 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law ...
Python
#!/usr/bin/python # # Copyright (C) 2012 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law ...
Python
#!/usr/bin/env python # # Copyright (c) 2002, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this ...
Python
#!/usr/bin/env python # Copyright (c) 2010, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this l...
Python
# Copyright (C) 2010 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writ...
Python
#!/usr/bin/python2.4 # -*- coding: utf-8 -*- # # Copyright (C) 2011 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless ...
Python
# Copyright 2011 Google Inc. All Rights Reserved. """Locked file interface that should work on Unix and Windows pythons. This module first tries to use fcntl locking to ensure serialized access to a file, then falls back on a lock file if that is unavialable. Usage: f = LockedFile('filename', 'r+b', 'rb') f....
Python
# Copyright 2011 Google Inc. All Rights Reserved. """Multi-credential file store with lock support. This module implements a JSON credential store where multiple credentials can be stored in one file. That file supports locking both in a single process and across processes. The credential themselves are keyed off o...
Python
# Copyright (C) 2010 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writ...
Python
# Copyright (C) 2010 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writ...
Python
# Copyright (C) 2010 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writ...
Python
# Copyright (C) 2011 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writ...
Python
# Copyright (C) 2010 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writ...
Python
__version__ = "1.0c2"
Python
# Copyright (C) 2010 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writ...
Python
# Copyright (C) 2012 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writ...
Python
# Copyright (C) 2007 Joe Gregorio # # Licensed under the MIT License """MIME-Type Parser This module provides basic functions for handling mime-types. It can handle matching mime-types against a list of media-ranges. See section 14.1 of the HTTP specification [RFC 2616] for a complete explanation. http://www.w3.o...
Python
# Copyright (C) 2010 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writ...
Python
# Copyright (C) 2010 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writ...
Python
# Copyright (C) 2010 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writ...
Python
# Copyright (C) 2010 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writ...
Python
# Copyright (C) 2010 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writ...
Python
# Copyright (C) 2010 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writ...
Python
# Copyright (C) 2010 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writ...
Python
# Copyright (C) 2010 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writ...
Python
__version__ = "1.0c2"
Python
#!/usr/bin/python2.4 # # Copyright (C) 2010 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable l...
Python
#!/usr/bin/python2.4 # # Copyright (C) 2010 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable l...
Python
""" iri2uri Converts an IRI to a URI. """ __author__ = "Joe Gregorio (joe@bitworking.org)" __copyright__ = "Copyright 2006, Joe Gregorio" __contributors__ = [] __version__ = "1.0.0" __license__ = "MIT" __history__ = """ """ import urlparse # Convert an IRI to a URI following the rules in RFC 3987 # # The characte...
Python
from __future__ import generators """ httplib2 A caching http interface that supports ETags and gzip to conserve bandwidth. Requires Python 2.3 or later Changelog: 2007-08-18, Rick: Modified so it's able to use a socks proxy if needed. """ __author__ = "Joe Gregorio (joe@bitworking.org)" __copyright__ = "Copyright...
Python
"""SocksiPy - Python SOCKS module. Version 1.00 Copyright 2006 Dan-Haim. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this ...
Python
import Cookie import datetime import time import email.utils import calendar import base64 import hashlib import hmac import re import logging # Ripped from the Tornado Framework's web.py # http://github.com/facebook/tornado/commit/39ac6d169a36a54bb1f6b9bf1fdebb5c9da96e09 # # Tornado is licensed under the Apache Licen...
Python
# This is the version of this source code. manual_verstr = "1.5" auto_build_num = "211" verstr = manual_verstr + "." + auto_build_num try: from pyutil.version_class import Version as pyutil_Version __version__ = pyutil_Version(verstr) except (ImportError, ValueError): # Maybe there is no pyutil insta...
Python
""" The MIT License Copyright (c) 2007-2010 Leah Culver, Joe Stump, Mark Paschal, Vic Fryzel Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the ...
Python
""" The MIT License Copyright (c) 2007-2010 Leah Culver, Joe Stump, Mark Paschal, Vic Fryzel Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the ...
Python
""" The MIT License Copyright (c) 2007-2010 Leah Culver, Joe Stump, Mark Paschal, Vic Fryzel Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the ...
Python
# Early, and incomplete implementation of -04. # import re import urllib RESERVED = ":/?#[]@!$&'()*+,;=" OPERATOR = "+./;?|!@" EXPLODE = "*+" MODIFIER = ":^" TEMPLATE = re.compile(r"{(?P<operator>[\+\./;\?|!@])?(?P<varlist>[^}]+)}", re.UNICODE) VAR = re.compile(r"^(?P<varname>[^=\+\*:\^]+)((?P<explode>[\+\*])|(?P<part...
Python
import httplib, urllib #CLIENT_ID = 'SFBFUH1DMDJE02Y5H355NRC3TYWRIWR3YEZRA1LVFCT2LIVO' #CLIENT_SECRET = 'VXZHEVFUP0O5MW3C0VSP2ONRORD4G132MBWALO3IQIM4L3T2' CLIENT_ID = '2QDCK4V50CJF23APRR0LBJNMSS0VWACTXSPP3IATIFQ4SKTK' CLIENT_SECRET = '343G3ZRHBTCJWBDSQH2B0JZGSOFNOHAJN22HJAYVUB5KRFWK' HOST = 'foursquare.com' ...
Python
import httplib, urllib, socket import time, os import json CLIENT_ID = '2QDCK4V50CJF23APRR0LBJNMSS0VWACTXSPP3IATIFQ4SKTK' CLIENT_SECRET = '343G3ZRHBTCJWBDSQH2B0JZGSOFNOHAJN22HJAYVUB5KRFWK' REDIRECT_URI = 'http://www.ntu.edu.sg/' HOST = 'foursquare.com' API_HOST = 'api.foursquare.com' TIMEOUT = 60 socket....
Python
import os,sys import numpy as np import time import scipy.stats as ss from hmmpytk import hmm_faster from hmmpytk import hmm_gamma import math if len(sys.argv)<7: print 'Usage: python callImba.py FaireSig conservation testFaire testCons' exit(1) # class RealBinObs: # fsig=0 # cons=0 # def __init__...
Python
import sys,os import scipy.stats as ss import scipy as sp import time import bisect import math if len(sys.argv)<2: print 'Usage: python fitGamma.py infile' exit(1) lines=open(sys.argv[1]).readlines() data=[float(x) for x in lines ]#if float(x)>0] #data=ss.gamma.rvs(alpha,loc=loc,scale=beta,size=10000) a=ss....
Python
# hmmpytk/hmm_faster.py - HMM (Hidden Markov Model) implementation written in Python # Yuchen Zhang (yuchenz@cs.cmu.edu) # Version history: # # Dec 31, 2012, 0.2.0 - Big improvements in speed # Dec 28, 2012, 0.1.1 - Added support for training on multiple instances # Dec 27, 2012, 0.1.0 - initial version # # You may ...
Python
import hmm_faster hmm_model = hmm_faster.HMM() hmm_model.set_states(['Healthy', 'Fever']) #hmm_model.set_states(['Fever', 'Healthy']) hmm_model.set_observations(['normal', 'cold', 'dizzy']) hmm_model.randomize_matrices(seed = 19997) Pi_matrix={'Healthy': 0.6, 'Fever': 0.4} T_matrix={'Healthy' : {'Healthy': 0.7, 'Fever...
Python
# # author Yang Ruijie (yrjie0@gmail.com) # modified from hmmpytk # # gamma_par[i][j][k]: state i, variable j, k=0 alpha,1 loc,2 beta # obs_seq[i][j]: the ith obs, the jth variable import sys import math import random import copy import pickle import scipy.stats as ss import bisect class HMMgamma: INF = float('i...
Python
# hmmtk/hmm.py - HMM (Hidden Markov Model) implementation written in Python # First version author: Yuchen Zhang (yuchenz@cs.cmu.edu) # Version history: # # Dec 28, 2012, 0.1.1 - Added support for training on multiple instances # Dec 27, 2012, 0.1.0 - initial version # # *** THIS PACKAGE IS OBSOLETE, PLEASE USE THE ...
Python
import sys,os if len(sys.argv)<4: print 'Usage: python Fpeak.py plus.bedGraph minus.bedGraph prefix' exit(1) class ChrBin: chr='chr1' beg=0 end=0 val=0 def __init__(self, chr, beg, end, val): self.chr=chr self.beg=beg self.end=end self.val=val prefix=sys.argv[3] bin=20...
Python
import os,sys import numpy as np import time import scipy.stats as ss from hmmpytk import hmm_faster from hmmpytk import hmm_gamma import math if len(sys.argv)<7: print 'Usage: python callImba.py FaireSig conservation testFaire testCons' exit(1) # class RealBinObs: # fsig=0 # cons=0 # def __init__...
Python
import sys,os import scipy.stats as ss import scipy as sp import time import bisect import math if len(sys.argv)<2: print 'Usage: python fitGamma.py infile' exit(1) lines=open(sys.argv[1]).readlines() data=[float(x) for x in lines ]#if float(x)>0] #data=ss.gamma.rvs(alpha,loc=loc,scale=beta,size=10000) a=ss....
Python
import sys,os if len(sys.argv)<2: print 'Usage: overlapFile' exit(1) nowID='' print '\t'.join(['peak','TF','<100','100-200','200-300','300-400','>400','total']) fi=open(sys.argv[1]) for line in fi: line=line.strip() if len(line)<1: continue temp=line.split('\t') id=temp[0]+':'+temp[1]+'-'...
Python
import sys,os if len(sys.argv)<3: print 'Usage: bedfile genome' exit(1) weight=[(104,1), (164,2), (1000,1)] chrom={} def getChrLen(): fi=open(sys.argv[2]) for line in fi: line=line.strip() if len(line)<1: continue temp=line.split() chrom[temp[0]]=int(temp[1]) fi.close() def readBed()...
Python
import sys,os if len(sys.argv)<2: print 'Usage: bedfile' exit(1) sumDict={} cntDict={} fi=open(sys.argv[1]) for line in fi: line=line.strip() if len(line)<1: continue temp=line.split('\t') if temp[0] not in sumDict: sumDict[temp[0]]=0 cntDict[temp[0]]=0 num=int(temp[2])-int(...
Python
import sys,os from subprocess import * import operator if len(sys.argv)<3: print 'Usage: peakFile TFfile' exit(1) peak=sys.argv[1] tf=sys.argv[2] fi=open(tf) allNum={} for line in fi: line=line.strip() if len(line)<1: continue temp=line.split('\t') if temp[3] in allNum: allNum[temp[...
Python
# hmmpytk/hmm_faster.py - HMM (Hidden Markov Model) implementation written in Python # Yuchen Zhang (yuchenz@cs.cmu.edu) # Version history: # # Dec 31, 2012, 0.2.0 - Big improvements in speed # Dec 28, 2012, 0.1.1 - Added support for training on multiple instances # Dec 27, 2012, 0.1.0 - initial version # # You may ...
Python
import hmm_faster hmm_model = hmm_faster.HMM() hmm_model.set_states(['Healthy', 'Fever']) #hmm_model.set_states(['Fever', 'Healthy']) hmm_model.set_observations(['normal', 'cold', 'dizzy']) hmm_model.randomize_matrices(seed = 19997) Pi_matrix={'Healthy': 0.6, 'Fever': 0.4} T_matrix={'Healthy' : {'Healthy': 0.7, 'Fever...
Python
# # author Yang Ruijie (yrjie0@gmail.com) # modified from hmmpytk # # gamma_par[i][j][k]: state i, variable j, k=0 alpha,1 loc,2 beta # obs_seq[i][j]: the ith obs, the jth variable import sys import math import random import copy import pickle import scipy.stats as ss import bisect class HMMgamma: INF = float('i...
Python
# hmmtk/hmm.py - HMM (Hidden Markov Model) implementation written in Python # First version author: Yuchen Zhang (yuchenz@cs.cmu.edu) # Version history: # # Dec 28, 2012, 0.1.1 - Added support for training on multiple instances # Dec 27, 2012, 0.1.0 - initial version # # *** THIS PACKAGE IS OBSOLETE, PLEASE USE THE ...
Python