Skip to content

Commit b4ce86d

Browse files
committed
Merge branch 'release-0.8.5b-beta'.
Incorporate assorted bug fixes into master.
2 parents 9c917d6 + ff2a505 commit b4ce86d

45 files changed

Lines changed: 182 additions & 173 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

norm_scripts/cat_shuffiles.pl

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -74,20 +74,20 @@
7474
}
7575
my $norm_exon_dir = $norm_dir . "/exonmappers";
7676
unless (-d $norm_exon_dir){
77-
`mkdir $norm_exon_dir`;
77+
`mkdir -p $norm_exon_dir`;
7878
}
7979

8080
my $norm_intron_dir = $norm_dir . "/intronmappers";
8181
unless (-d $norm_intron_dir){
82-
`mkdir $norm_intron_dir`;
82+
`mkdir -p $norm_intron_dir`;
8383
}
8484
my $norm_ig_dir = $norm_dir . "/intergenicmappers";
8585
unless (-d $norm_ig_dir){
86-
`mkdir $norm_ig_dir`;
86+
`mkdir -p $norm_ig_dir`;
8787
}
8888
my $norm_und_dir = $norm_dir . "/exon_inconsistent";
8989
unless (-d $norm_und_dir){
90-
`mkdir $norm_und_dir`;
90+
`mkdir -p $norm_und_dir`;
9191
}
9292

9393
my @g;
@@ -214,16 +214,16 @@
214214
}
215215
if ($stranded eq "true"){
216216
unless (-d "$norm_exon_dir/sense"){
217-
`mkdir $norm_exon_dir/sense`;
217+
`mkdir -p $norm_exon_dir/sense`;
218218
}
219219
unless (-d "$norm_exon_dir/antisense"){
220-
`mkdir $norm_exon_dir/antisense`;
220+
`mkdir -p $norm_exon_dir/antisense`;
221221
}
222222
unless (-d "$norm_intron_dir/sense"){
223-
`mkdir $norm_intron_dir/sense`;
223+
`mkdir -p $norm_intron_dir/sense`;
224224
}
225225
unless (-d "$norm_intron_dir/antisense"){
226-
`mkdir $norm_intron_dir/antisense`;
226+
`mkdir -p $norm_intron_dir/antisense`;
227227
}
228228
if ($numargs eq "0"){
229229
unless (-d "$current_LOC/EIJ/Unique/sense/"){

norm_scripts/filter_sam_gnorm.pl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,18 +113,18 @@
113113
";
114114
}
115115
unless (-d $outfiledir){
116-
`mkdir $outfiledir`;
116+
`mkdir -p $outfiledir`;
117117
}
118118
my ($OUTFILEU, $OUTFILENU);
119119
if ($U eq "true"){
120120
unless(-d "$outfiledir/Unique"){
121-
`mkdir $outfiledir/Unique`;
121+
`mkdir -p $outfiledir/Unique`;
122122
}
123123
open($OUTFILEU, "| /bin/gzip -c > $outfileU.gz") or die "file '$outfileU.gz' cannot open for writing\n"; # the output file
124124
}
125125
if ($NU eq "true"){
126126
unless(-d "$outfiledir/NU"){
127-
`mkdir $outfiledir/NU`;
127+
`mkdir -p $outfiledir/NU`;
128128
}
129129
open($OUTFILENU, "| /bin/gzip -c > $outfileNU.gz") or die "file '$outfileNU.gz' cannot open for writing\n";
130130
}

norm_scripts/get_genepercents.pl

Lines changed: 87 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,6 @@
110110
if ($se eq "false"){
111111
$total_u = int($total_u / 2);
112112
}
113-
else{
114-
$total_u--;
115-
}
116113
}
117114
else{
118115
die "cannot find file '$filter_u'\n";
@@ -140,9 +137,6 @@
140137
if ($se eq "false"){
141138
$total_u_a = int($total_u_a/ 2);
142139
}
143-
else{
144-
$total_u_a--;
145-
}
146140
}
147141
else{
148142
die "cannot find file '$filter_u_a'\n";
@@ -172,9 +166,6 @@
172166
if ($se eq "false"){
173167
$total_nu = int($total_nu/ 2);
174168
}
175-
else{
176-
$total_nu--;
177-
}
178169
}
179170
else{
180171
die "cannot find file '$filter_nu'\n";
@@ -202,9 +193,6 @@
202193
if ($se eq "false"){
203194
$total_nu_a = int($total_nu_a/ 2);
204195
}
205-
else{
206-
$total_nu_a--;
207-
}
208196
}
209197
else{
210198
die "cannot find file '$filter_nu_a'\n";
@@ -227,104 +215,120 @@
227215
}
228216

229217
if($U eq "true"){
230-
open(IN_U, $temp_u);
231-
open(OUT, ">$outfile");
232-
open(OUT2, ">$highfile");
233-
print OUT "ensGene\t%gene\tgeneSymbol\tgeneCoordinates\n";
234-
print OUT2 "ensGene\t%gene\tgeneSymbol\tgeneCoordinates\n";
235-
while(my $line_U = <IN_U>){
236-
chomp($line_U);
237-
my @au = split(/\t/, $line_U);
238-
my $geneu = $au[0];
239-
my $quantu = $au[1];
240-
my $sym = $au[3];
241-
my $coord = $au[4];
242-
my $percent_u = int(($quantu / $total_u)* 10000 ) / 100;
243-
$percent_u = sprintf("%.2f", $percent_u);
244-
print OUT "$geneu\t$percent_u\t$sym\t$coord\n";
245-
if ($percent_u >= $cutoff){
246-
print OUT2 "$geneu\t$percent_u\t$sym\t$coord\n";
247-
}
248-
}
249-
close(IN_U);
250-
close(OUT);
251-
close(OUT2);
252-
`rm $temp_u`;
253-
if ($stranded eq "true"){
254-
open(IN_U_A, $temp_u_a);
255-
open(OUT, ">$outfile_a");
256-
open(OUT2, ">$highfile_a");
218+
open(IN_U, $temp_u);
219+
open(OUT, ">$outfile");
220+
open(OUT2, ">$highfile");
257221
print OUT "ensGene\t%gene\tgeneSymbol\tgeneCoordinates\n";
258222
print OUT2 "ensGene\t%gene\tgeneSymbol\tgeneCoordinates\n";
259-
while(my $line_U_A = <IN_U_A>){
260-
chomp($line_U_A);
261-
my @au = split(/\t/, $line_U_A);
223+
while(my $line_U = <IN_U>){
224+
chomp($line_U);
225+
my @au = split(/\t/, $line_U);
262226
my $geneu = $au[0];
263227
my $quantu = $au[1];
264228
my $sym = $au[3];
265229
my $coord = $au[4];
266-
my $percent_u = int(($quantu / $total_u_a)* 10000 ) / 100;
230+
my $percent_u = 0;
231+
#Prevents divide-by-zero error if there are no Unique (sense) reads.
232+
if($total_u > 0) {
233+
$percent_u = int(($quantu / $total_u)* 10000 ) / 100;
234+
}
267235
$percent_u = sprintf("%.2f", $percent_u);
268236
print OUT "$geneu\t$percent_u\t$sym\t$coord\n";
269237
if ($percent_u >= $cutoff){
270-
print OUT2 "$geneu\t$percent_u\t$sym\t$coord\n";
238+
print OUT2 "$geneu\t$percent_u\t$sym\t$coord\n";
271239
}
272240
}
273-
close(IN_U_A);
241+
close(IN_U);
274242
close(OUT);
275243
close(OUT2);
276-
`rm $temp_u_a`;
277-
}
244+
`rm $temp_u`;
245+
if ($stranded eq "true"){
246+
open(IN_U_A, $temp_u_a);
247+
open(OUT, ">$outfile_a");
248+
open(OUT2, ">$highfile_a");
249+
print OUT "ensGene\t%gene\tgeneSymbol\tgeneCoordinates\n";
250+
print OUT2 "ensGene\t%gene\tgeneSymbol\tgeneCoordinates\n";
251+
while(my $line_U_A = <IN_U_A>){
252+
chomp($line_U_A);
253+
my @au = split(/\t/, $line_U_A);
254+
my $geneu = $au[0];
255+
my $quantu = $au[1];
256+
my $sym = $au[3];
257+
my $coord = $au[4];
258+
my $percent_u = 0;
259+
#Prevents divide-by-zero error if there are no Unique antisense reads.
260+
if($total_u_a > 0) {
261+
$percent_u = int(($quantu / $total_u_a)* 10000 ) / 100;
262+
}
263+
$percent_u = sprintf("%.2f", $percent_u);
264+
print OUT "$geneu\t$percent_u\t$sym\t$coord\n";
265+
if ($percent_u >= $cutoff){
266+
print OUT2 "$geneu\t$percent_u\t$sym\t$coord\n";
267+
}
268+
}
269+
close(IN_U_A);
270+
close(OUT);
271+
close(OUT2);
272+
`rm $temp_u_a`;
273+
}
278274
}
279275
if($NU eq "true"){
280-
open(IN_NU, $temp_nu);
281-
open(OUT, ">$outfile");
282-
#open(OUT2, ">$highfile");
283-
print OUT "ensGene\t%gene\tgeneSymbol\tgeneCoordinates\n";
284-
#print OUT2 "ensGene\t%max\tgeneSymbol\tgeneCoordinates\n";
285-
while(my $line_NU = <IN_NU>){
286-
chomp($line_NU);
287-
my @anu = split(/\t/, $line_NU);
288-
my $genenu = $anu[0];
289-
my $quantnu = $anu[2];
290-
my $sym = $anu[3];
291-
my $coord = $anu[4];
292-
my $percent_nu = int(($quantnu / $total_nu)* 10000 ) / 100;
293-
$percent_nu = sprintf("%.2f", $percent_nu);
294-
print OUT "$genenu\t$percent_nu\t$sym\t$coord\n";
295-
#if ($percent_nu >= $cutoff){
296-
# print OUT2 "$genenu\t$percent_nu\t$sym\t$coord\n";
297-
#}
298-
}
299-
close(IN_NU);
300-
close(OUT);
301-
#close(OUT2);
302-
`rm $temp_nu`;
303-
if ($stranded eq "true"){
304-
open(IN_NU_A, $temp_nu_a);
305-
open(OUT, ">$outfile_a");
306-
#open(OUT2, ">$highfile_a");
307-
print OUT "ensGene\t%max\tgeneSymbol\tgeneCoordinates\n";
276+
open(IN_NU, $temp_nu);
277+
open(OUT, ">$outfile");
278+
#open(OUT2, ">$highfile");
279+
print OUT "ensGene\t%gene\tgeneSymbol\tgeneCoordinates\n";
308280
#print OUT2 "ensGene\t%max\tgeneSymbol\tgeneCoordinates\n";
309-
while(my $line_NU_A = <IN_NU_A>){
310-
chomp($line_NU_A);
311-
my @anu = split(/\t/, $line_NU_A);
281+
while(my $line_NU = <IN_NU>){
282+
chomp($line_NU);
283+
my @anu = split(/\t/, $line_NU);
312284
my $genenu = $anu[0];
313285
my $quantnu = $anu[2];
314286
my $sym = $anu[3];
315287
my $coord = $anu[4];
316-
my $percent_nu = int(($quantnu / $total_nu_a)* 10000 ) / 100;
288+
my $percent_nu = 0;
289+
#Prevents divide-by-zero error if there are no NU (sense) reads.
290+
if($total_nu > 0) {
291+
$percent_nu = int(($quantnu / $total_nu)* 10000 ) / 100;
292+
}
317293
$percent_nu = sprintf("%.2f", $percent_nu);
318294
print OUT "$genenu\t$percent_nu\t$sym\t$coord\n";
319295
#if ($percent_nu >= $cutoff){
320-
#print OUT2 "$genenu\t$percent_nu\t$sym\t$coord\n";
296+
# print OUT2 "$genenu\t$percent_nu\t$sym\t$coord\n";
321297
#}
322298
}
323-
close(IN_NU_A);
299+
close(IN_NU);
324300
close(OUT);
325301
#close(OUT2);
326-
`rm $temp_nu_a`;
327-
}
302+
`rm $temp_nu`;
303+
if ($stranded eq "true"){
304+
open(IN_NU_A, $temp_nu_a);
305+
open(OUT, ">$outfile_a");
306+
#open(OUT2, ">$highfile_a");
307+
print OUT "ensGene\t%max\tgeneSymbol\tgeneCoordinates\n";
308+
#print OUT2 "ensGene\t%max\tgeneSymbol\tgeneCoordinates\n";
309+
while(my $line_NU_A = <IN_NU_A>){
310+
chomp($line_NU_A);
311+
my @anu = split(/\t/, $line_NU_A);
312+
my $genenu = $anu[0];
313+
my $quantnu = $anu[2];
314+
my $sym = $anu[3];
315+
my $coord = $anu[4];
316+
my $percent_nu = 0;
317+
#Prevents divide-by-zero error if there are no NU antisense reads.
318+
if($total_nu_a > 0) {
319+
$percent_nu = int(($quantnu / $total_nu_a)* 10000 ) / 100;
320+
}
321+
$percent_nu = sprintf("%.2f", $percent_nu);
322+
print OUT "$genenu\t$percent_nu\t$sym\t$coord\n";
323+
#if ($percent_nu >= $cutoff){
324+
#print OUT2 "$genenu\t$percent_nu\t$sym\t$coord\n";
325+
#}
326+
}
327+
close(IN_NU_A);
328+
close(OUT);
329+
#close(OUT2);
330+
`rm $temp_nu_a`;
331+
}
328332
}
329333

330334
print "got here\n";

norm_scripts/get_ribo_percents.pl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
}
4444

4545
unless (-d $stats_dir){
46-
`mkdir $stats_dir`;}
46+
`mkdir -p $stats_dir`;}
4747

4848
if (-e "$LOC/ribosomal_counts.txt"){
4949
`rm "$LOC/ribosomal_counts.txt"`;

norm_scripts/get_total_num_reads.pl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,9 +176,9 @@
176176
my $sample_dirs = $ARGV[0];
177177
my $logdir = $study_dir . "logs";
178178
unless (-d $logdir){
179-
`mkdir $logdir`;}
179+
`mkdir -p $logdir`;}
180180
unless (-d $stats_dir){
181-
`mkdir $stats_dir`;}
181+
`mkdir -p $stats_dir`;}
182182
my $input_files = $ARGV[2];
183183
my $temp_file = "$stats_dir/temp";
184184
my @t = glob ("$temp_file*$study");

norm_scripts/getstats.pl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
}
6262
my $dirs = $ARGV[0];
6363
unless (-d $stats_dir){
64-
`mkdir $stats_dir`;}
64+
`mkdir -p $stats_dir`;}
6565
my (%total, %uniqueandFRconsistently, %uniqueandAtLeastOneMapped, %NUandAtLeastOneMapped, %TotalMapped, %TotalMapped_cons, %NUandFRconsistently, %Overlap, %NOverlap, %Pover, %min_chrm, %max_chrm, %UchrM);
6666
my ($min_total, $min_total_frcons, $min_utotal_f_or_r_cons, $min_nutotal_f_or_r, $min_total_UorNU, $min_total_UandNU, $min_nutotal, $min_pover);
6767
my ($max_total,$max_total_frcons,$max_total_UorNU,$max_utotal_f_or_r_cons,$max_pover,$max_nutotal,$max_nutotal_f_or_r,$max_total_UandNU) = (0,0,0,0,0,0,0,0);

norm_scripts/juncs2spreadsheet.1.pl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
$spread_dir = $norm_dir . "/SPREADSHEETS";
4848

4949
unless (-d $spread_dir){
50-
`mkdir $spread_dir`;
50+
`mkdir -p $spread_dir`;
5151
}
5252
$outfile = "$spread_dir/master_list_of_junction_counts_MIN.$study.txt";
5353
$sample_name_file = "$norm_dir/file_junctions.txt";

norm_scripts/juncs2spreadsheet_min_max.pl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
$spread_dir = $norm_dir. "/SPREADSHEETS";
4040

4141
unless (-d $spread_dir){
42-
`mkdir $spread_dir`;
42+
`mkdir -p $spread_dir`;
4343
}
4444

4545
$outfile = "$spread_dir/master_list_of_junction_counts";

norm_scripts/make_final_samfile.pl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@
7676
$out_M = "$final_M_dir/$id.FINAL.norm.sam";
7777
if ($option_found eq "false"){
7878
unless (-d $final_M_dir){
79-
`mkdir $final_M_dir`;
79+
`mkdir -p $final_M_dir`;
8080
}
8181
#merged
8282
open(OUTM, ">$out_M");
@@ -133,7 +133,7 @@
133133
else{
134134
if ($U eq "true"){
135135
unless (-d $final_U_dir){
136-
`mkdir $final_U_dir`;
136+
`mkdir -p $final_U_dir`;
137137
}
138138
#unique
139139
open(OUTU, ">$out_U");
@@ -166,7 +166,7 @@
166166

167167
if ($NU eq "true"){
168168
unless (-d $final_NU_dir){
169-
`mkdir $final_NU_dir`;
169+
`mkdir -p $final_NU_dir`;
170170
}
171171
#non-unique
172172
open(OUTNU, ">$out_NU");

norm_scripts/make_final_spreadsheets.pl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -208,15 +208,15 @@
208208
my $logdir = $study_dir . "logs";
209209

210210
unless (-d $shdir){
211-
`mkdir $shdir`;}
211+
`mkdir -p $shdir`;}
212212

213213
unless (-d $logdir){
214-
`mkdir $logdir`;}
214+
`mkdir -p $logdir`;}
215215

216216
my $norm_dir = "$normdir/EXON_INTRON_JUNCTION";
217217
my $spread_dir = $norm_dir . "/SPREADSHEETS";
218218
unless (-d $spread_dir){
219-
`mkdir $spread_dir`;
219+
`mkdir -p $spread_dir`;
220220
}
221221
my $FILE = $ARGV[0];
222222

0 commit comments

Comments
 (0)