Bash script for batch work

#!/bin/bash #PBS -l walltime=96:00:00,nodes=8:ppn=10 #PBS -N kofamscan source activate hybrid_assembly #SC9523_extract_paired_1.fasta.fastq_matchedmeghitresult #metawrap binning -o /home/mhyleung/workspace/loreal_shotgun2/NovaSeq_new/metawrap_assembly_R2/LOR303C -t 16 -a /home/mhyleung/worksp[……]

Read more

[…]

how-to-extract-convert-gff3-cds-sequences-to-multifasta

https://bioinformatics.stackexchange.com/questions/2341/how-to-extract-convert-gff3-cds-sequences-to-multifasta

Using python and this GFF parser that mimics Biopython’s SeqIO parsers:
from BCBio import GFF # Read the gff for seq in GFF.parse('my_file.gff'): # only focus on t[......]

Read more

[…]

python and PBS script

#!/bin/bash #PBS -l walltime=48:00:00,nodes=8:ppn=4 #PBS -N bbmap_batch #PBS -l walltime=48:00:00 #megahit -1 /disk/rdisk09/zhiyshen/combined_HKG_1.fastq.gz -2 /disk/rdisk09/zhiyshen/combined_HKG_2.fastq.gz -m 0.9 -o /disk/rdisk09/zhiyshen/HKG_coassembly_out –min-contig-len 2000 -t 28 source a[……]

Read more

[…]

dictionary to csv

#!/usr/bin/env python import os,re,sys,string,commands,getopt,subprocess,glob,csv import prettytable as pt from os import path #SL335752_kneaddata_paired_1_kneaddata_paired_1.fastq.gz_rep.mpa.txt_bracken.txt #SL311013_1_kneaddata_paired_1_kneaddata_paired_1.fastq.gz_rep_mpa.txt_bracken.txt def[……]

Read more

[…]

batch script in python

#!/usr/bin/env python import os,re,sys,string,commands,getopt,subprocess,glob from os import path #/disk/rdisk08/mhyleung/loreal_shotgun2/NovaSeq_new/decontam_output_genome/paired_completed/szy_test #LOR294C_S130_R1_001_kneaddata_paired_1_decontaminated.fastq.paired.fq.gz #LOR294C_S130_R1_001[……]

Read more

[…]

linux shell 用sed命令在文本的行尾或行首添加字符

昨天写一个脚本花了一天的2/3的时间,而且大部分时间都耗在了sed命令上,今天不总结一下都对不起昨天流逝的时间啊~~~   用sed命令在行首或行尾添加字符的命令有以下几种: 假设处理的文本为test.file 在每行的头添加字符,比如”HEAD”,命令如下: sed ‘s/^/HEAD&/g’ test.file 在每行的行尾添加字符,比如“TAIL”,命令如下: sed ‘s/$/&TAIL/g’ test.file 运行结果如下图: 几点说明: 1.”^”代表行首,”$”代表行尾[……]

Read more

[…]

Python 字符串操作(string替换、删除、截取、复制、连接、比较、查找、包含、大小写转换、分割等

Python 字符串操作(string替换、删除、截取、复制、连接、比较、查找、包含、大小写转换、分割等)
s.strip() .lstrip() .rstrip(',') 去空格及特殊符号

复制字符串

Python

1 #strcpy(sStr1,sStr2)
2 sStr1 = 'strcpy'
3 sStr2 = sStr1
4 sStr1 = 'strcpy2'
5 print sStr2

连[……]

Read more

[…]

Python 自建标准差函数

def stdDeviation(a): l=len(a) m=sum(a)/l d=0 for i in a: d+=(i-m)**2 return (d*(1/l))**0.5 a=[5,6,8,9] print(stdDeviation(a)) ======== 1.5811388300841898 […]

Good Useful one-line scripts for sed!

------------------------------------------------------------------------- SED单行脚本快速参考(Unix 流编辑器) 2005年12月29日 英文标题:USEFUL ONE-LINE SCRIPTS FOR SED (Unix stream editor) 原标题:HANDY ONE-LINERS FOR SED (Unix stream editor) 整理:Eric Pement - 电邮:pemente[at]northpark[dot]edu[......]

Read more

[…]

[python] 关于python中的string.atoi()的问题

#!/usr/bin/python #filename:string.py import string print string.atoi(’13’,8) #这里转换8进制的数 print string.atoi(’13’,16) #这里转换成16进制的数 运行后的结果: 11 19 >>> import string >>> string.atoi(’13’,8) 11 >>> string.atoi(’13’,10) 13 >>> string.at[……]

Read more

[…]