美文网首页RNA-seq
一个经常会有些小脚本操作代码的网站-ecseq之脚本收集

一个经常会有些小脚本操作代码的网站-ecseq之脚本收集

作者: 热衷组培的二货潜 | 来源:发表于2018-08-16 15:06 被阅读9次

http://www.ecseq.com/support/

image.png

干货很多,收了不看系列就不好了

1、Convert BAM to BED file format using command line perl

samtools view file.bam | perl -F'\t' -ane '$strand=($F[1]&16)?"-":"+";$length=1;$tmp=$F[5];$tmp =~ s/(\d+)[MD]/$length+=$1/eg;print "$F[2]\t$F[3]\t".($F[3]+$length)."\t$F[0]\t0\t$strand\n";'

2、Convert an interleaved fasta file to a single line fasta using only the Linux command line

awk '{if(NR==1) {print $0} else {if($0 ~ /^>/) {print "\n"$0} else {printf $0}}}' interleaved.fasta > singleline.fasta

3、How to get a coverage graph in WIG file format directly from an alignment (BAM)

samtools mpileup -BQ0 run.sorted.bam | perl -pe '($c, $start, undef, $depth) = split;if ($c ne $lastC || $start != $lastStart+1) {print "fixedStep chrom=$c start=$start step=1 span=1\n";}$_ = $depth."\n";($lastC, $lastStart) = ($c, $start);' | gzip -c > run.wig.gz

4、Convert FASTQ to FASTA on the command line

paste - - - - < file.fq | cut -f 1,2 | sed 's/^@/>/' | tr "\t" "\n" > file.fa

5、Add gzip/gunzip support to a program that doesn't have it (e.g. bowtie)

mkfifo mate1.fastq
mkfifo mate2.fastq
gunzip -c mate1.fastq.gz > mate1.fastq &
gunzip -c mate2.fastq.gz > mate2.fastq &
bowtie -S genome -1 mate1.fastq -2 mate2.fastq > sample.sam

6、Annotate mapping entries of a BAM file based on overlaps with BED files using BEDtools

tagBam -i run.bam -files RefSeq.bed -names -tag GA > run.tagged.bam

7、Extract a list of specific read IDs from a bam file

samtools view file.bam | fgrep -w -f IDs.txt

8、Run time-consuming processes in parallel on Unix systems

# Example usage of xargs (-P is the number of parallel processes started - don't use more than the number of cores you have available):
samtools view -H yourFile.bam | grep "\@SQ" | sed 's/^.*SN://g' | cut -f 1 | xargs -I {} -n 1 -P 24 sh -c "samtools mpileup -BQ0 -d 100000 -uf yourGenome.fa -r {} yourFile.bam | bcftools view -vcg - > tmp.{}.vcf"

# To merge the results afterwards, you might want to do something like this:
samtools view -H yourFile.bam | grep "\@SQ" | sed 's/^.*SN://g' | cut -f 1 | perl -ane 'system("cat tmp.$F[0].bcf >> yourFile.vcf");'

相关文章

  • 一个经常会有些小脚本操作代码的网站-ecseq之脚本收集

    http://www.ecseq.com/support/ 干货很多,收了不看系列就不好了 1、Convert B...

  • Web开发中的 XSS、CSRF/XSRF、CORS

    XSS 跨站脚本攻击 向正常网站的表单中注入恶意脚本代码,窃取网站私有内容,比如窃取cookies、localst...

  • Dos脚本

    自己写的run.bat脚本 参考文章:Bat脚本编写之Dos 基本操作命令Bat脚本及演示

  • Web安全-XSS

    XSS的定义 攻击者利用网站漏洞把恶意的脚本代码(通常包括HTML代码和JavaScript脚本)注入到网页中,当...

  • bash脚本编程

    bash脚本之编程交互 脚本参数 用户交互,通过键盘输入数据,从而完成变量的赋值操作 bash -n 脚本 检查...

  • shell脚本实现FTP上传下载

    下载单个文件脚本代码 上传单个文件脚本代码 批量下载脚本代码 批量上传脚本代码 命令解释 登录FTP << 是使用...

  • xss攻击和csrf攻击

    XSS 跨站脚本攻击。指攻击者在网站上注入恶意脚本(js或html代码块),通过恶意脚本对用户浏览器进行控制或获取...

  • 半夜

    晚上睡觉之前,打开某个代码托管的网站,偶然发现上面有一个python的脚本,可以用这个脚本探测到微信上有哪些好友把...

  • 编译java项目shell脚本

    本人经常在vim里面写一些小demo之类的,就写了一个脚本用来编译普通的java项目脚本内容如下: 值得注意的是我...

  • XSS的两种攻击方式及五种防御方式

    XSS介绍 跨站脚本攻击指的是自己的网站运行了别的网站里面的代码攻击原理是原本需要接受数据但是一段脚本放置在了数据...

网友评论

    本文标题:一个经常会有些小脚本操作代码的网站-ecseq之脚本收集

    本文链接:https://www.haomeiwen.com/subject/mbfobftx.html