mzURL.py 文件源码

python
阅读 17 收藏 0 点赞 0 评论 0

项目:multiplierz 作者: BlaisProteomics 项目源码 文件源码
def scans(self):
        '''Gets the scan_info and caches it, to save extra trips to the server'''

        if not self._scans:
            self.crl.setopt(pycurl.HTTPGET, True)
            self.crl.setopt(pycurl.URL, str(self.data_file + '/scan_info'))

            # the scan_name is the URL of that scan, which is just the time
            scan_url = self.data_file + '/scans/%s'

            response = cStringIO.StringIO()
            self.crl.setopt(pycurl.WRITEFUNCTION, response.write)

            #self.crl.perform()
            for i in range(5):
                #print 'scans %d' % i
                self.crl.perform()
                if response.getvalue():
                    break

            scans = response.getvalue().splitlines()

            self._scans = []
            for scan_line in scans:
                time,mz,scan_type,scan_mode = scan_line.split()
                self._scans.append((float(time),
                                    float(mz),
                                    scan_url % time,
                                    scan_type.upper(),
                                    scan_mode.lower()))

            self._scans.sort()

        return self._scans
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号