annotate joint_snv_mix.pl @ 2:26953f1c8af2 draft default tip

Uploaded
author fcaramia
date Thu, 20 Jun 2013 00:53:38 -0400
parents a1034918ab9b
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a1034918ab9b Uploaded
fcaramia
parents:
diff changeset
1
a1034918ab9b Uploaded
fcaramia
parents:
diff changeset
2 use strict;
a1034918ab9b Uploaded
fcaramia
parents:
diff changeset
3 use warnings;
a1034918ab9b Uploaded
fcaramia
parents:
diff changeset
4 use File::Basename;
a1034918ab9b Uploaded
fcaramia
parents:
diff changeset
5 use Cwd;
a1034918ab9b Uploaded
fcaramia
parents:
diff changeset
6 use File::Path qw(make_path remove_tree);
a1034918ab9b Uploaded
fcaramia
parents:
diff changeset
7 die qq(
a1034918ab9b Uploaded
fcaramia
parents:
diff changeset
8 Bad numbr of inputs
a1034918ab9b Uploaded
fcaramia
parents:
diff changeset
9
a1034918ab9b Uploaded
fcaramia
parents:
diff changeset
10 ) if(!@ARGV);
a1034918ab9b Uploaded
fcaramia
parents:
diff changeset
11
a1034918ab9b Uploaded
fcaramia
parents:
diff changeset
12 my $bam_normal;
a1034918ab9b Uploaded
fcaramia
parents:
diff changeset
13 my $bam_tumor;
a1034918ab9b Uploaded
fcaramia
parents:
diff changeset
14 my $player_options = "";
a1034918ab9b Uploaded
fcaramia
parents:
diff changeset
15 my $output;
a1034918ab9b Uploaded
fcaramia
parents:
diff changeset
16 my $action;
a1034918ab9b Uploaded
fcaramia
parents:
diff changeset
17 my $ref_genome;
a1034918ab9b Uploaded
fcaramia
parents:
diff changeset
18
a1034918ab9b Uploaded
fcaramia
parents:
diff changeset
19 foreach my $input (@ARGV)
a1034918ab9b Uploaded
fcaramia
parents:
diff changeset
20 {
a1034918ab9b Uploaded
fcaramia
parents:
diff changeset
21 my @tmp = split "::", $input;
a1034918ab9b Uploaded
fcaramia
parents:
diff changeset
22 if($tmp[0] eq "BAMNORMAL")
a1034918ab9b Uploaded
fcaramia
parents:
diff changeset
23 {
a1034918ab9b Uploaded
fcaramia
parents:
diff changeset
24 $bam_normal = $tmp[1];
a1034918ab9b Uploaded
fcaramia
parents:
diff changeset
25 }
a1034918ab9b Uploaded
fcaramia
parents:
diff changeset
26 elsif($tmp[0] eq "BAMTUMOR")
a1034918ab9b Uploaded
fcaramia
parents:
diff changeset
27 {
a1034918ab9b Uploaded
fcaramia
parents:
diff changeset
28 $bam_tumor = $tmp[1];
a1034918ab9b Uploaded
fcaramia
parents:
diff changeset
29 }
a1034918ab9b Uploaded
fcaramia
parents:
diff changeset
30 elsif($tmp[0] eq "OPTION")
a1034918ab9b Uploaded
fcaramia
parents:
diff changeset
31 {
a1034918ab9b Uploaded
fcaramia
parents:
diff changeset
32 $player_options = "$player_options ${tmp[1]}";
a1034918ab9b Uploaded
fcaramia
parents:
diff changeset
33 }
a1034918ab9b Uploaded
fcaramia
parents:
diff changeset
34 elsif($tmp[0] eq "REFGENOME")
a1034918ab9b Uploaded
fcaramia
parents:
diff changeset
35 {
a1034918ab9b Uploaded
fcaramia
parents:
diff changeset
36 $ref_genome = $tmp[1];
a1034918ab9b Uploaded
fcaramia
parents:
diff changeset
37 }
a1034918ab9b Uploaded
fcaramia
parents:
diff changeset
38 elsif($tmp[0] eq "ACTION")
a1034918ab9b Uploaded
fcaramia
parents:
diff changeset
39 {
a1034918ab9b Uploaded
fcaramia
parents:
diff changeset
40 $action = $tmp[1];
a1034918ab9b Uploaded
fcaramia
parents:
diff changeset
41 }
a1034918ab9b Uploaded
fcaramia
parents:
diff changeset
42 elsif($tmp[0] eq "OUTPUT")
a1034918ab9b Uploaded
fcaramia
parents:
diff changeset
43 {
a1034918ab9b Uploaded
fcaramia
parents:
diff changeset
44 $output = $tmp[1];
a1034918ab9b Uploaded
fcaramia
parents:
diff changeset
45 }
a1034918ab9b Uploaded
fcaramia
parents:
diff changeset
46
a1034918ab9b Uploaded
fcaramia
parents:
diff changeset
47 else
a1034918ab9b Uploaded
fcaramia
parents:
diff changeset
48 {
a1034918ab9b Uploaded
fcaramia
parents:
diff changeset
49 die("Unknown Input: $input\n");
a1034918ab9b Uploaded
fcaramia
parents:
diff changeset
50 }
a1034918ab9b Uploaded
fcaramia
parents:
diff changeset
51 }
a1034918ab9b Uploaded
fcaramia
parents:
diff changeset
52
a1034918ab9b Uploaded
fcaramia
parents:
diff changeset
53
a1034918ab9b Uploaded
fcaramia
parents:
diff changeset
54 #Create Symbolic links and indexes
a1034918ab9b Uploaded
fcaramia
parents:
diff changeset
55
a1034918ab9b Uploaded
fcaramia
parents:
diff changeset
56 my $working_dir = cwd();
a1034918ab9b Uploaded
fcaramia
parents:
diff changeset
57
a1034918ab9b Uploaded
fcaramia
parents:
diff changeset
58 system ("ln -s $bam_normal $working_dir/normal.bam");
a1034918ab9b Uploaded
fcaramia
parents:
diff changeset
59 system ("samtools index $working_dir/normal.bam");
a1034918ab9b Uploaded
fcaramia
parents:
diff changeset
60
a1034918ab9b Uploaded
fcaramia
parents:
diff changeset
61 system ("ln -s $bam_tumor $working_dir/tumor.bam");
a1034918ab9b Uploaded
fcaramia
parents:
diff changeset
62 system ("samtools index $working_dir/tumor.bam");
a1034918ab9b Uploaded
fcaramia
parents:
diff changeset
63
a1034918ab9b Uploaded
fcaramia
parents:
diff changeset
64
a1034918ab9b Uploaded
fcaramia
parents:
diff changeset
65 #run jsm
a1034918ab9b Uploaded
fcaramia
parents:
diff changeset
66
a1034918ab9b Uploaded
fcaramia
parents:
diff changeset
67 if($action eq "classify")
a1034918ab9b Uploaded
fcaramia
parents:
diff changeset
68 {
a1034918ab9b Uploaded
fcaramia
parents:
diff changeset
69 system ("jsm.py $action $player_options $ref_genome $working_dir/normal.bam $working_dir/tumor.bam");
a1034918ab9b Uploaded
fcaramia
parents:
diff changeset
70 }
a1034918ab9b Uploaded
fcaramia
parents:
diff changeset
71 else
a1034918ab9b Uploaded
fcaramia
parents:
diff changeset
72 {
a1034918ab9b Uploaded
fcaramia
parents:
diff changeset
73 system ("jsm.py $action $player_options $ref_genome $working_dir/normal.bam $working_dir/tumor.bam $output");
a1034918ab9b Uploaded
fcaramia
parents:
diff changeset
74 }
a1034918ab9b Uploaded
fcaramia
parents:
diff changeset
75