samtools mpileup原始结果文件处理,非bcf/vcf格式
来源:互联网 发布:ios icon制作软件 编辑:程序博客网 时间:2024/05/21 22:58
samtools mpileup处理的原始结果向来比较麻烦,写了一个小程序只生成碱基reads,但不进行任何过滤:
#!/usr/bin/env perl use strict;use warnings;use Getopt::Long;my %opt;GetOptions(\%opt, "i=s", "o=s", "sd=s", "ad=s", "aq=s");my $usage = <<"USAGE";Usage: perl $0 -i <pileup> [options]CreationTime: ModifyTime: Note: Options:-iinput fileeg: perl $0 -i file.pileup > resultUSAGEdie $usage if(!$opt{i});open IN, ($opt{i} =~ /\.gz$/) ? "gzip -dc $opt{i} |" : $opt{i} or die $!;my (@tmp, @qual, @base, %index);while(<IN>){chomp;@tmp = split /\t/;next if($tmp[2] eq "N");while($tmp[4] =~ /[\+-](\d+)[ATCGNatcgn]+/){$tmp[4] =~ s/[\+-]\d+[ATCGNatcgn]{$1}//;}$tmp[4] =~ s/\^\S//g; #\<\=\>\-\!\?\/\'\"\)\(\]\[\*\\\.\+,;:@&#%0-9A-Z$tmp[4] =~ s/[\^\$]//g;@base = split //, $tmp[4];my %hash = ('r'=>0, 'A'=>0, 'T'=>0, 'C'=>0, 'G'=>0);foreach my $b(@base){if($b =~ /[\.,]/){$hash{'r'} ++;next;}if($b=~ /[Aa]/){$hash{'A'} ++;next;}if($b =~ /[Tt]/){$hash{'T'} ++;next;}if($b =~ /[Cc]/){$hash{'C'} ++;next;}if($b =~ /[Gg]/){$hash{'G'} ++;next;}}my ($m, $fb, $fbn, $sb, $sbn);foreach my $i(sort {$hash{$b} <=> $hash{$a}} keys %hash){$m ++;if($m == 1 and $i eq "r"){$fb = $tmp[2];$fbn = $hash{$i};next;}elsif($m == 1){$fb = $i;$fbn = $hash{$i};next;}if($m == 2 and $i eq 'r'){$sb = $tmp[2];$sbn = $hash{$i};last;}elsif($m == 2){$sb = $i;$sbn = $hash{$i};last;}}print join "\t", @tmp[0..2], $fb, $fbn, $sb, $sbn, "\n";}close IN;sub showtime{my ($x) = @_;my $t = localtime;print STDERR "[$t] $x\n";}尤其是没有过滤质量值,所以得到的reads肯定是不准确的,另外一个过滤版本由于某些经验上的判定原因暂不发布。
0 0
- samtools mpileup原始结果文件处理,非bcf/vcf格式
- [samtools]mpileup命令简介
- 基因数据:使用Python处理vcf文件
- 解析VCARD文件(vcf格式)导入QQ通讯录功能
- VCF格式详解
- JAVA解析VCF格式
- VCF格式详解
- vcf通讯录格式解析
- VCF格式详解
- bwa mem比对结果错误,sam文件不能被samtools识别的原因之一
- vcf文件分解
- VCF文件解析
- vcf
- Android 导出.vcf格式通讯录方法
- VCF (Variant Call Format)格式详解
- 原始SQL查询结果
- c++文件库编辑vcf文件
- perl 生成 .vcf文件 以导入电话
- Cocos2d-x3.0模版容器之一:cocos2d::Vector<T>
- C++中一个简单的两个数求和
- 谈谈assert
- ZPL II (Zebra 标签机)简易指令集
- C++ 智能指针详解
- samtools mpileup原始结果文件处理,非bcf/vcf格式
- The Cat in the Hat
- .NET--ASP.NET的错误处理机制
- 插入多个模块时检查符号的方法
- With (CTE、递归CTE)
- Mac美化,GeekTool获取Yahoo天气图片
- 内网端口穿透应用之NAT123端口映射80端口映射
- Maven的pom.xml 标签理解
- 数据结构与算法分析学习笔记---第一章