随笔分类 -  python

按_1 _2 排序fqlist 递归去空格
摘要:# -*- coding: utf-8 -*- # @Time : 2022/2/10 上午10:08 # @Author : lizhichao # @Email : 13652030758@163.com # @File : sort_Fqfile.py # @Software: PyCharm 阅读全文

posted @ 2022-02-10 11:51 BioinformaticsMaster 阅读(24) 评论(0) 推荐(0) 编辑

顺序的fqlist拆解成sample fqsize fq格式 ,涉及正则取样本名
摘要:# -*- coding: utf-8 -*-# @Time : 2022/1/20 下午10:10# @Author : lizhichao# @Email : 13652030758@163.com# @File : sample_fqsize_fq.py# @Software: PyCharm 阅读全文

posted @ 2022-02-10 11:49 BioinformaticsMaster 阅读(28) 评论(0) 推荐(0) 编辑

python 好用的分隔字符串,切片,pop
摘要:linelist=line.rstrip().split(",") # 去掉末尾空白符(空格 换行)后,按,分成列表 切片 linelist[i:j] 取linelist[i]到linelist[j-1] #[]内为索引 缺省i ,默认为0,即从起始元素开始,如linelist[:j] 缺省j, 默 阅读全文

posted @ 2022-01-06 14:33 BioinformaticsMaster 阅读(191) 评论(0) 推荐(0) 编辑

python stderr.write() 和print()/stdout.write()不一个出口
摘要:print()默认情况下,和stdout.write()一个出口,区别是print()自带换行 stderr.write()另一个出口 1) 定义测试python脚本 import sys print ("print") sys.stdout.write("stdout") sys.stderr.w 阅读全文

posted @ 2022-01-04 16:46 BioinformaticsMaster 阅读(92) 评论(0) 推荐(0) 编辑

python 遍历大文件,处理数据时,时时把变量保存到文件,不增大变量,节省内存
摘要:# 多用write()def split_file(infile, n_parts, outdir): if not os.path.exists(infile): sys.stderr.write("Error: Can't find file: %s\n" % infile) sys.exit( 阅读全文

posted @ 2022-01-04 15:53 BioinformaticsMaster 阅读(144) 评论(0) 推荐(0) 编辑

测试csvkit 操作csv
摘要:安装: virtualenv csvhandlesource csvhandle/bin/activate pip install csvkit cd csvhandle mkdir testcd test 测试:软件在对转码方面做的不到位。 ../bin/in2csv 不能转换含中文的excel到 阅读全文

posted @ 2021-11-25 19:45 BioinformaticsMaster 阅读(95) 评论(0) 推荐(0) 编辑

管理不同版本的python用pyenv, 管理环境变量装包用virtualenv
摘要:1. 管理不同版本的python,如python2,python3。 python版本维度。 pythonbrew不再维护 用pyenv brew install pyenv 2.管理同一python版本下不同的环境变量。 项目维度: 2.1 virtualenv 所要解决的是同一个库(包)不同版本 阅读全文

posted @ 2021-11-25 16:57 BioinformaticsMaster 阅读(154) 评论(0) 推荐(0) 编辑

less 文件少一行, python -join -write ,shell 逐行读取
摘要:用python file.write("\n".join(line_list)) 方式将多行内容组成的列表写入文件。文件末行没有换行符, 因此vi打开文件会因为如同window系统一般的文件结尾,提示:[noeol] 且,less |wc-l 的方式数行数会比实际行数少一行。 这样的输出文件用pyt 阅读全文

posted @ 2020-03-03 12:14 BioinformaticsMaster 阅读(338) 评论(0) 推荐(0) 编辑

mac系统安装 python包
摘要:mac 虽然自带python,但是并没有自带pip等这样的管理包。 1.brew install pip 安装pip 时,报错: Error: No available formula with the name "pip" pip is part of the python formula: br 阅读全文

posted @ 2019-06-23 21:13 BioinformaticsMaster 阅读(779) 评论(0) 推荐(0) 编辑

JetBrains产品激活
摘要:本文适用于所有 JetBrains 系列产品 亲测 方法二队DataGrip可用。 方法一、最新方法Jet Brains家族破解方法 方法二、本方法来自网络 原文地址 http://xidea.online 阅读全文

posted @ 2018-06-08 15:44 BioinformaticsMaster 阅读(152) 评论(0) 推荐(0) 编辑

Python装饰器 name binding
摘要:python 装饰器 函数或方法 @decorate def fun(a,b): ... fun(1,2) 时即 fun=decorate(fun) fun(1,2) 若decorate有参数则相当于 fun=decorate(参数)(fun) 若装饰类 则一样的,更新方法、属性。 同样的是name 阅读全文

posted @ 2018-05-27 16:14 BioinformaticsMaster 阅读(257) 评论(0) 推荐(0) 编辑

python egg包类似jar,都是以zip为基础的,.egg结尾 的文件
摘要:python egg包类似jar,都是以zip为基础的,.egg结尾 的文件,作为bundles for distributing code 。 一个 “python egg “ 是一个python项目的逻辑结构,由代码、resources、metadata组成。 egg的关键原则是可发现(disc 阅读全文

posted @ 2018-05-16 23:55 BioinformaticsMaster 阅读(2169) 评论(0) 推荐(0) 编辑

python @property 将类的方法转化为属性读取并赋值
摘要:@property 将类方法转化为类属性调用。 >>> person = Person("Mike", "Driscoll")>>> person.full_name'Mike Driscoll'>>> person.first_name'Mike'>>> person.full_name = "J 阅读全文

posted @ 2018-05-16 00:27 BioinformaticsMaster 阅读(244) 评论(0) 推荐(0) 编辑

python 变量解压赋值
摘要:* 数组 ** 字典 如 >>> d = dict(a=4,b=5,c=6) >>> test(**d) 重要参考:https://blog.csdn.net/zvall/article/details/79052576 阅读全文

posted @ 2018-05-16 00:10 BioinformaticsMaster 阅读(196) 评论(0) 推荐(0) 编辑

fnmatch 优点在于 linux shell通配符
摘要:fnmatch模块: 优点在于提供对Unix Shell通配符的支持 Pattern Meaning * matches everything ? matches any single character [seq] matches any character in seq [!seq] match 阅读全文

posted @ 2018-05-11 00:43 BioinformaticsMaster 阅读(153) 评论(0) 推荐(0) 编辑

pycharm 代码块缩进、左移
摘要:1、pycharm使多行代码同时缩进 鼠标选中多行代码后,按下Tab键,一次缩进四个字符 2、pycharm使多行代码同时左移 鼠标选中多行代码后,同时按住shift+Tab键,一次左移四个字符 鼠标选中多行代码后,按下Tab键,一次缩进四个字符 2、pycharm使多行代码同时左移 鼠标选中多行代 阅读全文

posted @ 2018-05-10 16:19 BioinformaticsMaster 阅读(947) 评论(0) 推荐(0) 编辑

os.popen(cmd) .read() 获取执行后的结果且带有换行符\n
摘要:os.popen(cmd) .read() 获取执行后的结果自动带有换行符\n >>> a=os.popen("ls ./soapnuke_output/CL100006359_L01_8 |wc -l")>>> a<open file 'ls ./soapnuke_output/CL1000063 阅读全文

posted @ 2018-04-14 09:59 BioinformaticsMaster 阅读(7788) 评论(0) 推荐(0) 编辑

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5
点击右上角即可分享
微信分享提示