modified: Makefile
[GalaxyCodeBases.git] / perl / etc / bs / fVarScan.pl
blob94d3890cb9a780a119a66f84b6f069b05dd92af8
1 #!/usr/bin/env perl
2 use strict;
3 use warnings;
4 use Data::Dump qw(ddx);
6 die "Usage: $0 <VarScan file> >out.txt\n" if @ARGV < 1;
7 #@ARGV;
8 my $IN = shift;
10 my @thePOS = qw(chrom position);
11 my @SELECTED = qw(ref normal_reads1 normal_reads2 normal_var_freq normal_gt tumor_reads1 tumor_reads2 tumor_var_freq tumor_gt somatic_status tumor_reads1_plus tumor_reads2_minus);
12 my @Print = qw(normal_reads1 normal_reads2 normal_var_freq normal_gt tumor_reads1 tumor_reads2 tumor_var_freq tumor_gt tumor_reads1_plus tumor_reads2_minus);
14 open I,'<',$IN or die "Error opening $IN: $!\n";
15 my ($id,$flag,@tmpstr) = (0,0);
16 my (%hash,@in);
17 chomp(my $t = <I>);
18 my @tt = split("\t",$t);
19 map { s/_read(\d)$/_reads$1/ } @tt;
20 while(<I>) {
21 chomp;
22 @hash{@tt} = split /\t/;
23 @in[0,1] = @hash{@thePOS};
24 $in[2] = [@hash{@SELECTED}];
25 next if $in[2]->[9] ne 'Somatic';
26 next if $in[2]->[4] ne $in[2]->[0];
27 next if $in[2]->[1]<15 or $in[2]->[2]!=0 or ($in[2]->[5]+$in[2]->[6])<20 or $in[2]->[6]<1;
28 my $t = $in[2]->[7];
29 $t =~ s/%$//;
30 next if $t < 20;
31 next if $in[2]->[10]<1 or $in[2]->[11]<0;
32 #ddx \@in;
33 print join("\t",@in[0,1],join(',',@hash{qw(ref var)}),join(',',@hash{@Print})),"\n";
35 close I;
37 __END__
38 1.normal组织没有一个和ref不一样的,并且深度大于20,并且正负链都有支持refread
39 2. cancer组织深度大于15,突变碱基的频率大于20%。并且正负链都有支持突变的read
41 normal_read1 >=15, normal_read2==0; tumor_read2>1; tumor_var_freq>20%; tumor_reads2_plus>=1; tumor_reads2_minus>=0;
42 tumor_read1+tumor_read2 >=20.