annotate archer.pl @ 3:3af9b7634b2d draft default tip

Uploaded
author plus
date Thu, 29 May 2014 02:32:55 -0400
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1 #!/usr/bin/perl
3af9b7634b2d Uploaded
plus
parents:
diff changeset
2
3af9b7634b2d Uploaded
plus
parents:
diff changeset
3 use strict;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
4 use warnings;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
5
3af9b7634b2d Uploaded
plus
parents:
diff changeset
6 my($i, $j, $k);
3af9b7634b2d Uploaded
plus
parents:
diff changeset
7 my $parameters = {};
3af9b7634b2d Uploaded
plus
parents:
diff changeset
8
3af9b7634b2d Uploaded
plus
parents:
diff changeset
9 sub usage {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
10 print "\nUsage: $0 \n\n\t ";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
11 print "REQUIRED \n\t ";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
12 print "-config <config_file> \n\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
13 exit(1);
3af9b7634b2d Uploaded
plus
parents:
diff changeset
14 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
15 if(scalar(@ARGV) == 0){
3af9b7634b2d Uploaded
plus
parents:
diff changeset
16 usage();
3af9b7634b2d Uploaded
plus
parents:
diff changeset
17 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
18
3af9b7634b2d Uploaded
plus
parents:
diff changeset
19 # Parse the Command Line
3af9b7634b2d Uploaded
plus
parents:
diff changeset
20 &parse_command_line($parameters, @ARGV);
3af9b7634b2d Uploaded
plus
parents:
diff changeset
21
3af9b7634b2d Uploaded
plus
parents:
diff changeset
22 # Log File
3af9b7634b2d Uploaded
plus
parents:
diff changeset
23 my $log_file = $parameters->{config_file} . ".log";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
24 unless ( open(LOG_FILE, ">$log_file") ) {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
25 print "Cannot open file \"$log_file\" to write to!!\n\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
26 exit;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
27 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
28 print LOG_FILE "config = $parameters->{config_file}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
29
3af9b7634b2d Uploaded
plus
parents:
diff changeset
30 # Time Stamp
3af9b7634b2d Uploaded
plus
parents:
diff changeset
31 my $timestamp = localtime(time);
3af9b7634b2d Uploaded
plus
parents:
diff changeset
32 print LOG_FILE $timestamp, "\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
33
3af9b7634b2d Uploaded
plus
parents:
diff changeset
34 # Parse Config File
3af9b7634b2d Uploaded
plus
parents:
diff changeset
35 my @samples = ();
3af9b7634b2d Uploaded
plus
parents:
diff changeset
36 my $number_of_samples = &parse_config_file(\@samples, \$parameters);
3af9b7634b2d Uploaded
plus
parents:
diff changeset
37 print LOG_FILE "directory = $parameters->{directory}\n\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
38
3af9b7634b2d Uploaded
plus
parents:
diff changeset
39 my $files = {};
3af9b7634b2d Uploaded
plus
parents:
diff changeset
40 # Create Target Regions File
3af9b7634b2d Uploaded
plus
parents:
diff changeset
41 $files->{target_regions_file} = $parameters->{directory} . "/target_regions.dat";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
42 &create_target_regions_file(\$parameters, \$files, \*LOG_FILE);
3af9b7634b2d Uploaded
plus
parents:
diff changeset
43
3af9b7634b2d Uploaded
plus
parents:
diff changeset
44 my @tags = ();
3af9b7634b2d Uploaded
plus
parents:
diff changeset
45 my($reads, $tag);
3af9b7634b2d Uploaded
plus
parents:
diff changeset
46 my($fastq_file_1, $fastq_file_2);
3af9b7634b2d Uploaded
plus
parents:
diff changeset
47 my %proceed = ();
3af9b7634b2d Uploaded
plus
parents:
diff changeset
48 my $alignment_string = '';
3af9b7634b2d Uploaded
plus
parents:
diff changeset
49 my $number_of_alignment_files = 0;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
50 my $cmd = '';
3af9b7634b2d Uploaded
plus
parents:
diff changeset
51
3af9b7634b2d Uploaded
plus
parents:
diff changeset
52 for($i = 0; $i < $number_of_samples; $i++){
3af9b7634b2d Uploaded
plus
parents:
diff changeset
53
3af9b7634b2d Uploaded
plus
parents:
diff changeset
54 # Define Tags
3af9b7634b2d Uploaded
plus
parents:
diff changeset
55 &define_tags(\@samples, \@tags, \$reads, \$tag, \$fastq_file_1, \$fastq_file_2, \$parameters, \*LOG_FILE);
3af9b7634b2d Uploaded
plus
parents:
diff changeset
56
3af9b7634b2d Uploaded
plus
parents:
diff changeset
57 # Check if FASTQ Files Exist and are Non-empty
3af9b7634b2d Uploaded
plus
parents:
diff changeset
58 $proceed{$i} = &decide_to_proceed(\$reads, \$fastq_file_1, \$fastq_file_2);
3af9b7634b2d Uploaded
plus
parents:
diff changeset
59
3af9b7634b2d Uploaded
plus
parents:
diff changeset
60 # Create String of FASTQ Files to be Aligned by bwa_enz
3af9b7634b2d Uploaded
plus
parents:
diff changeset
61 &create_alignment_string($proceed{$i}, \$reads, \$number_of_alignment_files, \$alignment_string, \$fastq_file_1, \$fastq_file_2);
3af9b7634b2d Uploaded
plus
parents:
diff changeset
62 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
63
3af9b7634b2d Uploaded
plus
parents:
diff changeset
64 # Align the reads with bwa_enz
3af9b7634b2d Uploaded
plus
parents:
diff changeset
65 # Would be better to align paired reads together??
3af9b7634b2d Uploaded
plus
parents:
diff changeset
66 $cmd = &align_reads(\$parameters, $number_of_alignment_files, $alignment_string);
3af9b7634b2d Uploaded
plus
parents:
diff changeset
67 print LOG_FILE $cmd;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
68 system($cmd);
3af9b7634b2d Uploaded
plus
parents:
diff changeset
69
3af9b7634b2d Uploaded
plus
parents:
diff changeset
70 for($i = 0; $i < $number_of_samples; $i++){
3af9b7634b2d Uploaded
plus
parents:
diff changeset
71
3af9b7634b2d Uploaded
plus
parents:
diff changeset
72 # Define Tags
3af9b7634b2d Uploaded
plus
parents:
diff changeset
73 &define_tags(\@samples, \@tags, \$reads, \$tag, \$fastq_file_1, \$fastq_file_2, \$parameters, \*LOG_FILE);
3af9b7634b2d Uploaded
plus
parents:
diff changeset
74
3af9b7634b2d Uploaded
plus
parents:
diff changeset
75 # Define Summary File Names
3af9b7634b2d Uploaded
plus
parents:
diff changeset
76 &define_summary_file_names(\$tag, \$parameters, \$files);
3af9b7634b2d Uploaded
plus
parents:
diff changeset
77
3af9b7634b2d Uploaded
plus
parents:
diff changeset
78 if ( $proceed{$i} == 1 ){
3af9b7634b2d Uploaded
plus
parents:
diff changeset
79
3af9b7634b2d Uploaded
plus
parents:
diff changeset
80 # Convert SAM -> BAM -> BED
3af9b7634b2d Uploaded
plus
parents:
diff changeset
81 &define_alignments_file_names(\$reads, \@tags, \$tag, \$parameters, \$files);
3af9b7634b2d Uploaded
plus
parents:
diff changeset
82 $cmd = &rename_sam_files(\$reads, \$files);
3af9b7634b2d Uploaded
plus
parents:
diff changeset
83 $cmd .= &alignments(\$reads, \$fastq_file_1, \$fastq_file_2, \$parameters, \$files);
3af9b7634b2d Uploaded
plus
parents:
diff changeset
84 print LOG_FILE $cmd;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
85 system($cmd);
3af9b7634b2d Uploaded
plus
parents:
diff changeset
86
3af9b7634b2d Uploaded
plus
parents:
diff changeset
87 # De-duplicate the SAM File(s)
3af9b7634b2d Uploaded
plus
parents:
diff changeset
88 &define_de_duplication_file_names(\$reads, \@tags, \$tag, \$parameters, \$files);
3af9b7634b2d Uploaded
plus
parents:
diff changeset
89 $cmd = &de_duplication(\$reads, \$fastq_file_1, \$fastq_file_2, \$parameters, \$files);
3af9b7634b2d Uploaded
plus
parents:
diff changeset
90 print LOG_FILE $cmd;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
91 system($cmd);
3af9b7634b2d Uploaded
plus
parents:
diff changeset
92 # What if only reverse read exists? Don't want to de-duplicate?
3af9b7634b2d Uploaded
plus
parents:
diff changeset
93
3af9b7634b2d Uploaded
plus
parents:
diff changeset
94 # Select On-/Off-Target Reads
3af9b7634b2d Uploaded
plus
parents:
diff changeset
95 # Split marked files into two files
3af9b7634b2d Uploaded
plus
parents:
diff changeset
96 &define_on_and_off_target_file_names(\$reads, \@tags, \$tag, \$parameters, \$files);
3af9b7634b2d Uploaded
plus
parents:
diff changeset
97 $cmd = &select_on_and_off_target_reads(\$reads, \$parameters, \$files);
3af9b7634b2d Uploaded
plus
parents:
diff changeset
98 print LOG_FILE $cmd;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
99 system($cmd);
3af9b7634b2d Uploaded
plus
parents:
diff changeset
100
3af9b7634b2d Uploaded
plus
parents:
diff changeset
101 # Coverage and Start Sites
3af9b7634b2d Uploaded
plus
parents:
diff changeset
102 &define_coverage_and_start_site_file_names(\$reads, \@tags, \$parameters, \$files);
3af9b7634b2d Uploaded
plus
parents:
diff changeset
103 $cmd = &generate_coverage_and_start_sites(\$reads, \$parameters, \$files);
3af9b7634b2d Uploaded
plus
parents:
diff changeset
104 print LOG_FILE $cmd;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
105 system($cmd);
3af9b7634b2d Uploaded
plus
parents:
diff changeset
106
3af9b7634b2d Uploaded
plus
parents:
diff changeset
107 # Proceed through the rest of the pipeline using the on-target reads
3af9b7634b2d Uploaded
plus
parents:
diff changeset
108
3af9b7634b2d Uploaded
plus
parents:
diff changeset
109 # Create Master Files - one line per read
3af9b7634b2d Uploaded
plus
parents:
diff changeset
110 &define_master_files_file_names(\$reads, \@tags, \$parameters, \$files);
3af9b7634b2d Uploaded
plus
parents:
diff changeset
111 $cmd = &generate_master_files(\$reads, \$parameters, \$files);
3af9b7634b2d Uploaded
plus
parents:
diff changeset
112 print LOG_FILE $cmd;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
113 system($cmd);
3af9b7634b2d Uploaded
plus
parents:
diff changeset
114
3af9b7634b2d Uploaded
plus
parents:
diff changeset
115 # Select Fusion Reads - do not count mapping to a 'novel', i.e., not in refseq, region as a fusion
3af9b7634b2d Uploaded
plus
parents:
diff changeset
116 &define_fusion_reads_file_names(\$reads, \@tags, \$tag, \$parameters, \$files);
3af9b7634b2d Uploaded
plus
parents:
diff changeset
117 $cmd = &select_fusion_reads(\$reads, \$parameters, \$files);
3af9b7634b2d Uploaded
plus
parents:
diff changeset
118 print LOG_FILE $cmd;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
119 system($cmd);
3af9b7634b2d Uploaded
plus
parents:
diff changeset
120
3af9b7634b2d Uploaded
plus
parents:
diff changeset
121 # Count Fusions
3af9b7634b2d Uploaded
plus
parents:
diff changeset
122 &define_count_fusions_file_names(\$tag, \$parameters, \$files);
3af9b7634b2d Uploaded
plus
parents:
diff changeset
123 $cmd = &count_fusions(\$reads, \$parameters, \$files);
3af9b7634b2d Uploaded
plus
parents:
diff changeset
124 print LOG_FILE $cmd;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
125 system($cmd);
3af9b7634b2d Uploaded
plus
parents:
diff changeset
126
3af9b7634b2d Uploaded
plus
parents:
diff changeset
127 # Flanking Sequences
3af9b7634b2d Uploaded
plus
parents:
diff changeset
128 &define_flanking_sequences_file_names(\$tag, \$parameters, \$files);
3af9b7634b2d Uploaded
plus
parents:
diff changeset
129 $cmd = &flanking_sequences(\$reads, \$fastq_file_1, \$fastq_file_2, \$parameters, \$files);
3af9b7634b2d Uploaded
plus
parents:
diff changeset
130 print LOG_FILE $cmd;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
131 system($cmd);
3af9b7634b2d Uploaded
plus
parents:
diff changeset
132
3af9b7634b2d Uploaded
plus
parents:
diff changeset
133 # BAM Dedup Files
3af9b7634b2d Uploaded
plus
parents:
diff changeset
134 &define_bam_dedup_files_file_names(\$reads, \@tags, \$parameters, \$files);
3af9b7634b2d Uploaded
plus
parents:
diff changeset
135 $cmd = &bam_dedup_files(\$reads, \$files);
3af9b7634b2d Uploaded
plus
parents:
diff changeset
136 print LOG_FILE $cmd;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
137 system($cmd);
3af9b7634b2d Uploaded
plus
parents:
diff changeset
138
3af9b7634b2d Uploaded
plus
parents:
diff changeset
139 # Consensus Sequences - Fusion and Splice
3af9b7634b2d Uploaded
plus
parents:
diff changeset
140 #&define_consensus_sequences_file_names(\$tag, \$parameters, \$files);
3af9b7634b2d Uploaded
plus
parents:
diff changeset
141 #$cmd = &consensus_sequences(\$reads, \$fastq_file_1, \$fastq_file_2, \$tag, \$parameters, \$files);
3af9b7634b2d Uploaded
plus
parents:
diff changeset
142 #print LOG_FILE $cmd;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
143 #system($cmd);
3af9b7634b2d Uploaded
plus
parents:
diff changeset
144
3af9b7634b2d Uploaded
plus
parents:
diff changeset
145 # Sort SAM Files
3af9b7634b2d Uploaded
plus
parents:
diff changeset
146 &define_sort_sam_files_file_names(\$reads, \@tags, \$parameters, \$files);
3af9b7634b2d Uploaded
plus
parents:
diff changeset
147 $cmd = &sort_sam_files(\$reads, \$files);
3af9b7634b2d Uploaded
plus
parents:
diff changeset
148 print LOG_FILE $cmd;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
149 system($cmd);
3af9b7634b2d Uploaded
plus
parents:
diff changeset
150
3af9b7634b2d Uploaded
plus
parents:
diff changeset
151 # On-target Stats
3af9b7634b2d Uploaded
plus
parents:
diff changeset
152 &define_on_target_stats_file_names(\$tag, \$parameters, \$files);
3af9b7634b2d Uploaded
plus
parents:
diff changeset
153 $cmd = &on_target_stats(\$reads, \$parameters, \$files);
3af9b7634b2d Uploaded
plus
parents:
diff changeset
154 print LOG_FILE $cmd;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
155 system($cmd);
3af9b7634b2d Uploaded
plus
parents:
diff changeset
156
3af9b7634b2d Uploaded
plus
parents:
diff changeset
157 # Total Molecule Counts
3af9b7634b2d Uploaded
plus
parents:
diff changeset
158 &define_total_molecule_counts_file_names(\$reads, \@tags, \$tag, \$parameters, \$files);
3af9b7634b2d Uploaded
plus
parents:
diff changeset
159 $cmd = &total_molecule_counts(\$reads, \$parameters, \$files);
3af9b7634b2d Uploaded
plus
parents:
diff changeset
160 print LOG_FILE $cmd;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
161 system($cmd);
3af9b7634b2d Uploaded
plus
parents:
diff changeset
162
3af9b7634b2d Uploaded
plus
parents:
diff changeset
163 # De-duplicated Molecule Counts
3af9b7634b2d Uploaded
plus
parents:
diff changeset
164 &define_de_deduplicated_molecule_counts_file_names(\$reads, \@tags, \$tag, \$parameters, \$files);
3af9b7634b2d Uploaded
plus
parents:
diff changeset
165 $cmd = &de_duplicated_molecule_counts(\$reads, \$parameters, \$files);
3af9b7634b2d Uploaded
plus
parents:
diff changeset
166 print LOG_FILE $cmd;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
167 system($cmd);
3af9b7634b2d Uploaded
plus
parents:
diff changeset
168
3af9b7634b2d Uploaded
plus
parents:
diff changeset
169 # All Molecule Counts
3af9b7634b2d Uploaded
plus
parents:
diff changeset
170 &define_all_molecule_counts_file_names(\$tag, \$parameters, \$files);
3af9b7634b2d Uploaded
plus
parents:
diff changeset
171 $cmd = &all_molecule_counts(\$parameters, \$files);
3af9b7634b2d Uploaded
plus
parents:
diff changeset
172 print LOG_FILE $cmd;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
173 system($cmd);
3af9b7634b2d Uploaded
plus
parents:
diff changeset
174
3af9b7634b2d Uploaded
plus
parents:
diff changeset
175 # QC Check
3af9b7634b2d Uploaded
plus
parents:
diff changeset
176 &define_qc_check_file_names(\$tag, \$parameters, \$files);
3af9b7634b2d Uploaded
plus
parents:
diff changeset
177 $cmd = &qc_check(\$parameters, \$files);
3af9b7634b2d Uploaded
plus
parents:
diff changeset
178 print LOG_FILE $cmd;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
179 system($cmd);
3af9b7634b2d Uploaded
plus
parents:
diff changeset
180
3af9b7634b2d Uploaded
plus
parents:
diff changeset
181 # Coverage Uniformity
3af9b7634b2d Uploaded
plus
parents:
diff changeset
182 &define_coverage_uniformity_file_names(\$tag, \$parameters, \$files);
3af9b7634b2d Uploaded
plus
parents:
diff changeset
183 $cmd = &coverage_uniformity(\$reads, \$parameters, \$files);
3af9b7634b2d Uploaded
plus
parents:
diff changeset
184 print LOG_FILE $cmd;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
185 system($cmd);
3af9b7634b2d Uploaded
plus
parents:
diff changeset
186
3af9b7634b2d Uploaded
plus
parents:
diff changeset
187 # Summary
3af9b7634b2d Uploaded
plus
parents:
diff changeset
188 $cmd = &summary(\$tag, \$parameters, \$files);
3af9b7634b2d Uploaded
plus
parents:
diff changeset
189 print LOG_FILE $cmd;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
190 system($cmd);
3af9b7634b2d Uploaded
plus
parents:
diff changeset
191
3af9b7634b2d Uploaded
plus
parents:
diff changeset
192 # Clean Up
3af9b7634b2d Uploaded
plus
parents:
diff changeset
193 $cmd = &clean_up(\$reads, \$parameters, \$files);
3af9b7634b2d Uploaded
plus
parents:
diff changeset
194 print LOG_FILE $cmd;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
195 system($cmd);
3af9b7634b2d Uploaded
plus
parents:
diff changeset
196 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
197 else{
3af9b7634b2d Uploaded
plus
parents:
diff changeset
198 # Summary for Unprocessed Sample
3af9b7634b2d Uploaded
plus
parents:
diff changeset
199 $cmd = &summary_for_unprocessed_sample(\$reads, \$fastq_file_1, \$fastq_file_2, \$parameters, \$files);
3af9b7634b2d Uploaded
plus
parents:
diff changeset
200 print LOG_FILE $cmd;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
201 system($cmd);
3af9b7634b2d Uploaded
plus
parents:
diff changeset
202 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
203
3af9b7634b2d Uploaded
plus
parents:
diff changeset
204 # Time Stamp
3af9b7634b2d Uploaded
plus
parents:
diff changeset
205 $timestamp = localtime(time);
3af9b7634b2d Uploaded
plus
parents:
diff changeset
206 print LOG_FILE $timestamp, "\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
207 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
208
3af9b7634b2d Uploaded
plus
parents:
diff changeset
209 # Join Multiple Samples
3af9b7634b2d Uploaded
plus
parents:
diff changeset
210 #$cmd = &join_multiple_samples(\$parameters);
3af9b7634b2d Uploaded
plus
parents:
diff changeset
211 #print LOG_FILE $cmd;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
212 #system($cmd);
3af9b7634b2d Uploaded
plus
parents:
diff changeset
213
3af9b7634b2d Uploaded
plus
parents:
diff changeset
214 close(LOG_FILE);
3af9b7634b2d Uploaded
plus
parents:
diff changeset
215
3af9b7634b2d Uploaded
plus
parents:
diff changeset
216 exit;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
217
3af9b7634b2d Uploaded
plus
parents:
diff changeset
218 sub parse_command_line {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
219 my($parameters, @ARGV) = @_;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
220 my $next_arg;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
221 while(scalar @ARGV > 0){
3af9b7634b2d Uploaded
plus
parents:
diff changeset
222 $next_arg = shift(@ARGV);
3af9b7634b2d Uploaded
plus
parents:
diff changeset
223 if($next_arg eq "-config"){ $parameters->{config_file} = shift (@ARGV); }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
224 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
225 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
226
3af9b7634b2d Uploaded
plus
parents:
diff changeset
227
3af9b7634b2d Uploaded
plus
parents:
diff changeset
228 sub parse_config_file {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
229 my $samples_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
230 my $parameters_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
231 my @values = ();
3af9b7634b2d Uploaded
plus
parents:
diff changeset
232 my $count = 0;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
233 open( FILE, "< $$parameters_ref->{config_file}" ) or die "Can't open $$parameters_ref->{config_file} : $!";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
234 while( <FILE> ) {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
235 chomp;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
236 if ( length($_) > 1 and $_ !~ /^\#/ ){
3af9b7634b2d Uploaded
plus
parents:
diff changeset
237 @values = ();
3af9b7634b2d Uploaded
plus
parents:
diff changeset
238 @values = split(/=/, $_);
3af9b7634b2d Uploaded
plus
parents:
diff changeset
239 if($values[0] eq 'sample'){
3af9b7634b2d Uploaded
plus
parents:
diff changeset
240 @$samples_ref[$count] = $values[1];
3af9b7634b2d Uploaded
plus
parents:
diff changeset
241 $count++;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
242 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
243 else{
3af9b7634b2d Uploaded
plus
parents:
diff changeset
244 $$parameters_ref->{$values[0]} = $values[1];
3af9b7634b2d Uploaded
plus
parents:
diff changeset
245 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
246 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
247 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
248 my $num_samples = scalar @$samples_ref;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
249 print "number of samples = $num_samples\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
250 return $num_samples;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
251 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
252
3af9b7634b2d Uploaded
plus
parents:
diff changeset
253
3af9b7634b2d Uploaded
plus
parents:
diff changeset
254 sub create_target_regions_file {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
255 my $parameters_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
256 my $files_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
257 my $file_handle_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
258 my $cmd = '';
3af9b7634b2d Uploaded
plus
parents:
diff changeset
259
3af9b7634b2d Uploaded
plus
parents:
diff changeset
260 if ( ($$parameters_ref->{control_regions_file} ne 'NULL') && ($$parameters_ref->{target_regions_file} ne 'NULL') ) {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
261 $cmd = "cat $$parameters_ref->{control_regions_file} $$parameters_ref->{target_regions_file} > $$files_ref->{target_regions_file}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
262 print $file_handle_ref $cmd;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
263 system($cmd);
3af9b7634b2d Uploaded
plus
parents:
diff changeset
264 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
265 elsif ( $$parameters_ref->{target_regions_file} ne 'NULL' ) {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
266 $$files_ref->{target_regions_file} = $$parameters_ref->{target_regions_file};
3af9b7634b2d Uploaded
plus
parents:
diff changeset
267 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
268 elsif ( $$parameters_ref->{control_regions_file} ne 'NULL' ) {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
269 $$files_ref->{target_regions_file} = $$parameters_ref->{control_regions_file};
3af9b7634b2d Uploaded
plus
parents:
diff changeset
270 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
271 else { # Create Target Regions File
3af9b7634b2d Uploaded
plus
parents:
diff changeset
272 my $label;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
273 my $target_file = $$parameters_ref->{directory} . "/target_file.dat";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
274 my $control_file = $$parameters_ref->{directory} . "/control_file.dat";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
275 my $target_temp_outputfile_1 = $$parameters_ref->{directory} . "/target_temp_1.dat";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
276 my $target_temp_outputfile_2 = $$parameters_ref->{directory} . "/target_temp_2.dat";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
277 my $control_temp_outputfile_1 = $$parameters_ref->{directory} . "/control_temp_1.dat";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
278 my $control_temp_outputfile_2 = $$parameters_ref->{directory} . "/control_temp_2.dat";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
279 my $path_to_annotation_script = $$parameters_ref->{path} . "/archer/annotation/";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
280 # Target Primers Fasta File
3af9b7634b2d Uploaded
plus
parents:
diff changeset
281 if ( -e $$parameters_ref->{target_primers} ) {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
282 if ( -s $$parameters_ref->{target_primers} ) {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
283 $label = 'fusion';
3af9b7634b2d Uploaded
plus
parents:
diff changeset
284 $cmd = "$$parameters_ref->{path}/create_target_regions_file.pl -target $$parameters_ref->{target_primers} -label $label -refseq $$parameters_ref->{refseq_file} -gtf_file $$parameters_ref->{gtf_file} -path $path_to_annotation_script -t1 $target_temp_outputfile_1 -t2 $target_temp_outputfile_2 -o $target_file\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
285 print $file_handle_ref $cmd;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
286 system($cmd);
3af9b7634b2d Uploaded
plus
parents:
diff changeset
287 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
288 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
289 # Control Primers Fasta File
3af9b7634b2d Uploaded
plus
parents:
diff changeset
290 if ( -e $$parameters_ref->{control_primers} ) {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
291 if ( -s $$parameters_ref->{control_primers} ) {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
292 $label = 'housekeeping';
3af9b7634b2d Uploaded
plus
parents:
diff changeset
293 $cmd = "$$parameters_ref->{path}/create_target_regions_file.pl -target $$parameters_ref->{control_primers} -label $label -refseq $$parameters_ref->{refseq_file} -gtf_file $$parameters_ref->{gtf_file} -path $path_to_annotation_script -t1 $control_temp_outputfile_1 -t2 $control_temp_outputfile_2 -o $control_file\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
294 print $file_handle_ref $cmd;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
295 system($cmd);
3af9b7634b2d Uploaded
plus
parents:
diff changeset
296 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
297 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
298 if ( -e $control_file ) {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
299 if ( -s $control_file ) {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
300 $cmd = "cp $control_file $$files_ref->{target_regions_file}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
301 if ( -e $target_file ) {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
302 if ( -s $target_file ) {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
303 $cmd .= "cat $target_file >> $$files_ref->{target_regions_file}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
304 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
305 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
306 print $file_handle_ref $cmd;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
307 system($cmd);
3af9b7634b2d Uploaded
plus
parents:
diff changeset
308 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
309 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
310 elsif ( -e $target_file ) {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
311 if ( -s $target_file ) {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
312 $cmd = "cp $target_file $$files_ref->{target_regions_file}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
313 print $file_handle_ref $cmd;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
314 system($cmd);
3af9b7634b2d Uploaded
plus
parents:
diff changeset
315 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
316 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
317 $cmd = '';
3af9b7634b2d Uploaded
plus
parents:
diff changeset
318 if ( -e $target_file ) {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
319 $cmd .= "rm $target_temp_outputfile_1\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
320 $cmd .= "rm $target_temp_outputfile_2\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
321 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
322 if ( -e $control_file ) {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
323 $cmd .= "rm $control_temp_outputfile_1\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
324 $cmd .= "rm $control_temp_outputfile_2\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
325 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
326 print $file_handle_ref $cmd;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
327 system($cmd);
3af9b7634b2d Uploaded
plus
parents:
diff changeset
328
3af9b7634b2d Uploaded
plus
parents:
diff changeset
329 $cmd = '';
3af9b7634b2d Uploaded
plus
parents:
diff changeset
330 if ( -e $target_file ) {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
331 $cmd .= "rm $target_file\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
332 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
333 if ( -e $control_file ) {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
334 $cmd .= "rm $control_file\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
335 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
336 print $file_handle_ref $cmd;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
337 system($cmd);
3af9b7634b2d Uploaded
plus
parents:
diff changeset
338
3af9b7634b2d Uploaded
plus
parents:
diff changeset
339 print $file_handle_ref "\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
340 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
341 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
342
3af9b7634b2d Uploaded
plus
parents:
diff changeset
343
3af9b7634b2d Uploaded
plus
parents:
diff changeset
344 sub define_tags {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
345 my $samples_array_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
346 my $tags_array_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
347 my $reads_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
348 my $tag_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
349 my $fastq_file_1_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
350 my $fastq_file_2_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
351 my $parameters_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
352 my $file_handle_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
353
3af9b7634b2d Uploaded
plus
parents:
diff changeset
354 @$tags_array_ref = ();
3af9b7634b2d Uploaded
plus
parents:
diff changeset
355 @$tags_array_ref = split(/\s+/, @$samples_array_ref[$i]); # Split samples on whitespace
3af9b7634b2d Uploaded
plus
parents:
diff changeset
356
3af9b7634b2d Uploaded
plus
parents:
diff changeset
357 if( (scalar @$tags_array_ref) == 1 ){
3af9b7634b2d Uploaded
plus
parents:
diff changeset
358 $$reads_ref = 'single';
3af9b7634b2d Uploaded
plus
parents:
diff changeset
359 $$tag_ref = $tags[0];
3af9b7634b2d Uploaded
plus
parents:
diff changeset
360 $$fastq_file_1_ref = $$parameters_ref->{directory} . "/" . @$tags_array_ref[0] . ".fastq";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
361 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
362 else{
3af9b7634b2d Uploaded
plus
parents:
diff changeset
363 $$reads_ref = 'paired';
3af9b7634b2d Uploaded
plus
parents:
diff changeset
364 $$tag_ref = @$tags_array_ref[0] . "_" . @$tags_array_ref[1];
3af9b7634b2d Uploaded
plus
parents:
diff changeset
365 $$fastq_file_1_ref = $$parameters_ref->{directory} . "/" . @$tags_array_ref[0] . ".fastq";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
366 $$fastq_file_2_ref = $$parameters_ref->{directory} . "/" . @$tags_array_ref[1] . ".fastq";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
367 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
368
3af9b7634b2d Uploaded
plus
parents:
diff changeset
369 print $$tag_ref, "\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
370
3af9b7634b2d Uploaded
plus
parents:
diff changeset
371 print $file_handle_ref $$tag_ref, "\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
372 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
373
3af9b7634b2d Uploaded
plus
parents:
diff changeset
374
3af9b7634b2d Uploaded
plus
parents:
diff changeset
375 sub decide_to_proceed {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
376 my $reads_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
377 my $fastq_file_1_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
378 my $fastq_file_2_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
379 my $proceed = 0;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
380
3af9b7634b2d Uploaded
plus
parents:
diff changeset
381 if ( $$reads_ref eq 'single' ) {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
382 if ( -e $$fastq_file_1_ref ) {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
383 if ( -s $$fastq_file_1_ref ) {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
384 $proceed = 1;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
385 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
386 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
387 else{
3af9b7634b2d Uploaded
plus
parents:
diff changeset
388 $$fastq_file_1_ref .= ".gz"; # See if fastq_file_1 exists in gzipped form
3af9b7634b2d Uploaded
plus
parents:
diff changeset
389 if ( -e $$fastq_file_1_ref ) {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
390 if ( -s $$fastq_file_1_ref ) {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
391 $proceed = 1;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
392 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
393 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
394 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
395 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
396 if ( $$reads_ref eq 'paired' ) {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
397 if ( -e $$fastq_file_1_ref ) {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
398 if ( -s $$fastq_file_1_ref ) {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
399 if ( -e $$fastq_file_2_ref ) {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
400 if ( -s $$fastq_file_2_ref ) {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
401 $proceed = 1;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
402 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
403 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
404 else{
3af9b7634b2d Uploaded
plus
parents:
diff changeset
405 $$fastq_file_2_ref .= ".gz"; # See if fastq_file_2 exists in gzipped form
3af9b7634b2d Uploaded
plus
parents:
diff changeset
406 if ( -e $$fastq_file_2_ref ) {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
407 if ( -s $$fastq_file_2_ref ) {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
408 $proceed = 1;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
409 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
410 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
411 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
412 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
413 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
414 else{
3af9b7634b2d Uploaded
plus
parents:
diff changeset
415 $$fastq_file_1_ref .= ".gz"; # See if fastq_file_1 exists in gzipped form
3af9b7634b2d Uploaded
plus
parents:
diff changeset
416 if ( -e $$fastq_file_1_ref ) {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
417 if ( -s $$fastq_file_1_ref ) {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
418 if ( -e $$fastq_file_2_ref ) {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
419 if ( -s $$fastq_file_2_ref ) {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
420 $proceed = 1;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
421 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
422 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
423 else{
3af9b7634b2d Uploaded
plus
parents:
diff changeset
424 $$fastq_file_2_ref .= ".gz"; # See if fastq_file_2 exists in gzipped form
3af9b7634b2d Uploaded
plus
parents:
diff changeset
425 if ( -e $$fastq_file_2_ref ) {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
426 if ( -s $$fastq_file_2_ref ) {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
427 $proceed = 1;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
428 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
429 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
430 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
431 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
432 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
433 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
434 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
435 return $proceed;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
436 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
437
3af9b7634b2d Uploaded
plus
parents:
diff changeset
438
3af9b7634b2d Uploaded
plus
parents:
diff changeset
439 sub create_alignment_string {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
440 my $proceed_value = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
441 my $reads_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
442 my $number_of_alignment_files_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
443 my $alignment_string_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
444 my $fastq_file_1_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
445 my $fastq_file_2_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
446
3af9b7634b2d Uploaded
plus
parents:
diff changeset
447 if ( $proceed_value == 1 ) {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
448 if ( $$number_of_alignment_files_ref == 0 ){
3af9b7634b2d Uploaded
plus
parents:
diff changeset
449 $$alignment_string_ref = $$fastq_file_1_ref;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
450 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
451 else {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
452 $$alignment_string_ref .= " " . $$fastq_file_1_ref;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
453 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
454 $$number_of_alignment_files_ref++;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
455 if ( $$reads_ref eq 'paired' ) {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
456 $$alignment_string_ref .= " " . $$fastq_file_2_ref;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
457 $$number_of_alignment_files_ref++;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
458 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
459 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
460 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
461
3af9b7634b2d Uploaded
plus
parents:
diff changeset
462
3af9b7634b2d Uploaded
plus
parents:
diff changeset
463 sub align_reads {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
464 my $parameters_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
465 my $number_of_alignment_files_value = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
466 my $alignment_string_value = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
467 my $cmd_line = "echo Align Reads\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
468 if ( $number_of_alignment_files_value > 0 ) {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
469 $cmd_line .= "bwa_enz mem -Q 0 -m -D $$parameters_ref->{directory} $$parameters_ref->{reference_file} $alignment_string_value\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
470 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
471 return $cmd_line;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
472 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
473
3af9b7634b2d Uploaded
plus
parents:
diff changeset
474
3af9b7634b2d Uploaded
plus
parents:
diff changeset
475 sub rename_sam_files {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
476 my $reads_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
477 my $files_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
478 my $cmd_line = "echo Rename SAM Files\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
479 $cmd_line .= "mv $$files_ref->{sam_file_1_orig} $$files_ref->{sam_file_1_full}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
480 if ( $$reads_ref eq 'paired' ) {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
481 $cmd_line .= "mv $$files_ref->{sam_file_2_orig} $$files_ref->{sam_file_2_full}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
482 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
483 return $cmd_line;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
484 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
485
3af9b7634b2d Uploaded
plus
parents:
diff changeset
486
3af9b7634b2d Uploaded
plus
parents:
diff changeset
487 sub alignments {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
488 my $reads_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
489 my $fastq_file_1_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
490 my $fastq_file_2_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
491 my $parameters_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
492 my $files_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
493 my $cmd_line = "echo Alignments\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
494
3af9b7634b2d Uploaded
plus
parents:
diff changeset
495 # -S input is SAM
3af9b7634b2d Uploaded
plus
parents:
diff changeset
496 # -b output is BAM
3af9b7634b2d Uploaded
plus
parents:
diff changeset
497 # -h print header for the SAM output
3af9b7634b2d Uploaded
plus
parents:
diff changeset
498
3af9b7634b2d Uploaded
plus
parents:
diff changeset
499 # $cmd_line .= "bwa mem $$parameters_ref->{reference_file} $$fastq_file_1_ref > $$files_ref->{sam_file_1_full}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
500 $cmd_line .= "samtools view -Shq 40 $$files_ref->{sam_file_1_full} > $$files_ref->{sam_file_1}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
501 $cmd_line .= "samtools view -bS $$files_ref->{sam_file_1} > $$files_ref->{bam_file_1}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
502 $cmd_line .= "bamToBed -i $$files_ref->{bam_file_1} > $$files_ref->{bed_file_1_orig}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
503 if ( $$reads_ref eq 'single' ) {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
504 $cmd_line .= "mv $$files_ref->{bed_file_1_orig} $$files_ref->{bed_file_combined}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
505 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
506 elsif ( $$reads_ref eq 'paired' ) {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
507 # $cmd_line .= "bwa mem $$parameters_ref->{reference_file} $$fastq_file_2_ref > $$files_ref->{sam_file_2_full}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
508 $cmd_line .= "samtools view -Shq 40 $$files_ref->{sam_file_2_full} > $$files_ref->{sam_file_2}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
509 $cmd_line .= "samtools view -bS $$files_ref->{sam_file_2} > $$files_ref->{bam_file_2}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
510 $cmd_line .= "bamToBed -i $$files_ref->{bam_file_2} > $$files_ref->{bed_file_2_orig}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
511 $cmd_line .= "cat $$files_ref->{bed_file_1_orig} $$files_ref->{bed_file_2_orig} > $$files_ref->{bed_file_combined}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
512 $cmd_line .= "rm $$files_ref->{bed_file_1_orig}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
513 $cmd_line .= "rm $$files_ref->{bed_file_2_orig}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
514 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
515 return $cmd_line;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
516 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
517
3af9b7634b2d Uploaded
plus
parents:
diff changeset
518
3af9b7634b2d Uploaded
plus
parents:
diff changeset
519 sub de_duplication {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
520 my $reads_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
521 my $fastq_file_1_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
522 my $fastq_file_2_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
523 my $parameters_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
524 my $files_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
525 my $cmd_line = "echo De-duplication\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
526
3af9b7634b2d Uploaded
plus
parents:
diff changeset
527 if ( $$reads_ref eq 'single' ) {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
528 $cmd_line .= "sort -k4,4 $$files_ref->{bed_file_combined}|$$parameters_ref->{path}/dedup_pipeline.sh -p $$parameters_ref->{path} -b /dev/stdin -f $$fastq_file_1_ref > $$files_ref->{dedup_file}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
529 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
530 else{
3af9b7634b2d Uploaded
plus
parents:
diff changeset
531 $cmd_line .= "sort -k4,4 $$files_ref->{bed_file_combined}|$$parameters_ref->{path}/dedup_pipeline.sh -p $$parameters_ref->{path} -b /dev/stdin -f $$fastq_file_1_ref -2 $$fastq_file_2_ref > $$files_ref->{dedup_file}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
532 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
533 $cmd_line .= "$$parameters_ref->{path}/de_dup_2_hash.pl -dedup $$files_ref->{dedup_file} -sam $$files_ref->{sam_file_1} -o $$files_ref->{sam_dedup_file_1}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
534 $cmd_line .= "$$parameters_ref->{path}/de_dup_2_hash.pl -dedup $$files_ref->{dedup_file} -sam $$files_ref->{sam_file_1_full} -o $$files_ref->{sam_dedup_file_1_full}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
535 if ( $$reads_ref eq 'paired' ) {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
536 $cmd_line .= "$$parameters_ref->{path}/de_dup_2_hash.pl -dedup $$files_ref->{dedup_file} -sam $$files_ref->{sam_file_2} -o $$files_ref->{sam_dedup_file_2}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
537 $cmd_line .= "$$parameters_ref->{path}/de_dup_2_hash.pl -dedup $$files_ref->{dedup_file} -sam $$files_ref->{sam_file_2_full} -o $$files_ref->{sam_dedup_file_2_full}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
538 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
539 return $cmd_line;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
540 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
541
3af9b7634b2d Uploaded
plus
parents:
diff changeset
542
3af9b7634b2d Uploaded
plus
parents:
diff changeset
543 sub select_on_and_off_target_reads {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
544 my $reads_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
545 my $parameters_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
546 my $files_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
547 my $cmd_line = "echo Select On- and Off-target Reads\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
548
3af9b7634b2d Uploaded
plus
parents:
diff changeset
549 # Create BED file of target regions
3af9b7634b2d Uploaded
plus
parents:
diff changeset
550 $cmd_line .= "$$parameters_ref->{path}/convert_target_regions_to_bed.pl -t $$files_ref->{target_regions_file} -o $$files_ref->{target_regions_bed_file}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
551
3af9b7634b2d Uploaded
plus
parents:
diff changeset
552 # All Reads
3af9b7634b2d Uploaded
plus
parents:
diff changeset
553 # Create a master file from the SAM file
3af9b7634b2d Uploaded
plus
parents:
diff changeset
554 # Join the master file
3af9b7634b2d Uploaded
plus
parents:
diff changeset
555 # Select the appropriate segment for each read id and create a BED file - need to have only one entry for each read in the BED file
3af9b7634b2d Uploaded
plus
parents:
diff changeset
556 # Convert BED files of reads to single points - do this so that only start of R2 and end of R1 are counted in overlapping with the target regions so that only the target region that overlaps with these end points will be counted as being hit - assumes that there are no overlapping regions in the target regions file
3af9b7634b2d Uploaded
plus
parents:
diff changeset
557 # Get intersection of reads with target regions
3af9b7634b2d Uploaded
plus
parents:
diff changeset
558 $cmd_line .= "$$parameters_ref->{path}/generate_master_file_without_annotation.pl -sam $$files_ref->{sam_file_1} -o $$files_ref->{full_master_prejoin_file_1}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
559 $cmd_line .= "$$parameters_ref->{path}/join_master_file.pl -master $$files_ref->{full_master_prejoin_file_1} -o $$files_ref->{full_master_file_1}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
560 $cmd_line .= "$$parameters_ref->{path}/convert_master_file_to_bed.pl -master $$files_ref->{full_master_file_1} -read $$reads_ref -tag 1 -o $$files_ref->{bed_file_1}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
561 $cmd_line .= "$$parameters_ref->{path}/convert_bed_to_single_points.pl -b $$files_ref->{bed_file_1} -read $$reads_ref -tag 1 -o $$files_ref->{bed_points_file_1}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
562 $cmd_line .= "intersectBed -a $$files_ref->{target_regions_bed_file} -b $$files_ref->{bed_points_file_1} -wa -wb > $$files_ref->{intersect_file_1}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
563 if ( $$reads_ref eq 'paired' ) {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
564 $cmd_line .= "$$parameters_ref->{path}/generate_master_file_without_annotation.pl -sam $$files_ref->{sam_file_2} -o $$files_ref->{full_master_prejoin_file_2}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
565 $cmd_line .= "$$parameters_ref->{path}/join_master_file.pl -master $$files_ref->{full_master_prejoin_file_2} -o $$files_ref->{full_master_file_2}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
566 $cmd_line .= "$$parameters_ref->{path}/convert_master_file_to_bed.pl -master $$files_ref->{full_master_file_2} -read $$reads_ref -tag 2 -o $$files_ref->{bed_file_2}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
567 $cmd_line .= "$$parameters_ref->{path}/convert_bed_to_single_points.pl -b $$files_ref->{bed_file_2} -read $$reads_ref -tag 2 -o $$files_ref->{bed_points_file_2}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
568 $cmd_line .= "intersectBed -a $$files_ref->{target_regions_bed_file} -b $$files_ref->{bed_points_file_2} -wa -wb > $$files_ref->{intersect_file_2}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
569 $cmd_line .= "cat $$files_ref->{intersect_file_1} $$files_ref->{intersect_file_2} > $$files_ref->{intersect_file_combined}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
570 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
571 # Create SAM files of the on- and off-target reads. On-target files contain all reads in which at least one of R1/R2 is on-target. Off-target files contain the remaining reads.
3af9b7634b2d Uploaded
plus
parents:
diff changeset
572 # On-/Off-target Alone Read 1
3af9b7634b2d Uploaded
plus
parents:
diff changeset
573 $cmd_line .= "$$parameters_ref->{path}/generate_on_target_sam_files_hash.pl -sam $$files_ref->{sam_file_1} -i $$files_ref->{intersect_file_1} -on $$files_ref->{sam_on_target_alone_file_1}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
574 $cmd_line .= "$$parameters_ref->{path}/mark_on_target_reads.pl -sam $$files_ref->{sam_file_1} -on $$files_ref->{sam_on_target_alone_file_1} -temp_dir $$parameters_ref->{directory} -o $$files_ref->{sam_file_1_marked}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
575 $cmd_line .= "grep -v 'ON_TARGET' $$files_ref->{sam_file_1_marked} > $$files_ref->{sam_off_target_alone_file_1}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
576 if ( $$reads_ref eq 'paired' ) {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
577 # On-/Off-target Alone Read 2
3af9b7634b2d Uploaded
plus
parents:
diff changeset
578 $cmd_line .= "$$parameters_ref->{path}/generate_on_target_sam_files_hash.pl -sam $$files_ref->{sam_file_2} -i $$files_ref->{intersect_file_2} -on $$files_ref->{sam_on_target_alone_file_2}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
579 $cmd_line .= "$$parameters_ref->{path}/mark_on_target_reads.pl -sam $$files_ref->{sam_file_2} -on $$files_ref->{sam_on_target_alone_file_2} -temp_dir $$parameters_ref->{directory} -o $$files_ref->{sam_file_2_marked}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
580 $cmd_line .= "grep -v 'ON_TARGET' $$files_ref->{sam_file_2_marked} > $$files_ref->{sam_off_target_alone_file_2}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
581 # On-/Off-target Either Read 1
3af9b7634b2d Uploaded
plus
parents:
diff changeset
582 $cmd_line .= "$$parameters_ref->{path}/generate_on_target_sam_files_hash.pl -sam $$files_ref->{sam_file_1} -i $$files_ref->{intersect_file_combined} -on $$files_ref->{sam_on_target_file_1}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
583 $cmd_line .= "$$parameters_ref->{path}/mark_on_target_reads.pl -sam $$files_ref->{sam_file_1} -on $$files_ref->{sam_on_target_file_1} -temp_dir $$parameters_ref->{directory} -o $$files_ref->{sam_file_1_marked}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
584 $cmd_line .= "grep -v 'ON_TARGET' $$files_ref->{sam_file_1_marked} > $$files_ref->{sam_off_target_file_1}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
585 # On-/Off-target Either Read 2
3af9b7634b2d Uploaded
plus
parents:
diff changeset
586 $cmd_line .= "$$parameters_ref->{path}/generate_on_target_sam_files_hash.pl -sam $$files_ref->{sam_file_2} -i $$files_ref->{intersect_file_combined} -on $$files_ref->{sam_on_target_file_2}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
587 $cmd_line .= "$$parameters_ref->{path}/mark_on_target_reads.pl -sam $$files_ref->{sam_file_2} -on $$files_ref->{sam_on_target_file_2} -temp_dir $$parameters_ref->{directory} -o $$files_ref->{sam_file_2_marked}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
588 $cmd_line .= "grep -v 'ON_TARGET' $$files_ref->{sam_file_2_marked} > $$files_ref->{sam_off_target_file_2}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
589 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
590
3af9b7634b2d Uploaded
plus
parents:
diff changeset
591 # De-duplicated Reads
3af9b7634b2d Uploaded
plus
parents:
diff changeset
592 $cmd_line .= "$$parameters_ref->{path}/generate_master_file_without_annotation.pl -sam $$files_ref->{sam_dedup_file_1} -o $$files_ref->{full_master_dedup_prejoin_file_1}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
593 $cmd_line .= "$$parameters_ref->{path}/join_master_file.pl -master $$files_ref->{full_master_dedup_prejoin_file_1} -o $$files_ref->{full_master_dedup_file_1}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
594 $cmd_line .= "$$parameters_ref->{path}/convert_master_file_to_bed.pl -master $$files_ref->{full_master_dedup_file_1} -read $$reads_ref -tag 1 -o $$files_ref->{bed_dedup_file_1}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
595 $cmd_line .= "$$parameters_ref->{path}/convert_bed_to_single_points.pl -b $$files_ref->{bed_dedup_file_1} -read $$reads_ref -tag 1 -o $$files_ref->{bed_points_dedup_file_1}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
596 $cmd_line .= "intersectBed -a $$files_ref->{target_regions_bed_file} -b $$files_ref->{bed_points_dedup_file_1} -wa -wb > $$files_ref->{intersect_dedup_file_1}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
597 if ( $$reads_ref eq 'paired' ) {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
598 $cmd_line .= "$$parameters_ref->{path}/generate_master_file_without_annotation.pl -sam $$files_ref->{sam_dedup_file_2} -o $$files_ref->{full_master_dedup_prejoin_file_2}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
599 $cmd_line .= "$$parameters_ref->{path}/join_master_file.pl -master $$files_ref->{full_master_dedup_prejoin_file_2} -o $$files_ref->{full_master_dedup_file_2}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
600 $cmd_line .= "$$parameters_ref->{path}/convert_master_file_to_bed.pl -master $$files_ref->{full_master_dedup_file_2} -read $$reads_ref -tag 2 -o $$files_ref->{bed_dedup_file_2}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
601 $cmd_line .= "$$parameters_ref->{path}/convert_bed_to_single_points.pl -b $$files_ref->{bed_dedup_file_2} -read $$reads_ref -tag 2 -o $$files_ref->{bed_points_dedup_file_2}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
602 $cmd_line .= "intersectBed -a $$files_ref->{target_regions_bed_file} -b $$files_ref->{bed_points_dedup_file_2} -wa -wb > $$files_ref->{intersect_dedup_file_2}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
603 $cmd_line .= "cat $$files_ref->{intersect_dedup_file_1} $$files_ref->{intersect_dedup_file_2} > $$files_ref->{intersect_dedup_file_combined}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
604 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
605 # Create SAM files of the on- and off-target reads. On-target files contain all reads in which at least one of R1/R2 is on-target. Off-target files contain the remaining reads.
3af9b7634b2d Uploaded
plus
parents:
diff changeset
606 # On-/Off-target Alone Read 1
3af9b7634b2d Uploaded
plus
parents:
diff changeset
607 $cmd_line .= "$$parameters_ref->{path}/generate_on_target_sam_files_hash.pl -sam $$files_ref->{sam_dedup_file_1} -i $$files_ref->{intersect_dedup_file_1} -on $$files_ref->{sam_dedup_on_target_alone_file_1}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
608 $cmd_line .= "$$parameters_ref->{path}/mark_on_target_reads.pl -sam $$files_ref->{sam_dedup_file_1} -on $$files_ref->{sam_dedup_on_target_alone_file_1} -temp_dir $$parameters_ref->{directory} -o $$files_ref->{sam_dedup_file_1_marked}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
609 $cmd_line .= "grep -v 'ON_TARGET' $$files_ref->{sam_dedup_file_1_marked} > $$files_ref->{sam_dedup_off_target_alone_file_1}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
610 if ( $$reads_ref eq 'paired' ) {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
611 # On-/Off-target Alone Read 2
3af9b7634b2d Uploaded
plus
parents:
diff changeset
612 $cmd_line .= "$$parameters_ref->{path}/generate_on_target_sam_files_hash.pl -sam $$files_ref->{sam_dedup_file_2} -i $$files_ref->{intersect_dedup_file_2} -on $$files_ref->{sam_dedup_on_target_alone_file_2}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
613 $cmd_line .= "$$parameters_ref->{path}/mark_on_target_reads.pl -sam $$files_ref->{sam_dedup_file_2} -on $$files_ref->{sam_dedup_on_target_alone_file_2} -temp_dir $$parameters_ref->{directory} -o $$files_ref->{sam_dedup_file_2_marked}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
614 $cmd_line .= "grep -v 'ON_TARGET' $$files_ref->{sam_dedup_file_2_marked} > $$files_ref->{sam_dedup_off_target_alone_file_2}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
615 # On-/Off-target Either Read 1
3af9b7634b2d Uploaded
plus
parents:
diff changeset
616 $cmd_line .= "$$parameters_ref->{path}/generate_on_target_sam_files_hash.pl -sam $$files_ref->{sam_dedup_file_1} -i $$files_ref->{intersect_dedup_file_combined} -on $$files_ref->{sam_dedup_on_target_file_1}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
617 $cmd_line .= "$$parameters_ref->{path}/mark_on_target_reads.pl -sam $$files_ref->{sam_dedup_file_1} -on $$files_ref->{sam_dedup_on_target_file_1} -temp_dir $$parameters_ref->{directory} -o $$files_ref->{sam_dedup_file_1_marked}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
618 $cmd_line .= "grep -v 'ON_TARGET' $$files_ref->{sam_dedup_file_1_marked} > $$files_ref->{sam_dedup_off_target_file_1}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
619 # On-/Off-target Either Read 2
3af9b7634b2d Uploaded
plus
parents:
diff changeset
620 $cmd_line .= "$$parameters_ref->{path}/generate_on_target_sam_files_hash.pl -sam $$files_ref->{sam_dedup_file_2} -i $$files_ref->{intersect_dedup_file_combined} -on $$files_ref->{sam_dedup_on_target_file_2}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
621 $cmd_line .= "$$parameters_ref->{path}/mark_on_target_reads.pl -sam $$files_ref->{sam_dedup_file_2} -on $$files_ref->{sam_dedup_on_target_file_2} -temp_dir $$parameters_ref->{directory} -o $$files_ref->{sam_dedup_file_2_marked}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
622 $cmd_line .= "grep -v 'ON_TARGET' $$files_ref->{sam_dedup_file_2_marked} > $$files_ref->{sam_dedup_off_target_file_2}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
623 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
624 return $cmd_line;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
625 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
626
3af9b7634b2d Uploaded
plus
parents:
diff changeset
627
3af9b7634b2d Uploaded
plus
parents:
diff changeset
628 sub generate_coverage_and_start_sites {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
629 my $reads_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
630 my $parameters_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
631 my $files_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
632 my $cmd_line = "echo Generate Coverage and Start Sites\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
633
3af9b7634b2d Uploaded
plus
parents:
diff changeset
634 $cmd_line .= "bash $$parameters_ref->{path}/generateHistAndStartSiteInfo.sh $$files_ref->{sam_dedup_file_1} $$parameters_ref->{reference_file} $$parameters_ref->{reference_file_index} $$files_ref->{start_site_dedup_file_1} $$files_ref->{coverage_dedup_file_1} $$parameters_ref->{path}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
635
3af9b7634b2d Uploaded
plus
parents:
diff changeset
636 if ( $$reads_ref eq 'paired' ) {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
637 $cmd_line .= "bash $$parameters_ref->{path}/generateHistAndStartSiteInfo.sh $$files_ref->{sam_dedup_file_2} $$parameters_ref->{reference_file} $$parameters_ref->{reference_file_index} $$files_ref->{start_site_dedup_file_2} $$files_ref->{coverage_dedup_file_2} $$parameters_ref->{path}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
638 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
639
3af9b7634b2d Uploaded
plus
parents:
diff changeset
640 return $cmd_line;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
641 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
642
3af9b7634b2d Uploaded
plus
parents:
diff changeset
643
3af9b7634b2d Uploaded
plus
parents:
diff changeset
644 sub generate_master_files {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
645 my $reads_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
646 my $parameters_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
647 my $files_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
648 my $cmd_line = "echo Generate Master Files\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
649
3af9b7634b2d Uploaded
plus
parents:
diff changeset
650 # Create a master file of all reads with one line per read
3af9b7634b2d Uploaded
plus
parents:
diff changeset
651 if ( $$reads_ref eq 'single' ) {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
652 $cmd_line .= "$$parameters_ref->{path}/generate_master_file_without_annotation.pl -sam $$files_ref->{sam_dedup_on_target_alone_file_1} -o $$files_ref->{master_dedup_no_annotation_file_1}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
653 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
654 else{
3af9b7634b2d Uploaded
plus
parents:
diff changeset
655 $cmd_line .= "$$parameters_ref->{path}/generate_master_file_without_annotation.pl -sam $$files_ref->{sam_dedup_on_target_file_1} -o $$files_ref->{master_dedup_no_annotation_file_1}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
656 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
657
3af9b7634b2d Uploaded
plus
parents:
diff changeset
658 $cmd_line .= "python $$parameters_ref->{path}/archer/annotation/annotate.py --gtf_file $$parameters_ref->{gtf_file} --coordinate_file $$files_ref->{master_dedup_no_annotation_file_1} --outfile $$files_ref->{master_dedup_prejoin_file_1} --chromosome_indices 1,1 --coordinate_indices 5,6\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
659
3af9b7634b2d Uploaded
plus
parents:
diff changeset
660 $cmd_line .= "$$parameters_ref->{path}/join_master_file.pl -master $$files_ref->{master_dedup_prejoin_file_1} -o $$files_ref->{master_dedup_file_1}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
661
3af9b7634b2d Uploaded
plus
parents:
diff changeset
662 if ( $$reads_ref eq 'paired' ) {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
663 $cmd_line .= "$$parameters_ref->{path}/generate_master_file_without_annotation.pl -sam $$files_ref->{sam_dedup_on_target_file_2} -o $$files_ref->{master_dedup_no_annotation_file_2}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
664
3af9b7634b2d Uploaded
plus
parents:
diff changeset
665 $cmd_line .= "python $$parameters_ref->{path}/archer/annotation/annotate.py --gtf_file $$parameters_ref->{gtf_file} --coordinate_file $$files_ref->{master_dedup_no_annotation_file_2} --outfile $$files_ref->{master_dedup_prejoin_file_2} --chromosome_indices 1,1 --coordinate_indices 5,6\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
666
3af9b7634b2d Uploaded
plus
parents:
diff changeset
667 $cmd_line .= "$$parameters_ref->{path}/join_master_file.pl -master $$files_ref->{master_dedup_prejoin_file_2} -o $$files_ref->{master_dedup_file_2}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
668 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
669
3af9b7634b2d Uploaded
plus
parents:
diff changeset
670 return $cmd_line;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
671 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
672
3af9b7634b2d Uploaded
plus
parents:
diff changeset
673 sub select_fusion_reads {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
674 my $reads_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
675 my $parameters_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
676 my $files_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
677 my $cmd_line = "echo Select Fusion Reads\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
678
3af9b7634b2d Uploaded
plus
parents:
diff changeset
679 $cmd_line .= "$$parameters_ref->{path}/select_fusion_reads.pl -master $$files_ref->{master_dedup_file_1} -tag 1 -o1 $$files_ref->{one_segment_reads_file_1} -os $$files_ref->{splice_reads_file_1} -of $$files_ref->{fusion_reads_file_1} -omf $$files_ref->{multi_fusion_reads_file_1}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
680
3af9b7634b2d Uploaded
plus
parents:
diff changeset
681 if ( $$reads_ref eq 'single' ) {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
682 $cmd_line .= "cp $$files_ref->{fusion_reads_file_1} $$files_ref->{fusion_reads_file}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
683 $cmd_line .= "cp $$files_ref->{splice_reads_file_1} $$files_ref->{splice_reads_file}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
684 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
685
3af9b7634b2d Uploaded
plus
parents:
diff changeset
686 if ( $$reads_ref eq 'paired' ) {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
687 $cmd_line .= "$$parameters_ref->{path}/select_fusion_reads.pl -master $$files_ref->{master_dedup_file_2} -tag 2 -o1 $$files_ref->{one_segment_reads_file_2} -os $$files_ref->{splice_reads_file_2} -of $$files_ref->{fusion_reads_file_2} -omf $$files_ref->{multi_fusion_reads_file_2}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
688 $cmd_line .= "cat $$files_ref->{fusion_reads_file_1} $$files_ref->{fusion_reads_file_2} > $$files_ref->{fusion_reads_file}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
689 $cmd_line .= "cat $$files_ref->{splice_reads_file_1} $$files_ref->{splice_reads_file_2} > $$files_ref->{splice_reads_file}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
690 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
691
3af9b7634b2d Uploaded
plus
parents:
diff changeset
692 return $cmd_line;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
693 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
694
3af9b7634b2d Uploaded
plus
parents:
diff changeset
695 sub count_fusions {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
696 my $reads_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
697 my $parameters_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
698 my $files_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
699 my $cmd_line = "echo Count Fusions and Splice Events\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
700
3af9b7634b2d Uploaded
plus
parents:
diff changeset
701 # Count the number of each type of fusion pair, i.e., Gene A Exon X with Gene B Exon Y, get the median value of the coordinate of each breakpoint, sort and output each type
3af9b7634b2d Uploaded
plus
parents:
diff changeset
702 $cmd_line .= "$$parameters_ref->{path}/count_fusions.pl -t $$files_ref->{target_regions_file} -fr $$files_ref->{fusion_reads_file} -min 30 -gtf $$parameters_ref->{gtf_file} -read $$reads_ref -limit 10 -min_occ 5 -ob $$files_ref->{fusion_counts_bare_file} -o $$files_ref->{fusion_counts_file}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
703
3af9b7634b2d Uploaded
plus
parents:
diff changeset
704 # Count the number of each type of splice pair - Use default values for -limit and -min_occ so that all splices will be reported
3af9b7634b2d Uploaded
plus
parents:
diff changeset
705 $cmd_line .= "$$parameters_ref->{path}/count_fusions.pl -t $$files_ref->{target_regions_file} -fr $$files_ref->{splice_reads_file} -min 30 -gtf $$parameters_ref->{gtf_file} -read $$reads_ref -ob $$files_ref->{splice_counts_bare_file} -o $$files_ref->{splice_counts_file}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
706
3af9b7634b2d Uploaded
plus
parents:
diff changeset
707 # Add splice evidence to fusion counts
3af9b7634b2d Uploaded
plus
parents:
diff changeset
708 $cmd_line .= "$$parameters_ref->{path}/add_splice_to_fusion_counts.pl -fcb $$files_ref->{fusion_counts_bare_file} -scb $$files_ref->{splice_counts_bare_file} -o $$files_ref->{fusion_counts_with_splice_bare_file} -om $$files_ref->{fusion_counts_with_splice_bare_file_machine}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
709
3af9b7634b2d Uploaded
plus
parents:
diff changeset
710 return $cmd_line;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
711 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
712
3af9b7634b2d Uploaded
plus
parents:
diff changeset
713
3af9b7634b2d Uploaded
plus
parents:
diff changeset
714 sub flanking_sequences {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
715 my $reads_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
716 my $fastq_file_1_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
717 my $fastq_file_2_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
718 my $parameters_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
719 my $files_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
720 my $cmd_line = "echo Flanking Sequences\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
721
3af9b7634b2d Uploaded
plus
parents:
diff changeset
722 if ( $$reads_ref eq 'single' ) {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
723 $cmd_line .= "$$parameters_ref->{path}/flanking_sequences.pl -fcb $$files_ref->{fusion_counts_bare_file} -fr $$files_ref->{fusion_reads_file} -read $$reads_ref -fastq_1 $$fastq_file_1_ref -o $$files_ref->{flanking_sequences_file}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
724 $cmd_line .= "$$parameters_ref->{path}/flanking_sequences.pl -fcb $$files_ref->{splice_counts_bare_file} -fr $$files_ref->{splice_reads_file} -read $$reads_ref -fastq_1 $$fastq_file_1_ref -o $$files_ref->{flanking_splice_sequences_file}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
725 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
726 else{
3af9b7634b2d Uploaded
plus
parents:
diff changeset
727 $cmd_line .= "$$parameters_ref->{path}/flanking_sequences.pl -fcb $$files_ref->{fusion_counts_bare_file} -fr $$files_ref->{fusion_reads_file} -read $$reads_ref -fastq_1 $$fastq_file_1_ref -fastq_2 $$fastq_file_2_ref -o $$files_ref->{flanking_sequences_file}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
728 $cmd_line .= "$$parameters_ref->{path}/flanking_sequences.pl -fcb $$files_ref->{splice_counts_bare_file} -fr $$files_ref->{splice_reads_file} -read $$reads_ref -fastq_1 $$fastq_file_1_ref -fastq_2 $$fastq_file_2_ref -o $$files_ref->{flanking_splice_sequences_file}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
729 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
730 return $cmd_line;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
731 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
732
3af9b7634b2d Uploaded
plus
parents:
diff changeset
733
3af9b7634b2d Uploaded
plus
parents:
diff changeset
734 sub bam_dedup_files {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
735 my $reads_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
736 my $files_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
737 my $cmd_line = "echo BAM Dedup Files\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
738 # Make sorted de-dup BAM files
3af9b7634b2d Uploaded
plus
parents:
diff changeset
739 $cmd_line .= "samtools view -bS $$files_ref->{sam_dedup_file_1} > $$files_ref->{bam_dedup_file_1}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
740 $cmd_line .= "samtools sort $$files_ref->{bam_dedup_file_1} $$files_ref->{bam_dedup_sorted_file_1_name}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
741 $cmd_line .= "samtools index $$files_ref->{bam_dedup_sorted_file_1}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
742 if ( $$reads_ref eq 'paired' ) {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
743 $cmd_line .= "samtools view -bS $$files_ref->{sam_dedup_file_2} > $$files_ref->{bam_dedup_file_2}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
744 $cmd_line .= "samtools sort $$files_ref->{bam_dedup_file_2} $$files_ref->{bam_dedup_sorted_file_2_name}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
745 $cmd_line .= "samtools index $$files_ref->{bam_dedup_sorted_file_2}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
746 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
747 return $cmd_line;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
748 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
749
3af9b7634b2d Uploaded
plus
parents:
diff changeset
750
3af9b7634b2d Uploaded
plus
parents:
diff changeset
751 sub consensus_sequences {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
752 my $reads_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
753 my $fastq_file_1_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
754 my $fastq_file_2_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
755 my $tag_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
756 my $parameters_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
757 my $files_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
758 my $cmd_line = "echo Consensus Sequences\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
759
3af9b7634b2d Uploaded
plus
parents:
diff changeset
760 # Fusion and Splice Consensus Sequences
3af9b7634b2d Uploaded
plus
parents:
diff changeset
761 if ( $$reads_ref eq 'single' ) {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
762 $cmd_line .= "bash $$parameters_ref->{path}/consensus_pipeline/batch_pipeline.sh -1 $$files_ref->{bam_dedup_sorted_file_1} -a $$fastq_file_1_ref -f $$parameters_ref->{reference_file} -r $$files_ref->{flanking_sequences_file} -d $$parameters_ref->{path}/consensus_pipeline/ -s $$files_ref->{consensus_fusion_std_out_file} -e $$files_ref->{consensus_fusion_std_err_file}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
763 $cmd_line .= "bash $$parameters_ref->{path}/consensus_pipeline/batch_pipeline.sh -1 $$files_ref->{bam_dedup_sorted_file_1} -a $$fastq_file_1_ref -f $$parameters_ref->{reference_file} -r $$files_ref->{flanking_splice_sequences_file} -d $$parameters_ref->{path}/consensus_pipeline/ -s $$files_ref->{consensus_splice_std_out_file} -e $$files_ref->{consensus_splice_std_err_file}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
764 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
765 else{
3af9b7634b2d Uploaded
plus
parents:
diff changeset
766 $cmd_line .= "bash $$parameters_ref->{path}/consensus_pipeline/batch_pipeline.sh -1 $$files_ref->{bam_dedup_sorted_file_1} -2 $$files_ref->{bam_dedup_sorted_file_2} -a $$fastq_file_1_ref -b $$fastq_file_2_ref -f $$parameters_ref->{reference_file} -r $$files_ref->{flanking_sequences_file} -d $$parameters_ref->{path}/consensus_pipeline/ -s $$files_ref->{consensus_fusion_std_out_file} -e $$files_ref->{consensus_fusion_std_err_file}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
767 $cmd_line .= "bash $$parameters_ref->{path}/consensus_pipeline/batch_pipeline.sh -1 $$files_ref->{bam_dedup_sorted_file_1} -2 $$files_ref->{bam_dedup_sorted_file_2} -a $$fastq_file_1_ref -b $$fastq_file_2_ref -f $$parameters_ref->{reference_file} -r $$files_ref->{flanking_splice_sequences_file} -d $$parameters_ref->{path}/consensus_pipeline/ -s $$files_ref->{consensus_splice_std_out_file} -e $$files_ref->{consensus_splice_std_err_file}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
768 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
769
3af9b7634b2d Uploaded
plus
parents:
diff changeset
770 # Pair Fusion Candidates with Splice Sequences
3af9b7634b2d Uploaded
plus
parents:
diff changeset
771 $cmd_line .= "$$parameters_ref->{path}/pair_fusion_and_splice_sequences.pl -fc $$files_ref->{fusion_counts_bare_file} -sc $$files_ref->{splice_counts_bare_file} -tag $$tag_ref -o $$files_ref->{fusion_and_splice_consensus_file}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
772
3af9b7634b2d Uploaded
plus
parents:
diff changeset
773 return $cmd_line;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
774 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
775
3af9b7634b2d Uploaded
plus
parents:
diff changeset
776
3af9b7634b2d Uploaded
plus
parents:
diff changeset
777 sub sort_sam_files {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
778 my $reads_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
779 my $files_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
780 my $cmd_line = "echo Sort SAM Files\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
781
3af9b7634b2d Uploaded
plus
parents:
diff changeset
782 $cmd_line .= "sort -k1,1 $$files_ref->{sam_on_target_alone_file_1} > $$files_ref->{sam_on_target_alone_file_1_linux_sorted}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
783 $cmd_line .= "sort -k1,1 $$files_ref->{sam_off_target_alone_file_1} > $$files_ref->{sam_off_target_alone_file_1_linux_sorted}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
784 $cmd_line .= "sort -k1,1 $$files_ref->{sam_dedup_on_target_alone_file_1} > $$files_ref->{sam_dedup_on_target_alone_file_1_linux_sorted}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
785 $cmd_line .= "sort -k1,1 $$files_ref->{sam_dedup_off_target_alone_file_1} > $$files_ref->{sam_dedup_off_target_alone_file_1_linux_sorted}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
786
3af9b7634b2d Uploaded
plus
parents:
diff changeset
787 $cmd_line .= "samtools view -bS $$files_ref->{sam_file_1_full} > $$files_ref->{bam_file_1_full}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
788 $cmd_line .= "samtools sort -n $$files_ref->{bam_file_1_full} $$files_ref->{bam_file_1_full_prefix}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
789 $cmd_line .= "samtools view -h $$files_ref->{bam_file_1_full_sorted} > $$files_ref->{sam_file_1_full_sorted}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
790 $cmd_line .= "samtools view -bS $$files_ref->{sam_dedup_file_1_full} > $$files_ref->{bam_dedup_file_1_full}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
791 $cmd_line .= "samtools sort -n $$files_ref->{bam_dedup_file_1_full} $$files_ref->{bam_dedup_file_1_full_prefix}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
792 $cmd_line .= "samtools view -h $$files_ref->{bam_dedup_file_1_full_sorted} > $$files_ref->{sam_dedup_file_1_full_sorted}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
793
3af9b7634b2d Uploaded
plus
parents:
diff changeset
794 if ( $$reads_ref eq 'paired' ) { # Need to make this possible to be reverse only too
3af9b7634b2d Uploaded
plus
parents:
diff changeset
795
3af9b7634b2d Uploaded
plus
parents:
diff changeset
796 $cmd_line .= "sort -k1,1 $$files_ref->{sam_on_target_file_1} > $$files_ref->{sam_on_target_file_1_linux_sorted}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
797 $cmd_line .= "sort -k1,1 $$files_ref->{sam_off_target_file_1} > $$files_ref->{sam_off_target_file_1_linux_sorted}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
798 $cmd_line .= "sort -k1,1 $$files_ref->{sam_dedup_on_target_file_1} > $$files_ref->{sam_dedup_on_target_file_1_linux_sorted}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
799 $cmd_line .= "sort -k1,1 $$files_ref->{sam_dedup_off_target_file_1} > $$files_ref->{sam_dedup_off_target_file_1_linux_sorted}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
800 $cmd_line .= "sort -k1,1 $$files_ref->{sam_on_target_alone_file_2} > $$files_ref->{sam_on_target_alone_file_2_linux_sorted}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
801 $cmd_line .= "sort -k1,1 $$files_ref->{sam_off_target_alone_file_2} > $$files_ref->{sam_off_target_alone_file_2_linux_sorted}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
802 $cmd_line .= "sort -k1,1 $$files_ref->{sam_dedup_on_target_alone_file_2} > $$files_ref->{sam_dedup_on_target_alone_file_2_linux_sorted}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
803 $cmd_line .= "sort -k1,1 $$files_ref->{sam_dedup_off_target_alone_file_2} > $$files_ref->{sam_dedup_off_target_alone_file_2_linux_sorted}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
804 $cmd_line .= "sort -k1,1 $$files_ref->{sam_on_target_file_2} > $$files_ref->{sam_on_target_file_2_linux_sorted}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
805 $cmd_line .= "sort -k1,1 $$files_ref->{sam_off_target_file_2} > $$files_ref->{sam_off_target_file_2_linux_sorted}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
806 $cmd_line .= "sort -k1,1 $$files_ref->{sam_dedup_on_target_file_2} > $$files_ref->{sam_dedup_on_target_file_2_linux_sorted}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
807 $cmd_line .= "sort -k1,1 $$files_ref->{sam_dedup_off_target_file_2} > $$files_ref->{sam_dedup_off_target_file_2_linux_sorted}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
808
3af9b7634b2d Uploaded
plus
parents:
diff changeset
809 $cmd_line .= "samtools view -bS $$files_ref->{sam_file_2_full} > $$files_ref->{bam_file_2_full}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
810 $cmd_line .= "samtools sort -n $$files_ref->{bam_file_2_full} $$files_ref->{bam_file_2_full_prefix}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
811 $cmd_line .= "samtools view -h $$files_ref->{bam_file_2_full_sorted} > $$files_ref->{sam_file_2_full_sorted}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
812 $cmd_line .= "samtools view -bS $$files_ref->{sam_dedup_file_2_full} > $$files_ref->{bam_dedup_file_2_full}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
813 $cmd_line .= "samtools sort -n $$files_ref->{bam_dedup_file_2_full} $$files_ref->{bam_dedup_file_2_full_prefix}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
814 $cmd_line .= "samtools view -h $$files_ref->{bam_dedup_file_2_full_sorted} > $$files_ref->{sam_dedup_file_2_full_sorted}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
815 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
816 return $cmd_line;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
817 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
818
3af9b7634b2d Uploaded
plus
parents:
diff changeset
819
3af9b7634b2d Uploaded
plus
parents:
diff changeset
820 sub on_target_stats {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
821 my $reads_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
822 my $parameters_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
823 my $files_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
824 my $cmd_line = "echo On-target Stats\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
825
3af9b7634b2d Uploaded
plus
parents:
diff changeset
826 if ( -e $$files_ref->{target_regions_file} ) {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
827 if ( -s $$files_ref->{target_regions_file} ) {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
828
3af9b7634b2d Uploaded
plus
parents:
diff changeset
829 if ( $$reads_ref eq 'single' ) { # Need to make this possible to be reverse only too
3af9b7634b2d Uploaded
plus
parents:
diff changeset
830
3af9b7634b2d Uploaded
plus
parents:
diff changeset
831 # Counts of on- and off-target reads
3af9b7634b2d Uploaded
plus
parents:
diff changeset
832 $cmd_line .= "$$parameters_ref->{path}/on_target_counts.pl -on_alone_1 $$files_ref->{sam_on_target_alone_file_1_linux_sorted} -off_alone_1 $$files_ref->{sam_off_target_alone_file_1_linux_sorted} -o $$files_ref->{on_target_file}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
833 $cmd_line .= "$$parameters_ref->{path}/on_target_counts.pl -on_alone_1 $$files_ref->{sam_dedup_on_target_alone_file_1_linux_sorted} -off_alone_1 $$files_ref->{sam_dedup_off_target_alone_file_1_linux_sorted} -o $$files_ref->{on_target_dedup_file}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
834
3af9b7634b2d Uploaded
plus
parents:
diff changeset
835 # On-target Stats and Housekeeping Stats
3af9b7634b2d Uploaded
plus
parents:
diff changeset
836 $cmd_line .= "$$parameters_ref->{path}/on_target_stats.pl -t $$files_ref->{target_regions_file} -i1 $$files_ref->{intersect_file_1} -o $$files_ref->{reads_per_exon_file} -oh $$files_ref->{housekeeping_file}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
837 $cmd_line .= "$$parameters_ref->{path}/on_target_stats.pl -t $$files_ref->{target_regions_file} -i1 $$files_ref->{intersect_dedup_file_1} -o $$files_ref->{reads_per_exon_dedup_file} -oh $$files_ref->{housekeeping_dedup_file} -om $$files_ref->{reads_per_exon_dedup_file_machine}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
838 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
839 else{
3af9b7634b2d Uploaded
plus
parents:
diff changeset
840 # Counts of on- and off-target reads
3af9b7634b2d Uploaded
plus
parents:
diff changeset
841 $cmd_line .= "$$parameters_ref->{path}/on_target_counts.pl -on_alone_1 $$files_ref->{sam_on_target_alone_file_1_linux_sorted} -on_alone_2 $$files_ref->{sam_on_target_alone_file_2_linux_sorted} -off_alone_1 $$files_ref->{sam_off_target_alone_file_1_linux_sorted} -off_alone_2 $$files_ref->{sam_off_target_alone_file_2_linux_sorted} -on_1 $$files_ref->{sam_on_target_file_1_linux_sorted} -on_2 $$files_ref->{sam_on_target_file_2_linux_sorted} -off_1 $$files_ref->{sam_off_target_file_1_linux_sorted} -off_2 $$files_ref->{sam_off_target_file_2_linux_sorted} -o $$files_ref->{on_target_file}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
842 $cmd_line .= "$$parameters_ref->{path}/on_target_counts.pl -on_alone_1 $$files_ref->{sam_dedup_on_target_alone_file_1_linux_sorted} -on_alone_2 $$files_ref->{sam_dedup_on_target_alone_file_2_linux_sorted} -off_alone_1 $$files_ref->{sam_dedup_off_target_alone_file_1_linux_sorted} -off_alone_2 $$files_ref->{sam_dedup_off_target_alone_file_2_linux_sorted} -on_1 $$files_ref->{sam_dedup_on_target_file_1_linux_sorted} -on_2 $$files_ref->{sam_dedup_on_target_file_2_linux_sorted} -off_1 $$files_ref->{sam_dedup_off_target_file_1_linux_sorted} -off_2 $$files_ref->{sam_dedup_off_target_file_2_linux_sorted} -o $$files_ref->{on_target_dedup_file}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
843
3af9b7634b2d Uploaded
plus
parents:
diff changeset
844 # On-target Stats and Housekeeping Stats
3af9b7634b2d Uploaded
plus
parents:
diff changeset
845 $cmd_line .= "$$parameters_ref->{path}/on_target_stats.pl -t $$files_ref->{target_regions_file} -i1 $$files_ref->{intersect_file_1} -i2 $$files_ref->{intersect_file_2} -o $$files_ref->{reads_per_exon_file} -oh $$files_ref->{housekeeping_file}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
846
3af9b7634b2d Uploaded
plus
parents:
diff changeset
847 $cmd_line .= "$$parameters_ref->{path}/on_target_stats.pl -t $$files_ref->{target_regions_file} -i1 $$files_ref->{intersect_dedup_file_1} -i2 $$files_ref->{intersect_dedup_file_2} -o $$files_ref->{reads_per_exon_dedup_file} -oh $$files_ref->{housekeeping_dedup_file} -om $$files_ref->{reads_per_exon_dedup_file_machine}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
848 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
849 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
850 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
851 return $cmd_line;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
852 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
853
3af9b7634b2d Uploaded
plus
parents:
diff changeset
854 sub total_molecule_counts {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
855 my $reads_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
856 my $parameters_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
857 my $files_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
858 my $cmd_line = "echo Total Molecule Counts\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
859 if ( $$reads_ref eq 'single' ) {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
860 $cmd_line .= "python $$parameters_ref->{path}/count_reads_and_alignments_v2.py -r1 $$files_ref->{sam_file_1_full_sorted} -o $$files_ref->{total_and_aligned_molecule_count_per_tag_file}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
861 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
862 else {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
863 $cmd_line .= "python $$parameters_ref->{path}/count_reads_and_alignments_v2.py -r1 $$files_ref->{sam_file_1_full_sorted} -r2 $$files_ref->{sam_file_2_full_sorted} -o $$files_ref->{total_and_aligned_molecule_count_per_tag_file}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
864 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
865 return $cmd_line;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
866 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
867
3af9b7634b2d Uploaded
plus
parents:
diff changeset
868
3af9b7634b2d Uploaded
plus
parents:
diff changeset
869 sub de_duplicated_molecule_counts {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
870 my $reads_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
871 my $parameters_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
872 my $files_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
873 my $cmd_line = "echo De-duplicated Molecule Counts\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
874 if ( $$reads_ref eq 'single' ) {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
875 $cmd_line .= "python $$parameters_ref->{path}/count_reads_and_alignments_v2.py -r1 $$files_ref->{sam_dedup_file_1_full_sorted} -o $$files_ref->{unique_and_aligned_molecule_count_per_tag_file}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
876 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
877 else {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
878 $cmd_line .= "python $$parameters_ref->{path}/count_reads_and_alignments_v2.py -r1 $$files_ref->{sam_dedup_file_1_full_sorted} -r2 $$files_ref->{sam_dedup_file_2_full_sorted} -o $$files_ref->{unique_and_aligned_molecule_count_per_tag_file}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
879 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
880 return $cmd_line;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
881 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
882
3af9b7634b2d Uploaded
plus
parents:
diff changeset
883
3af9b7634b2d Uploaded
plus
parents:
diff changeset
884 sub all_molecule_counts {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
885 my $parameters_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
886 my $files_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
887 my $cmd_line = "echo All Molecule Counts\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
888 $cmd_line .= "$$parameters_ref->{path}/counts_2.pl -tamc $$files_ref->{total_and_aligned_molecule_count_per_tag_file} -uamc $$files_ref->{unique_and_aligned_molecule_count_per_tag_file} -otd $$files_ref->{on_target_dedup_file} -ot $$files_ref->{on_target_file} -o $$files_ref->{counts_file} -om $$files_ref->{counts_file_machine}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
889 return $cmd_line;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
890 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
891
3af9b7634b2d Uploaded
plus
parents:
diff changeset
892 sub qc_check {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
893 my $parameters_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
894 my $files_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
895 my $cmd_line = "echo QC Check\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
896 $cmd_line .= "$$parameters_ref->{path}/qc_check.pl -hd $$files_ref->{housekeeping_dedup_file} -o $$files_ref->{qc_filter_file} -om $$files_ref->{qc_filter_file_machine}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
897 return $cmd_line;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
898 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
899
3af9b7634b2d Uploaded
plus
parents:
diff changeset
900 sub coverage_uniformity {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
901 my $reads_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
902 my $parameters_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
903 my $files_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
904 my $cmd_line = "echo Coverage Uniformity\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
905 $cmd_line .= "$$parameters_ref->{path}/coverage_uniformity.pl -hd $$files_ref->{housekeeping_dedup_file} -r $$reads_ref -o $$files_ref->{coverage_uniformity_file} -om $$files_ref->{coverage_uniformity_file_machine}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
906 return $cmd_line;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
907 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
908
3af9b7634b2d Uploaded
plus
parents:
diff changeset
909
3af9b7634b2d Uploaded
plus
parents:
diff changeset
910 sub summary {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
911 my $tag_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
912 my $parameters_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
913 my $files_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
914 my $cmd_line = "echo Summary\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
915
3af9b7634b2d Uploaded
plus
parents:
diff changeset
916 # my $sample_name = "'" . @$samples_array_ref[$sample_element_number] . "'";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
917
3af9b7634b2d Uploaded
plus
parents:
diff changeset
918 $cmd_line .= "$$parameters_ref->{path}/summary.pl -s $$tag_ref -o $$files_ref->{summary_file} -om $$files_ref->{summary_file_machine}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
919 $cmd_line .= "cat $$files_ref->{qc_filter_file} >> $$files_ref->{summary_file}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
920 # $cmd_line .= "cat $$files_ref->{coverage_uniformity_file} >> $$files_ref->{summary_file}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
921 $cmd_line .= "cat $$files_ref->{counts_file} >> $$files_ref->{summary_file}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
922 if ( -e $$files_ref->{reads_per_exon_dedup_file} ) {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
923 if ( -s $$files_ref->{reads_per_exon_dedup_file} ) {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
924 $cmd_line .= "cat $$files_ref->{reads_per_exon_dedup_file} >> $$files_ref->{summary_file}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
925 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
926 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
927 $cmd_line .= "cat $$files_ref->{fusion_counts_with_splice_bare_file} >> $$files_ref->{summary_file}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
928 # $cmd_line .= "enscript -f Courier8 -p $$files_ref->{summary_file_ps} $$files_ref->{summary_file}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
929 # $cmd_line .= "ps2pdf $$files_ref->{summary_file_ps} $$files_ref->{summary_file_pdf}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
930
3af9b7634b2d Uploaded
plus
parents:
diff changeset
931 # Machine Readable Summary File
3af9b7634b2d Uploaded
plus
parents:
diff changeset
932 $cmd_line .= "cat $$files_ref->{qc_filter_file_machine} >> $$files_ref->{summary_file_machine}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
933 # $cmd_line .= "cat $$files_ref->{coverage_uniformity_file_machine} >> $$files_ref->{summary_file_machine}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
934 $cmd_line .= "cat $$files_ref->{counts_file_machine} >> $$files_ref->{summary_file_machine}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
935 if ( -e $$files_ref->{reads_per_exon_dedup_file_machine} ) {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
936 if ( -s $$files_ref->{reads_per_exon_dedup_file_machine} ) {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
937 $cmd_line .= "cat $$files_ref->{reads_per_exon_dedup_file_machine} >> $$files_ref->{summary_file_machine}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
938 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
939 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
940 $cmd_line .= "cat $$files_ref->{fusion_counts_with_splice_bare_file_machine} >> $$files_ref->{summary_file_machine}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
941
3af9b7634b2d Uploaded
plus
parents:
diff changeset
942 return $cmd_line;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
943 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
944
3af9b7634b2d Uploaded
plus
parents:
diff changeset
945
3af9b7634b2d Uploaded
plus
parents:
diff changeset
946 sub clean_up {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
947 my $reads_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
948 my $parameters_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
949 my $files_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
950 my $file;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
951 my $cmd_line = "echo Clean Up\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
952
3af9b7634b2d Uploaded
plus
parents:
diff changeset
953 # Clean up Flanking Sequences Files
3af9b7634b2d Uploaded
plus
parents:
diff changeset
954 $cmd_line .= "$$parameters_ref->{path}/clean_up_flanking_sequences.pl -f $$files_ref->{flanking_sequences_file}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
955
3af9b7634b2d Uploaded
plus
parents:
diff changeset
956 # Clean up Flanking Splice Sequences Files
3af9b7634b2d Uploaded
plus
parents:
diff changeset
957 $cmd_line .= "$$parameters_ref->{path}/clean_up_flanking_sequences.pl -f $$files_ref->{flanking_splice_sequences_file}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
958
3af9b7634b2d Uploaded
plus
parents:
diff changeset
959 # Clean up
3af9b7634b2d Uploaded
plus
parents:
diff changeset
960 $cmd_line .= "rm $$files_ref->{sam_file_1_full}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
961 $cmd_line .= "rm $$files_ref->{bam_file_1}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
962 $cmd_line .= "rm $$files_ref->{bed_file_1}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
963 $cmd_line .= "rm $$files_ref->{bed_file_combined}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
964 $cmd_line .= "rm $$files_ref->{sam_dedup_file_1}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
965 $cmd_line .= "rm $$files_ref->{sam_dedup_file_1_full}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
966 $cmd_line .= "rm $$files_ref->{bam_dedup_file_1}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
967 $cmd_line .= "rm $$files_ref->{full_master_prejoin_file_1}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
968 $cmd_line .= "rm $$files_ref->{full_master_file_1}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
969 $cmd_line .= "rm $$files_ref->{full_master_dedup_prejoin_file_1}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
970 $cmd_line .= "rm $$files_ref->{full_master_dedup_file_1}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
971 $cmd_line .= "rm $$files_ref->{bed_points_file_1}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
972 $cmd_line .= "rm $$files_ref->{bed_points_dedup_file_1}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
973 $cmd_line .= "rm $$files_ref->{intersect_file_1}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
974 $cmd_line .= "rm $$files_ref->{intersect_dedup_file_1}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
975 $cmd_line .= "rm $$files_ref->{sam_on_target_alone_file_1}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
976 $cmd_line .= "rm $$files_ref->{sam_off_target_alone_file_1}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
977 $cmd_line .= "rm $$files_ref->{master_dedup_no_annotation_file_1}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
978 $cmd_line .= "rm $$files_ref->{master_dedup_prejoin_file_1}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
979 $cmd_line .= "rm $$files_ref->{master_dedup_file_1}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
980 $cmd_line .= "rm $$files_ref->{fusion_reads_file}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
981 $cmd_line .= "rm $$files_ref->{fusion_counts_file}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
982 $cmd_line .= "rm $$files_ref->{fusion_counts_bare_file}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
983 # $file = $$files_ref->{flanking_sequences_file} . ".tmp~";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
984 # $cmd_line .= "rm $file\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
985 # $file = $$files_ref->{flanking_splice_sequences_file} . ".tmp~";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
986 # $cmd_line .= "rm $file\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
987 $cmd_line .= "rm $$files_ref->{splice_counts_file}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
988 $cmd_line .= "rm $$files_ref->{splice_counts_bare_file}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
989 $cmd_line .= "rm $$files_ref->{fusion_counts_with_splice_bare_file}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
990 $cmd_line .= "rm $$files_ref->{fusion_counts_with_splice_bare_file_machine}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
991 $cmd_line .= "rm $$files_ref->{splice_reads_file}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
992 $cmd_line .= "rm $$files_ref->{sam_on_target_alone_file_1_linux_sorted}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
993 $cmd_line .= "rm $$files_ref->{sam_off_target_alone_file_1_linux_sorted}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
994 $cmd_line .= "rm $$files_ref->{sam_dedup_on_target_alone_file_1_linux_sorted}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
995 $cmd_line .= "rm $$files_ref->{sam_dedup_off_target_alone_file_1_linux_sorted}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
996 $cmd_line .= "rm $$files_ref->{housekeeping_dedup_file}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
997 $cmd_line .= "rm $$files_ref->{on_target_dedup_file}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
998 $cmd_line .= "rm $$files_ref->{reads_per_exon_dedup_file}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
999 $cmd_line .= "rm $$files_ref->{reads_per_exon_dedup_file_machine}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1000 $cmd_line .= "rm $$files_ref->{housekeeping_file}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1001 $cmd_line .= "rm $$files_ref->{on_target_file}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1002 $cmd_line .= "rm $$files_ref->{reads_per_exon_file}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1003 $cmd_line .= "rm $$files_ref->{sam_file_1_marked}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1004 $cmd_line .= "rm $$files_ref->{sam_dedup_file_1_marked}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1005 $cmd_line .= "rm $$files_ref->{bam_file_1_full}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1006 $cmd_line .= "rm $$files_ref->{bam_file_1_full_sorted}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1007 $cmd_line .= "rm $$files_ref->{sam_file_1_full_sorted}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1008 # $cmd_line .= "rm $$files_ref->{total_and_aligned_molecule_count_file_1}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1009 $cmd_line .= "rm $$files_ref->{total_and_aligned_molecule_count_per_tag_file}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1010 # $cmd_line .= "rm $$files_ref->{unique_and_aligned_molecule_count_file_1}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1011 $cmd_line .= "rm $$files_ref->{unique_and_aligned_molecule_count_per_tag_file}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1012 $cmd_line .= "rm $$files_ref->{bam_dedup_file_1_full}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1013 $cmd_line .= "rm $$files_ref->{bam_dedup_file_1_full_sorted}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1014 $cmd_line .= "rm $$files_ref->{sam_dedup_file_1_full_sorted}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1015 $cmd_line .= "rm $$files_ref->{qc_filter_file}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1016 $cmd_line .= "rm $$files_ref->{qc_filter_file_machine}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1017 $cmd_line .= "rm $$files_ref->{coverage_uniformity_file}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1018 $cmd_line .= "rm $$files_ref->{coverage_uniformity_file_machine}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1019 $cmd_line .= "rm $$files_ref->{counts_file}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1020 $cmd_line .= "rm $$files_ref->{counts_file_machine}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1021 # $cmd_line .= "rm $$files_ref->{summary_file_ps}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1022 if ( $$reads_ref eq 'paired' ) {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1023 $cmd_line .= "rm $$files_ref->{sam_file_2_full}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1024 $cmd_line .= "rm $$files_ref->{bam_file_2}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1025 $cmd_line .= "rm $$files_ref->{bed_file_2}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1026 $cmd_line .= "rm $$files_ref->{sam_dedup_file_2}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1027 $cmd_line .= "rm $$files_ref->{sam_dedup_file_2_full}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1028 $cmd_line .= "rm $$files_ref->{bam_dedup_file_2}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1029 $cmd_line .= "rm $$files_ref->{full_master_prejoin_file_2}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1030 $cmd_line .= "rm $$files_ref->{full_master_file_2}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1031 $cmd_line .= "rm $$files_ref->{full_master_dedup_prejoin_file_2}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1032 $cmd_line .= "rm $$files_ref->{full_master_dedup_file_2}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1033 $cmd_line .= "rm $$files_ref->{bed_points_file_2}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1034 $cmd_line .= "rm $$files_ref->{bed_points_dedup_file_2}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1035 $cmd_line .= "rm $$files_ref->{intersect_file_2}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1036 $cmd_line .= "rm $$files_ref->{intersect_dedup_file_2}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1037 $cmd_line .= "rm $$files_ref->{intersect_file_combined}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1038 $cmd_line .= "rm $$files_ref->{intersect_dedup_file_combined}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1039 $cmd_line .= "rm $$files_ref->{sam_dedup_on_target_alone_file_1}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1040 $cmd_line .= "rm $$files_ref->{sam_dedup_off_target_alone_file_1}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1041 $cmd_line .= "rm $$files_ref->{sam_on_target_file_1}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1042 $cmd_line .= "rm $$files_ref->{sam_off_target_file_1}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1043 $cmd_line .= "rm $$files_ref->{sam_on_target_file_2}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1044 $cmd_line .= "rm $$files_ref->{sam_off_target_file_2}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1045 $cmd_line .= "rm $$files_ref->{sam_on_target_alone_file_2}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1046 $cmd_line .= "rm $$files_ref->{sam_off_target_alone_file_2}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1047 $cmd_line .= "rm $$files_ref->{sam_dedup_on_target_alone_file_2}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1048 $cmd_line .= "rm $$files_ref->{sam_dedup_off_target_alone_file_2}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1049 $cmd_line .= "rm $$files_ref->{master_dedup_no_annotation_file_2}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1050 $cmd_line .= "rm $$files_ref->{master_dedup_prejoin_file_2}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1051 $cmd_line .= "rm $$files_ref->{master_dedup_file_2}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1052 $cmd_line .= "rm $$files_ref->{sam_on_target_file_1_linux_sorted}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1053 $cmd_line .= "rm $$files_ref->{sam_off_target_file_1_linux_sorted}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1054 $cmd_line .= "rm $$files_ref->{sam_dedup_on_target_file_1_linux_sorted}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1055 $cmd_line .= "rm $$files_ref->{sam_dedup_off_target_file_1_linux_sorted}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1056 $cmd_line .= "rm $$files_ref->{sam_on_target_alone_file_2_linux_sorted}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1057 $cmd_line .= "rm $$files_ref->{sam_off_target_alone_file_2_linux_sorted}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1058 $cmd_line .= "rm $$files_ref->{sam_dedup_on_target_alone_file_2_linux_sorted}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1059 $cmd_line .= "rm $$files_ref->{sam_dedup_off_target_alone_file_2_linux_sorted}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1060 $cmd_line .= "rm $$files_ref->{sam_on_target_file_2_linux_sorted}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1061 $cmd_line .= "rm $$files_ref->{sam_off_target_file_2_linux_sorted}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1062 $cmd_line .= "rm $$files_ref->{sam_dedup_on_target_file_2_linux_sorted}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1063 $cmd_line .= "rm $$files_ref->{sam_dedup_off_target_file_2_linux_sorted}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1064 $cmd_line .= "rm $$files_ref->{sam_file_2_marked}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1065 $cmd_line .= "rm $$files_ref->{sam_dedup_file_2_marked}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1066 $cmd_line .= "rm $$files_ref->{bam_file_2_full}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1067 $cmd_line .= "rm $$files_ref->{bam_file_2_full_sorted}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1068 $cmd_line .= "rm $$files_ref->{sam_file_2_full_sorted}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1069 # $cmd_line .= "rm $$files_ref->{total_and_aligned_molecule_count_file_2}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1070 # $cmd_line .= "rm $$files_ref->{unique_and_aligned_molecule_count_file_2}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1071 $cmd_line .= "rm $$files_ref->{bam_dedup_file_2_full}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1072 $cmd_line .= "rm $$files_ref->{bam_dedup_file_2_full_sorted}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1073 $cmd_line .= "rm $$files_ref->{sam_dedup_file_2_full_sorted}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1074 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1075
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1076 return $cmd_line;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1077 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1078
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1079
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1080 sub summary_for_unprocessed_sample {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1081 my $reads_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1082 my $fastq_file_1_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1083 my $fastq_file_2_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1084 my $parameters_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1085 my $files_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1086 my $cmd_line = "echo Summary for Unprocessed Sample\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1087 $cmd_line .= "$$parameters_ref->{path}/summary_for_unprocessed_samples.pl -r $$reads_ref -f1 $$fastq_file_1_ref -f2 $$fastq_file_2_ref -o $$files_ref->{summary_file} -om $$files_ref->{summary_file_machine}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1088 # $cmd_line .= "enscript -f Courier8 -p $$files_ref->{summary_file_ps} $$files_ref->{summary_file}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1089 # $cmd_line .= "ps2pdf $$files_ref->{summary_file_ps} $$files_ref->{summary_file_pdf}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1090 return $cmd_line;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1091 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1092
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1093
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1094 sub join_multiple_samples {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1095 my $parameters_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1096 my $cmd_line = "echo Join Multiple Samples\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1097 $cmd_line = "$$parameters_ref->{path}/join_multisample_output.pl -config $$parameters_ref->{config_file} -o $$parameters_ref->{outputfile}\n";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1098 return $cmd_line;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1099 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1100
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1101 #sub define_alignment_file_names {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1102 # my $reads_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1103 # my $tags_array_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1104 # my $parameters_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1105 # my $files_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1106 # $$files_ref->{sam_file_1} = $$parameters_ref->{directory} . "/" . @$tags_array_ref[0] . ".sam";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1107 # $$files_ref->{sam_file_1_full} = $$parameters_ref->{directory} . "/" . @$tags_array_ref[0] . ".sam.full";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1108 # if ( $$reads_ref eq 'paired' ) {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1109 # $$files_ref->{sam_file_2} = $$parameters_ref->{directory} . "/" . @$tags_array_ref[1] . ".sam";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1110 # $$files_ref->{sam_file_2_full} = $$parameters_ref->{directory} . "/" . @$tags_array_ref[1] . ".sam.full";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1111 # }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1112 #}
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1113
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1114 sub define_alignments_file_names {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1115 my $reads_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1116 my $tags_array_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1117 my $tag_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1118 my $parameters_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1119 my $files_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1120 $$files_ref->{sam_file_1_orig} = $$parameters_ref->{directory} . "/" . @$tags_array_ref[0] . ".fastq.sam";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1121 $$files_ref->{sam_file_1_full} = $$parameters_ref->{directory} . "/" . @$tags_array_ref[0] . ".sam.full";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1122 $$files_ref->{sam_file_1} = $$parameters_ref->{directory} . "/" . @$tags_array_ref[0] . ".sam";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1123 $$files_ref->{bam_file_1} = $$parameters_ref->{directory} . "/" . @$tags_array_ref[0] . ".bam";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1124 $$files_ref->{bed_file_1_orig} = $$parameters_ref->{directory} . "/" . @$tags_array_ref[0] . ".bed.orig";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1125 if ( $$reads_ref eq 'paired' ) {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1126 $$files_ref->{sam_file_2_orig} = $$parameters_ref->{directory} . "/" . @$tags_array_ref[1] . ".fastq.sam";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1127 $$files_ref->{sam_file_2_full} = $$parameters_ref->{directory} . "/" . @$tags_array_ref[1] . ".sam.full";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1128 $$files_ref->{sam_file_2} = $$parameters_ref->{directory} . "/" . @$tags_array_ref[1] . ".sam";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1129 $$files_ref->{bam_file_2} = $$parameters_ref->{directory} . "/" . @$tags_array_ref[1] . ".bam";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1130 $$files_ref->{bed_file_2_orig} = $$parameters_ref->{directory} . "/" . @$tags_array_ref[1] . ".bed.orig";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1131 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1132 $$files_ref->{bed_file_combined} = $$parameters_ref->{directory} . "/" . $$tag_ref . ".combined.bed";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1133 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1134
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1135 sub define_de_duplication_file_names {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1136 my $reads_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1137 my $tags_array_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1138 my $tag_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1139 my $parameters_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1140 my $files_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1141 $$files_ref->{dedup_file} = $$parameters_ref->{directory} . "/" . $$tag_ref . ".dedup_read_ids.dat";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1142 $$files_ref->{sam_dedup_file_1} = $$parameters_ref->{directory} . "/" . @$tags_array_ref[0] . ".sam.dedup";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1143 $$files_ref->{sam_dedup_file_1_full} = $$parameters_ref->{directory} . "/" . @$tags_array_ref[0] . ".dedup.sam.full";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1144 if ( $$reads_ref eq 'paired' ) {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1145 $$files_ref->{sam_dedup_file_2} = $$parameters_ref->{directory} . "/" . @$tags_array_ref[1] . ".sam.dedup";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1146 $$files_ref->{sam_dedup_file_2_full} = $$parameters_ref->{directory} . "/" . @$tags_array_ref[1] . ".dedup.sam.full";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1147 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1148 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1149
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1150 sub define_on_and_off_target_file_names {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1151 my $reads_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1152 my $tags_array_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1153 my $tag_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1154 my $parameters_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1155 my $files_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1156 # File 1
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1157 $$files_ref->{target_regions_bed_file} = $$parameters_ref->{directory} . "/target_regions.bed";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1158 $$files_ref->{full_master_prejoin_file_1} = $$parameters_ref->{directory} . "/" . @$tags_array_ref[0] . ".full.prejoin.master.dat";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1159 $$files_ref->{full_master_file_1} = $$parameters_ref->{directory} . "/" . @$tags_array_ref[0] . ".full.master.dat";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1160 $$files_ref->{bed_file_1} = $$parameters_ref->{directory} . "/" . @$tags_array_ref[0] . ".bed";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1161 $$files_ref->{bed_points_file_1} = $$parameters_ref->{directory} . "/" . @$tags_array_ref[0] . ".points.bed";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1162 $$files_ref->{intersect_file_1} = $$parameters_ref->{directory} . "/" . @$tags_array_ref[0] . ".intersect.dat";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1163 $$files_ref->{sam_on_target_alone_file_1} = $$parameters_ref->{directory} . "/" . @$tags_array_ref[0] . ".on_target.alone.sam";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1164 $$files_ref->{sam_file_1_marked} = $$parameters_ref->{directory} . "/" . @$tags_array_ref[0] . ".sam.marked";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1165 $$files_ref->{sam_off_target_alone_file_1} = $$parameters_ref->{directory} . "/" . @$tags_array_ref[0] . ".off_target.alone.sam";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1166 $$files_ref->{sam_on_target_file_1} = $$parameters_ref->{directory} . "/" . @$tags_array_ref[0] . ".on_target.sam";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1167 $$files_ref->{sam_off_target_file_1} = $$parameters_ref->{directory} . "/" . @$tags_array_ref[0] . ".off_target.sam";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1168 # File 1 Dedup
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1169 $$files_ref->{full_master_dedup_prejoin_file_1} = $$parameters_ref->{directory} . "/" . @$tags_array_ref[0] . ".full.dedup.prejoin.master.dat";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1170 $$files_ref->{full_master_dedup_file_1} = $$parameters_ref->{directory} . "/" . @$tags_array_ref[0] . ".full.dedup.master.dat";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1171 $$files_ref->{bed_dedup_file_1} = $$parameters_ref->{directory} . "/" . @$tags_array_ref[0] . ".dedup.bed";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1172 $$files_ref->{bed_points_dedup_file_1} = $$parameters_ref->{directory} . "/" . @$tags_array_ref[0] . ".dedup.points.bed";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1173 $$files_ref->{intersect_dedup_file_1} = $$parameters_ref->{directory} . "/" . @$tags_array_ref[0] . ".dedup.intersect.dat";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1174 $$files_ref->{sam_dedup_on_target_alone_file_1} = $$parameters_ref->{directory} . "/" . @$tags_array_ref[0] . ".dedup.on_target.alone.sam";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1175 $$files_ref->{sam_dedup_file_1_marked} = $$parameters_ref->{directory} . "/" . @$tags_array_ref[0] . ".sam.dedup.marked";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1176 $$files_ref->{sam_dedup_off_target_alone_file_1} = $$parameters_ref->{directory} . "/" . @$tags_array_ref[0] . ".dedup.off_target.alone.sam";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1177 $$files_ref->{sam_dedup_on_target_file_1} = $$parameters_ref->{directory} . "/" . @$tags_array_ref[0] . ".dedup.on_target.sam";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1178 $$files_ref->{sam_dedup_off_target_file_1} = $$parameters_ref->{directory} . "/" . @$tags_array_ref[0] . ".dedup.off_target.sam";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1179 # File 2
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1180 if ( $$reads_ref eq 'paired' ) {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1181 $$files_ref->{full_master_prejoin_file_2} = $$parameters_ref->{directory} . "/" . @$tags_array_ref[1] . ".full.prejoin.master.dat";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1182 $$files_ref->{full_master_file_2} = $$parameters_ref->{directory} . "/" . @$tags_array_ref[1] . ".full.master.dat";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1183 $$files_ref->{bed_file_2} = $$parameters_ref->{directory} . "/" . @$tags_array_ref[1] . ".bed";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1184 $$files_ref->{bed_points_file_2} = $$parameters_ref->{directory} . "/" . @$tags_array_ref[1] . ".points.bed";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1185 $$files_ref->{intersect_file_2} = $$parameters_ref->{directory} . "/" . @$tags_array_ref[1] . ".intersect.dat";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1186 $$files_ref->{sam_on_target_alone_file_2} = $$parameters_ref->{directory} . "/" . @$tags_array_ref[1] . ".on_target.alone.sam";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1187 $$files_ref->{sam_file_2_marked} = $$parameters_ref->{directory} . "/" . @$tags_array_ref[1] . ".sam.marked";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1188 $$files_ref->{sam_off_target_alone_file_2} = $$parameters_ref->{directory} . "/" . @$tags_array_ref[1] . ".off_target.alone.sam";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1189 $$files_ref->{sam_on_target_file_2} = $$parameters_ref->{directory} . "/" . @$tags_array_ref[1] . ".on_target.sam";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1190 $$files_ref->{sam_off_target_file_2} = $$parameters_ref->{directory} . "/" . @$tags_array_ref[1] . ".off_target.sam";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1191 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1192 # File 2 Dedup
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1193 if ( $$reads_ref eq 'paired' ) {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1194 $$files_ref->{full_master_dedup_prejoin_file_2} = $$parameters_ref->{directory} . "/" . @$tags_array_ref[1] . ".full.dedup.prejoin.master.dat";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1195 $$files_ref->{full_master_dedup_file_2} = $$parameters_ref->{directory} . "/" . @$tags_array_ref[1] . ".full.dedup.master.dat";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1196 $$files_ref->{bed_dedup_file_2} = $$parameters_ref->{directory} . "/" . @$tags_array_ref[1] . ".dedup.bed";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1197 $$files_ref->{bed_points_dedup_file_2} = $$parameters_ref->{directory} . "/" . @$tags_array_ref[1] . ".dedup.points.bed";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1198 $$files_ref->{intersect_dedup_file_2} = $$parameters_ref->{directory} . "/" . @$tags_array_ref[1] . ".dedup.intersect.dat";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1199 $$files_ref->{sam_dedup_on_target_alone_file_2} = $$parameters_ref->{directory} . "/" . @$tags_array_ref[1] . ".dedup.on_target.alone.sam";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1200 $$files_ref->{sam_dedup_file_2_marked} = $$parameters_ref->{directory} . "/" . @$tags_array_ref[1] . ".sam.dedup.marked";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1201 $$files_ref->{sam_dedup_off_target_alone_file_2} = $$parameters_ref->{directory} . "/" . @$tags_array_ref[1] . ".dedup.off_target.alone.sam";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1202 $$files_ref->{sam_dedup_on_target_file_2} = $$parameters_ref->{directory} . "/" . @$tags_array_ref[1] . ".dedup.on_target.sam";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1203 $$files_ref->{sam_dedup_off_target_file_2} = $$parameters_ref->{directory} . "/" . @$tags_array_ref[1] . ".dedup.off_target.sam";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1204 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1205 $$files_ref->{intersect_file_combined} = $$parameters_ref->{directory} . "/" . $$tag_ref . ".intersect_combined.dat";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1206 $$files_ref->{intersect_dedup_file_combined} = $$parameters_ref->{directory} . "/" . $$tag_ref . ".dedup.intersect_combined.dat";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1207 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1208
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1209 sub define_coverage_and_start_site_file_names {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1210 my $reads_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1211 my $tags_array_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1212 my $parameters_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1213 my $files_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1214 $$files_ref->{start_site_dedup_file_1} = $$parameters_ref->{directory} . "/" . @$tags_array_ref[0] . ".dedup.start_site.bedgraph";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1215 $$files_ref->{coverage_dedup_file_1} = $$parameters_ref->{directory} . "/" . @$tags_array_ref[0] . ".dedup.coverage.bedgraph";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1216 if ( $$reads_ref eq 'paired' ) {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1217 $$files_ref->{start_site_dedup_file_2} = $$parameters_ref->{directory} . "/" . @$tags_array_ref[1] . ".dedup.start_site.bedgraph";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1218 $$files_ref->{coverage_dedup_file_2} = $$parameters_ref->{directory} . "/" . @$tags_array_ref[1] . ".dedup.coverage.bedgraph";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1219 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1220 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1221
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1222 sub define_master_files_file_names {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1223 my $reads_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1224 my $tags_array_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1225 my $parameters_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1226 my $files_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1227 $$files_ref->{master_dedup_no_annotation_file_1} = $$parameters_ref->{directory} . "/" . @$tags_array_ref[0] . ".dedup.no_annotation.master.dat";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1228 $$files_ref->{master_dedup_prejoin_file_1} = $$parameters_ref->{directory} . "/" . @$tags_array_ref[0] . ".dedup.prejoin.master.dat";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1229 $$files_ref->{master_dedup_file_1} = $$parameters_ref->{directory} . "/" . @$tags_array_ref[0] . ".dedup.master.dat";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1230 if ( $$reads_ref eq 'paired' ) {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1231 $$files_ref->{master_dedup_no_annotation_file_2} = $$parameters_ref->{directory} . "/" . @$tags_array_ref[1] . ".dedup.no_annotation.master.dat";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1232 $$files_ref->{master_dedup_prejoin_file_2} = $$parameters_ref->{directory} . "/" . @$tags_array_ref[1] . ".dedup.prejoin.master.dat";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1233 $$files_ref->{master_dedup_file_2} = $$parameters_ref->{directory} . "/" . @$tags_array_ref[1] . ".dedup.master.dat";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1234 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1235 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1236
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1237 sub define_fusion_reads_file_names {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1238 my $reads_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1239 my $tags_array_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1240 my $tag_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1241 my $parameters_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1242 my $files_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1243 $$files_ref->{one_segment_reads_file_1} = $$parameters_ref->{directory} . "/" . @$tags_array_ref[0] . ".one_segment_reads.dat";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1244 $$files_ref->{splice_reads_file_1} = $$parameters_ref->{directory} . "/" . @$tags_array_ref[0] . ".splice_reads.dat";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1245 $$files_ref->{fusion_reads_file_1} = $$parameters_ref->{directory} . "/" . @$tags_array_ref[0] . ".fusion_reads.dat";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1246 $$files_ref->{multi_fusion_reads_file_1} = $$parameters_ref->{directory} . "/" . @$tags_array_ref[0] . ".multi_fusion_reads.dat";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1247 if ( $$reads_ref eq 'paired' ) {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1248 $$files_ref->{one_segment_reads_file_2} = $$parameters_ref->{directory} . "/" . @$tags_array_ref[1] . ".one_segment_reads.dat";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1249 $$files_ref->{splice_reads_file_2} = $$parameters_ref->{directory} . "/" . @$tags_array_ref[1] . ".splice_reads.dat";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1250 $$files_ref->{fusion_reads_file_2} = $$parameters_ref->{directory} . "/" . @$tags_array_ref[1] . ".fusion_reads.dat";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1251 $$files_ref->{multi_fusion_reads_file_2} = $$parameters_ref->{directory} . "/" . @$tags_array_ref[1] . ".multi_fusion_reads.dat";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1252 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1253 $$files_ref->{fusion_reads_file} = $$parameters_ref->{directory} . "/" . $$tag_ref . ".fusion_reads.combined.dat";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1254 $$files_ref->{splice_reads_file} = $$parameters_ref->{directory} . "/" . $$tag_ref . ".splice_reads.combined.dat";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1255 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1256
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1257 sub define_count_fusions_file_names {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1258 my $tag_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1259 my $parameters_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1260 my $files_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1261 $$files_ref->{fusion_counts_bare_file} = $$parameters_ref->{directory} . "/" . $$tag_ref . ".fusion_counts_bare.dat";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1262 $$files_ref->{fusion_counts_file} = $$parameters_ref->{directory} . "/" . $$tag_ref . ".fusion_counts.dat";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1263 $$files_ref->{splice_counts_bare_file} = $$parameters_ref->{directory} . "/" . $$tag_ref . ".splice_counts_bare.dat";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1264 $$files_ref->{splice_counts_file} = $$parameters_ref->{directory} . "/" . $$tag_ref . ".splice_counts.dat";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1265 $$files_ref->{fusion_counts_with_splice_bare_file} = $$parameters_ref->{directory} . "/" . $$tag_ref . ".fusion_counts_with_splice_bare.dat";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1266 $$files_ref->{fusion_counts_with_splice_bare_file_machine} = $$parameters_ref->{directory} . "/" . $$tag_ref . ".fusion_counts_with_splice_bare.machine.dat";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1267 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1268
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1269 sub define_flanking_sequences_file_names {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1270 my $tag_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1271 my $parameters_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1272 my $files_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1273 $$files_ref->{flanking_sequences_file} = $$parameters_ref->{directory} . "/" . $$tag_ref . ".flanking_sequences.dat";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1274 $$files_ref->{flanking_splice_sequences_file} = $$parameters_ref->{directory} . "/" . $$tag_ref . ".flanking_splice_sequences.dat";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1275 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1276
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1277 sub define_consensus_sequences_file_names {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1278 my $tag_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1279 my $parameters_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1280 my $files_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1281 $$files_ref->{consensus_fusion_std_out_file} = $$parameters_ref->{directory} . "/" . $$tag_ref . ".consensus_fusion_std_out.dat";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1282 $$files_ref->{consensus_fusion_std_err_file} = $$parameters_ref->{directory} . "/" . $$tag_ref . ".consensus_fusion_std_err.dat";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1283 $$files_ref->{consensus_splice_std_out_file} = $$parameters_ref->{directory} . "/" . $$tag_ref . ".consensus_splice_std_out.dat";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1284 $$files_ref->{consensus_splice_std_err_file} = $$parameters_ref->{directory} . "/" . $$tag_ref . ".consensus_splice_std_err.dat";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1285 $$files_ref->{fusion_and_splice_consensus_file} = $$parameters_ref->{directory} . "/" . $$tag_ref . ".fusion_and_splice_consensus_sequences.fasta";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1286 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1287
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1288 sub define_bam_dedup_files_file_names {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1289 my $reads_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1290 my $tags_array_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1291 my $parameters_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1292 my $files_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1293 $$files_ref->{bam_dedup_file_1} = $$parameters_ref->{directory} . "/" . $$tags_array_ref[0] . ".dedup.bam";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1294 $$files_ref->{bam_dedup_sorted_file_1_name} = $$parameters_ref->{directory} . "/" . $$tags_array_ref[0] . ".dedup.sorted";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1295 $$files_ref->{bam_dedup_sorted_file_1} = $$parameters_ref->{directory} . "/" . $$tags_array_ref[0] . ".dedup.sorted.bam";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1296 if ( $$reads_ref eq 'paired' ) {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1297 $$files_ref->{bam_dedup_file_2} = $$parameters_ref->{directory} . "/" . $$tags_array_ref[1] . ".dedup.bam";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1298 $$files_ref->{bam_dedup_sorted_file_2_name} = $$parameters_ref->{directory} . "/" . $$tags_array_ref[1] . ".dedup.sorted";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1299 $$files_ref->{bam_dedup_sorted_file_2} = $$parameters_ref->{directory} . "/" . $$tags_array_ref[1] . ".dedup.sorted.bam";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1300 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1301 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1302
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1303 sub define_sort_sam_files_file_names {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1304 my $reads_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1305 my $tags_array_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1306 my $parameters_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1307 my $files_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1308 $$files_ref->{sam_on_target_alone_file_1_linux_sorted} = $$parameters_ref->{directory} . "/" . @$tags_array_ref[0] . ".on_target.alone.linux_sorted.sam";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1309 $$files_ref->{sam_off_target_alone_file_1_linux_sorted} = $$parameters_ref->{directory} . "/" . @$tags_array_ref[0] . ".off_target.alone.linux_sorted.sam";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1310 $$files_ref->{sam_dedup_on_target_alone_file_1_linux_sorted} = $$parameters_ref->{directory} . "/" . @$tags_array_ref[0] . ".dedup.on_target.alone.linux_sorted.sam";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1311 $$files_ref->{sam_dedup_off_target_alone_file_1_linux_sorted} = $$parameters_ref->{directory} . "/" . @$tags_array_ref[0] . ".dedup.off_target.alone.linux_sorted.sam";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1312 $$files_ref->{sam_on_target_file_1_linux_sorted} = $$parameters_ref->{directory} . "/" . @$tags_array_ref[0] . ".on_target.linux_sorted.sam";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1313 $$files_ref->{sam_off_target_file_1_linux_sorted} = $$parameters_ref->{directory} . "/" . @$tags_array_ref[0] . ".off_target.linux_sorted.sam";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1314 $$files_ref->{sam_dedup_on_target_file_1_linux_sorted} = $$parameters_ref->{directory} . "/" . @$tags_array_ref[0] . ".dedup.on_target.linux_sorted.sam";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1315 $$files_ref->{sam_dedup_off_target_file_1_linux_sorted} = $$parameters_ref->{directory} . "/" . @$tags_array_ref[0] . ".dedup.off_target.linux_sorted.sam";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1316 if ( $$reads_ref eq 'paired' ) {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1317 $$files_ref->{sam_on_target_alone_file_2_linux_sorted} = $$parameters_ref->{directory} . "/" . @$tags_array_ref[1] . ".on_target.alone.linux_sorted.sam";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1318 $$files_ref->{sam_off_target_alone_file_2_linux_sorted} = $$parameters_ref->{directory} . "/" . @$tags_array_ref[1] . ".off_target.alone.linux_sorted.sam";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1319 $$files_ref->{sam_dedup_on_target_alone_file_2_linux_sorted} = $$parameters_ref->{directory} . "/" . @$tags_array_ref[1] . ".dedup.on_target.alone.linux_sorted.sam";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1320 $$files_ref->{sam_dedup_off_target_alone_file_2_linux_sorted} = $$parameters_ref->{directory} . "/" . @$tags_array_ref[1] . ".dedup.off_target.alone.linux_sorted.sam";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1321 $$files_ref->{sam_on_target_file_2_linux_sorted} = $$parameters_ref->{directory} . "/" . @$tags_array_ref[1] . ".on_target.linux_sorted.sam";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1322 $$files_ref->{sam_off_target_file_2_linux_sorted} = $$parameters_ref->{directory} . "/" . @$tags_array_ref[1] . ".off_target.linux_sorted.sam";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1323 $$files_ref->{sam_dedup_on_target_file_2_linux_sorted} = $$parameters_ref->{directory} . "/" . @$tags_array_ref[1] . ".dedup.on_target.linux_sorted.sam";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1324 $$files_ref->{sam_dedup_off_target_file_2_linux_sorted} = $$parameters_ref->{directory} . "/" . @$tags_array_ref[1] . ".dedup.off_target.linux_sorted.sam";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1325 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1326
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1327 $$files_ref->{bam_file_1_full} = $$parameters_ref->{directory} . "/" . @$tags_array_ref[0] . ".bam.full";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1328 $$files_ref->{bam_file_1_full_prefix} = $$parameters_ref->{directory} . "/" . @$tags_array_ref[0] . ".bam.full.prefix";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1329 $$files_ref->{bam_file_1_full_sorted} = $$files_ref->{bam_file_1_full_prefix} . ".bam";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1330 $$files_ref->{sam_file_1_full_sorted} = $$parameters_ref->{directory} . "/" . @$tags_array_ref[0] . ".sam.full.sorted";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1331 if ( $$reads_ref eq 'paired' ) {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1332 $$files_ref->{bam_file_2_full} = $$parameters_ref->{directory} . "/" . @$tags_array_ref[1] . ".bam.full";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1333 $$files_ref->{bam_file_2_full_prefix} = $$parameters_ref->{directory} . "/" . @$tags_array_ref[1] . ".bam.full.prefix";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1334 $$files_ref->{bam_file_2_full_sorted} = $$files_ref->{bam_file_2_full_prefix} . ".bam";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1335 $$files_ref->{sam_file_2_full_sorted} = $$parameters_ref->{directory} . "/" . @$tags_array_ref[1] . ".sam.full.sorted";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1336 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1337
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1338 $$files_ref->{bam_dedup_file_1_full} = $$parameters_ref->{directory} . "/" . @$tags_array_ref[0] . ".dedup.bam.full";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1339 $$files_ref->{bam_dedup_file_1_full_prefix} = $$parameters_ref->{directory} . "/" . @$tags_array_ref[0] . ".dedup.bam.full.prefix";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1340 $$files_ref->{bam_dedup_file_1_full_sorted} = $$files_ref->{bam_dedup_file_1_full_prefix} . ".bam";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1341 $$files_ref->{sam_dedup_file_1_full_sorted} = $$parameters_ref->{directory} . "/" . @$tags_array_ref[0] . ".dedup.sam.full.sorted";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1342 if ( $$reads_ref eq 'paired' ) {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1343 $$files_ref->{bam_dedup_file_2_full} = $$parameters_ref->{directory} . "/" . @$tags_array_ref[1] . ".dedup.bam.full";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1344 $$files_ref->{bam_dedup_file_2_full_prefix} = $$parameters_ref->{directory} . "/" . @$tags_array_ref[1] . ".dedup.bam.full.prefix";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1345 $$files_ref->{bam_dedup_file_2_full_sorted} = $$files_ref->{bam_dedup_file_2_full_prefix} . ".bam";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1346 $$files_ref->{sam_dedup_file_2_full_sorted} = $$parameters_ref->{directory} . "/" . @$tags_array_ref[1] . ".dedup.sam.full.sorted";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1347 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1348 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1349
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1350 sub define_on_target_stats_file_names {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1351 my $tag_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1352 my $parameters_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1353 my $files_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1354 $$files_ref->{on_target_file} = $$parameters_ref->{directory} . "/" . $$tag_ref . ".on_target.dat";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1355 $$files_ref->{on_target_dedup_file} = $$parameters_ref->{directory} . "/" . $$tag_ref . ".dedup.on_target.dat";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1356 $$files_ref->{reads_per_exon_file} = $$parameters_ref->{directory} . "/" . $$tag_ref . ".reads_per_exon.dat";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1357 $$files_ref->{housekeeping_file} = $$parameters_ref->{directory} . "/" . $$tag_ref . ".housekeeping.dat";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1358 $$files_ref->{reads_per_exon_dedup_file} = $$parameters_ref->{directory} . "/" . $$tag_ref . ".dedup.reads_per_exon.dat";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1359 $$files_ref->{housekeeping_dedup_file} = $$parameters_ref->{directory} . "/" . $$tag_ref . ".housekeeping.dedup.dat";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1360 $$files_ref->{reads_per_exon_dedup_file_machine} = $$parameters_ref->{directory} . "/" . $$tag_ref . ".dedup.reads_per_exon.machine.dat";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1361 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1362
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1363 sub define_total_molecule_counts_file_names {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1364 my $reads_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1365 my $tags_array_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1366 my $tag_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1367 my $parameters_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1368 my $files_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1369 $$files_ref->{total_and_aligned_molecule_count_file_1} = $$parameters_ref->{directory} . "/" . @$tags_array_ref[0] . ".total_and_aligned_molecule_count.dat";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1370 if ( $$reads_ref eq 'paired' ) {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1371 $$files_ref->{total_and_aligned_molecule_count_file_2} = $$parameters_ref->{directory} . "/" . @$tags_array_ref[1] . ".total_and_aligned_molecule_count.dat";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1372 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1373 $$files_ref->{total_and_aligned_molecule_count_per_tag_file} = $$parameters_ref->{directory} . "/" . $$tag_ref . ".per_tag.total_and_aligned_molecule_count.dat";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1374 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1375
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1376 sub define_de_deduplicated_molecule_counts_file_names {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1377 my $reads_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1378 my $tags_array_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1379 my $tag_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1380 my $parameters_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1381 my $files_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1382 $$files_ref->{unique_and_aligned_molecule_count_file_1} = $$parameters_ref->{directory} . "/" . @$tags_array_ref[0] . ".unique_and_aligned_molecule_count.dat";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1383 if ( $$reads_ref eq 'paired' ) {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1384 $$files_ref->{unique_and_aligned_molecule_count_file_2} = $$parameters_ref->{directory} . "/" . @$tags_array_ref[1] . ".unique_and_aligned_molecule_count.dat";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1385 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1386 $$files_ref->{unique_and_aligned_molecule_count_per_tag_file} = $$parameters_ref->{directory} . "/" . $$tag_ref . ".per_tag.unique_and_aligned_molecule_count.dat";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1387 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1388
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1389 sub define_all_molecule_counts_file_names {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1390 my $tag_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1391 my $parameters_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1392 my $files_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1393 $$files_ref->{counts_file} = $$parameters_ref->{directory} . "/" . $$tag_ref . ".counts.dat";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1394 $$files_ref->{counts_file_machine} = $$parameters_ref->{directory} . "/" . $$tag_ref . ".counts.machine.dat";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1395 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1396
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1397
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1398 sub define_qc_check_file_names {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1399 my $tag_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1400 my $parameters_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1401 my $files_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1402 $$files_ref->{qc_filter_file} = $$parameters_ref->{directory} . "/" . $$tag_ref . ".qc_filter.dat";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1403 $$files_ref->{qc_filter_file_machine} = $$parameters_ref->{directory} . "/" . $$tag_ref . ".qc_filter.machine.dat";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1404 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1405
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1406 sub define_coverage_uniformity_file_names {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1407 my $tag_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1408 my $parameters_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1409 my $files_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1410 $$files_ref->{coverage_uniformity_file} = $$parameters_ref->{directory} . "/" . $$tag_ref . ".coverage_uniformity.dat";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1411 $$files_ref->{coverage_uniformity_file_machine} = $$parameters_ref->{directory} . "/" . $$tag_ref . ".coverage_uniformity.machine.dat";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1412 }
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1413
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1414 sub define_summary_file_names {
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1415 my $tag_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1416 my $parameters_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1417 my $files_ref = shift;
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1418 $$files_ref->{summary_file} = $$parameters_ref->{directory} . "/" . $$tag_ref . ".summary.dat";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1419 $$files_ref->{summary_file_ps} = $$parameters_ref->{directory} . "/" . $$tag_ref . ".summary.ps";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1420 $$files_ref->{summary_file_pdf} = $$parameters_ref->{directory} . "/" . $$tag_ref . ".summary.pdf";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1421 $$files_ref->{summary_file_machine} = $$parameters_ref->{directory} . "/" . $$tag_ref . ".summary.machine.dat";
3af9b7634b2d Uploaded
plus
parents:
diff changeset
1422 }