diff --git a/alignment/combine_idxstats.pl b/alignment/filter_viral_idxstats.pl
similarity index 93%
rename from alignment/combine_idxstats.pl
rename to alignment/filter_viral_idxstats.pl
index e4bc42ea8bdc0788358c2c324c7f3cc8de8fd261..99899178d78632c20663f824f745f05fdd2695e4 100644
--- a/alignment/combine_idxstats.pl
+++ b/alignment/filter_viral_idxstats.pl
@@ -8,11 +8,16 @@ use Getopt::Long;
 
 #my $cwd = getcwd();
 
+my $pair_id = "";
+GetOptions ('pairid|p=s' => \$pair_id);
+if($pair_id eq ""){$pair_id = "all";}
+
 my @allFiles = @ARGV;
 chomp(@allFiles);
+
 my %data;
 my @samples;
-open OUT, ">viral.info" or die $!;
+open OUT, ">$pair_id\.viral.seqstats.txt" or die $!;
 
 my %virus;
 $virus{'NC_001538.1'}="BK polyomavirus";
diff --git a/alignment/viralalign.sh b/alignment/virusalign.sh
similarity index 86%
rename from alignment/viralalign.sh
rename to alignment/virusalign.sh
index d3608a59c349e98f5c382d1a8a9430388116d933..1158137cc20b6f28bf3f1a0f2bc4fb66c2402845 100644
--- a/alignment/viralalign.sh
+++ b/alignment/virusalign.sh
@@ -9,12 +9,13 @@ usage(){
 }
 
 OPTIND=1 #Reset OPTIN
-while getopts :b:r:p:h opt
+while getopts :b:r:p:fh opt
 do
   case $opt in
     b) bam=$OPTARG;;
     r) ref=$OPTARG;;
     p) pairid=$OPTARG;;
+    f) filter=1;;
     h) usage;;
   esac
 done
@@ -35,6 +36,7 @@ fi
 reffa=${ref}/idt_virus_reference.fa
 source /etc/profile.d/modules.sh
 module load bwa/intel/0.7.17 picard/2.10.3 samtools/1.6 
+baseDir="`dirname \"$0\"`"
 
 samtools view -@ 8 -b -u -F 2 ${bam} |samtools sort -n - >unmapped.bam
 java -Djava.io.tmpdir=./ -Xmx4g -jar $PICARD/picard.jar SamToFastq I=unmapped.bam FASTQ=unmapped.R1.fastq SECOND_END_FASTQ=unmapped.R2.fastq UNPAIRED_FASTQ=unmapped.unpaired.fastq
@@ -45,4 +47,7 @@ samtools view -h -F 256 -b out.sam -o out.bam
 samtools sort out.bam -o ${pairid}.viral.bam
 samtools index ${pairid}.viral.bam
 samtools idxstats ${pairid}.viral.bam >${pairid}.viral.idxstats.txt
-samtools flagstat ${pairid}.viral.bam >${pairid}.viral.flagstat.txt
+if [[ $filter == 1 ]]
+then
+    perl $baseDir/filter_viral_idxstats.txt -p ${pairid} ${pairid}.viral.idxstats.txt
+fi
diff --git a/variants/msisensor.sh b/variants/msisensor.sh
index eba49f7a71e1e81e95ec55b73b6e4fb202ad0e51..db133b1b3ca5a0f9ca0cdf77d168f3c155665b7d 100755
--- a/variants/msisensor.sh
+++ b/variants/msisensor.sh
@@ -9,13 +9,14 @@ usage() {
   exit 1
 }
 OPTIND=1 # Reset OPTIND
-while getopts :r:l:n:b:p:h opt
+while getopts :r:l:n:c:b:p:h opt
 do
     case $opt in
         r) index_path=$OPTARG;;
         p) pair_id=$OPTARG;;
         b) sbam=$OPTARG;;
         n) normal=$OPTARG;;
+	c) capture=$OPTARG;;
         h) usage;;
     esac
 done
@@ -32,11 +33,17 @@ fi
 source /etc/profile.d/modules.sh	
 export PATH=/project/shared/bicf_workflow_ref/seqprg/bin:$PATH
 
+bedopt=''
+if [[ -n $capture ]]
+then
+    bedopt="-e $capture"
+fi
+   
 if [[ -n $normal ]]
 then
-    msisensor2 msi -d ${index_path}/microsatellites.list -n $normal -t $sbam -o ${pair_id}.msi
     
+    msisensor-pro msi -d ${index_path}/microsatellites.list -n $normal -t $sbam -o ${pair_id}.msi $bedopt
 else
     # -M ${index_path}/msi_tumoronly_model 
-    msisensor2 msi -d ${index_path}/microsatellites.list -t $sbam -o ${pair_id}.msi
+    msisensor2 msi -d ${index_path}/microsatellites.list -t $sbam -o ${pair_id}.msi $bedopt
 fi