forked from raylim/scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnormal_filtering.pl
More file actions
executable file
·36 lines (30 loc) · 881 Bytes
/
normal_filtering.pl
File metadata and controls
executable file
·36 lines (30 loc) · 881 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/perl
$outdir=$ARGV[0];
my %snp=();
open(IN,"all_normal_SNPs.txt") || die "cannot open SNP file\n";
while(<IN>){
chomp;
my @fields = split(/\s+/,$_);
my $chrpos = $fields[0];
$snp{$chrpos} = $_;
}
@files=`ls $outdir/*_snvmix2_novel_codon_annot_artifact_filtered.txt`;
foreach $file (@files){
chomp($file);
($name,$rest)=split(/\./,$file);
$fileout=$name."_nfilter.txt";
open(OUT,">$fileout") || die "cannot open $outdir/$fileout file\n";
open(IN,"$file") || die "cannot open $file\n";
while(<IN>){
chomp;
($chrpos,$ensid,$strand,$refcodon,$posmut,$refbase,$mutbase,$readsupport,$refcodon1,$mutcodon,$refaa,$mutaa,$change,$charge,$polarity,$score,$gene,$relposition)=split(/\s+/,$_);
#print "$chrpos\n";
$a=$snp{$chrpos};
if(!(defined($a))) {
print OUT "$_\n";
}
else{
#print "$chrpos $file\n";
}
}
}