Skip to content

Commit

Permalink
enhanced robustnesss
Browse files Browse the repository at this point in the history
  • Loading branch information
yjx1217 committed Jul 12, 2019
1 parent 75c0e58 commit 472f20c
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions vcf2model.pl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# script: vcf2model.pl
# author: Jia-Xing Yue (GitHub ID: yjx1217)
# version: 1.0.0
# last edited: 2019.04.08
# last edited: 2019.07.12
# description: vcf2model.pl will characterize mutational profile for SNPs and INDELs
# based on user-provided vcf file.
##############################################################
Expand Down Expand Up @@ -141,7 +141,11 @@
foreach my $alt_allele (@base) {
if ($ref_allele ne $alt_allele) {
if ($total_snp_count > 0) {
$snp{$ref_allele}{$alt_allele}{'freq'} = $snp{$ref_allele}{$alt_allele}{'count'}/$total_snp_count;
if (not exists $snp{$ref_allele}{$alt_allele}{'count'}) {
$snp{$ref_allele}{$alt_allele}{'freq'} = 0;
} else {
$snp{$ref_allele}{$alt_allele}{'freq'} = $snp{$ref_allele}{$alt_allele}{'count'}/$total_snp_count;
}
print $snp_model_output_fh "$ref_allele->$alt_allele\t$snp{$ref_allele}{$alt_allele}{'freq'}\n";
} else {
print "!!! Warning! total_snp_count = 0! Set the frequency of $ref_allele->$alt_allele substitution as NA!\n";
Expand Down

0 comments on commit 472f20c

Please sign in to comment.