统计碱基数目GC含量read数最长的read最短的read及平均read长度

Posted Datapotumas

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了统计碱基数目GC含量read数最长的read最短的read及平均read长度相关的知识,希望对你有一定的参考价值。

# 用于fasta格式文件的碱基数目和GC含量的统计

grep -v ‘>‘ input.fa| perl -ne  ‘{$count_A=$count_A+($_=~tr/A//);$count_T=$count_T+($_=~tr/T//);$count_G=$count_G+($_=~tr/G//);$count_C=$count_C+($_=~tr/C//);$count_N=$count_N+($_=~tr/N//)};END{print qq{total count is },$count_A+$count_T+$count_G+$count_C+$count_N, qq{\nGC%:},($count_G+$count_C)/($count_A+$count_T+$count_G+$count_C+$cont_N),qq{\n} }‘

 

用于fastq格式文件的read数、碱基数、最长的read、最短的read及平均read长度

perl -ne ‘BEGIN{$min=1e10;$max=0;}next if ($.%4);chomp;$read_count++;$cur_length=length($_);$total_length+=$cur_length;$min=$min>$cur_length?$cur_length:$min;$max=$max<$cur_length?$cur_length:$max;END{print qq{Totally $read_count reads\nTotally $total_length bases\nMAX length is $max bp\nMIN length is $min bp \nMean length is },$total_length/$read_count,qq{ bp\n}}‘ input.fq

 

# 用于fasta格式文件的read数、碱基数、最长的read、最短的read及平均read长度

perl -ne ‘BEGIN{$min=1e10;$max=0;}next if ($.%2);chomp;$read_count++;$cur_length=length($_);$total_length+=$cur_length;$min=$min>$cur_length?$cur_length:$min;$max=$max<$cur_length?$cur_length:$max;END{print qq{Totally $read_count reads\nTotally $total_length bases\nMAX length is $max bp\nMIN length is $min bp \nMean length is },$total_length/$read_count,qq{ bp\n}}‘ input.fa

 

以上是关于统计碱基数目GC含量read数最长的read最短的read及平均read长度的主要内容,如果未能解决你的问题,请参考以下文章

Perl学习19之生信简单运用

生信笔记2-fastqc的安装和使用

FASTQ 数据质量统计工具

一文读懂FastQC Report

GC depth: GC含量和测序深度

WES 平均测序深度