Skip to content

Commit

Permalink
added --force to ratio.pl, split_ratio.pl add file names.
Browse files Browse the repository at this point in the history
  • Loading branch information
Toshiro Nishimura committed Mar 28, 2011
1 parent 182ba5c commit 4cbec25
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 12 deletions.
1 change: 1 addition & 0 deletions lib/GFF/Util.pm
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use Data::Dumper;
use feature 'say';
use Carp;
use autodie;
use GFF;

require Exporter;
our @ISA = qw(Exporter);
Expand Down
41 changes: 30 additions & 11 deletions ratio.pl
Original file line number Diff line number Diff line change
Expand Up @@ -93,19 +93,22 @@ sub _gen_files {
my $bsrc_reference_a = $opt_reference_a . ".bsrc";
my $bsrc_reference_b = $opt_reference_b . ".bsrc";

launch("perl -S fasta_bsrc.pl $opt_reference_a > $bsrc_reference_a", expected => $bsrc_reference_a);
launch("perl -S fasta_bsrc.pl $opt_reference_b > $bsrc_reference_b", expected => $bsrc_reference_b);
launch("perl -S fasta_bsrc.pl $opt_reference_a > $bsrc_reference_a",
expected => $bsrc_reference_a, force => $opt_force >= 2 );
launch("perl -S fasta_bsrc.pl $opt_reference_b > $bsrc_reference_b",
expected => $bsrc_reference_b, force => $opt_force >= 2 );

for my $ref ($bsrc_reference_a,$bsrc_reference_b) {
launch("bowtie-build $ref $ref", expected => ("$ref.1.ebwt"));
launch("bowtie-build $ref $ref",
expected => ("$ref.1.ebwt"), force => $opt_force >= 2);
}

# raw: fastq -> fasta, c2t
$logger->info("converting fastq->fasta, then converting");
my $rawfas = "$opt_raw.fasta";
my $rawc2t = "$opt_raw.fasta.c2t";
launch("perl -S fq_all2std.pl fq2fa $opt_raw > $rawfas", expected => $rawfas);
launch("perl -S convert.pl c2t $rawfas > $rawc2t", expected => $rawc2t);
launch("perl -S fq_all2std.pl fq2fa $opt_raw > $rawfas", expected => $rawfas, force => $opt_force>=2);
launch("perl -S convert.pl c2t $rawfas > $rawc2t", expected => $rawc2t, force => $opt_force>=2);


#######################################################################
Expand All @@ -118,9 +121,9 @@ sub _gen_files {
my $bowtie_a = "$basename_a.bowtie";
my $bowtie_b = "$basename_b.bowtie";
launch("bowtie $bsrc_reference_a -f -B 1 -v $opt_bowtie_mismatches --norc --best -5 $trim5 -3 $trim3 $rawc2t $bowtie_a",
expected => $bowtie_a);
expected => $bowtie_a, force => $opt_force);
launch("bowtie $bsrc_reference_b -f -B 1 -v $opt_bowtie_mismatches --norc --best -5 $trim5 -3 $trim3 $rawc2t $bowtie_b",
expected => $bowtie_b);
expected => $bowtie_b, force => $opt_force);

#######################################################################
# parse bowtie
Expand All @@ -129,18 +132,18 @@ sub _gen_files {
my $eland_a = "$basename_a.eland";
my $eland_b = "$basename_b.eland";
launch("perl -S parse_bowtie.pl -u $rawfas -s @opt_splice{qw/start end/} $bowtie_a -o $eland_a",
expected => $eland_a);
expected => $eland_a, force => $opt_force);
launch("perl -S parse_bowtie.pl -u $rawfas -s @opt_splice{qw/start end/} $bowtie_b -o $eland_b",
expected => $eland_b);
expected => $eland_b, force => $opt_force);

#######################################################################
# Split on mismatches

$logger->info("sort the eland files");
my $eland_sorted_a = "$eland_a.sorted";
my $eland_sorted_b = "$eland_b.sorted";
launch("sort -k 1,1 -S 15% $eland_a -o $eland_sorted_a",expected => $eland_sorted_a);
launch("sort -k 1,1 -S 15% $eland_b -o $eland_sorted_b",expected => $eland_sorted_b);
launch("sort -k 1,1 -S 15% $eland_a -o $eland_sorted_a",expected => $eland_sorted_a, force => $opt_force);
launch("sort -k 1,1 -S 15% $eland_b -o $eland_sorted_b",expected => $eland_sorted_b, force => $opt_force);

$logger->info("split_on_mismatch.pl");
my $eland_filtered_a = "$eland_a.filtered";
Expand Down Expand Up @@ -305,8 +308,24 @@ =head1 OPTIONS
Prefix for the file names.
=item --help | -h
=back
=over
=head1 Debug options
=item --force <level>
Level of forcefulness in doing jobs. 1 = Redo all run-specifics. 2 = Redo bowtie-build as well.
=for Euclid
force.default: 0
force.type: int, force >= 0
=back
=cut
Expand Down
6 changes: 5 additions & 1 deletion split_ratio.pl
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use Getopt::Euclid qw( :vars<opt_> );
use Pod::Usage;
use List::Util qw/sum/;
use Cwd qw/abs_path/;

pod2usage(-verbose => 99,-sections => [qw/NAME SYNOPSIS OPTIONS/])
unless $opt_output && $opt_ecotype_a && $opt_ecotype_b &&
Expand Down Expand Up @@ -52,7 +53,10 @@
my $ratio_log = $opt_output;
open my $ratiofh, '>', $ratio_log;

say $ratiofh "$opt_ecotype_a / $opt_ecotype_b";
say $ratiofh "$opt_ecotype_a = " . abs_path($opt_eland_filtered_a);
say $ratiofh "$opt_ecotype_b = " . abs_path($opt_eland_filtered_b);

say $ratiofh "\n$opt_ecotype_a / $opt_ecotype_b";

for my $mm (0 .. $opt_bowtie_mismatches, 'total') {
say $ratiofh "$mm mismatches";
Expand Down

0 comments on commit 4cbec25

Please sign in to comment.