« lib/Bio/AssemblyImprovement/Util/OrderContigsByLength.pm
↑ Summary
lib/Bio/AssemblyImprovement/DigitalNormalisation/Khmer/Main.pm »
| 1 | package Bio::AssemblyImprovement::IvaQC::Main; | ||||||||||
| 2 | |||||||||||
| 3 | # ABSTRACT: Wrapper around iva_qc | ||||||||||
| 4 | |||||||||||
| 5 | # =head1 SYNOPSIS | ||||||||||
| 6 | |||||||||||
| 7 | # =cut | ||||||||||
| 8 | |||||||||||
| 9 | 2 | ▶ | use File::Spec; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | 2 | ▶ | use Moose; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 11 | 2 | ▶ | use Cwd; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 12 | 2 | ▶ | use File::Path qw( rmtree ); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 13 | |||||||||||
| 14 | |||||||||||
| 15 | 2 | has 'db' => ( is => 'ro', isa => 'Str', required => 0, default => "/lustre/scratch108/pathogen/pathpipe/kraken/assemblyqc_fluhiv_20150728" ); | |||||||||
| 16 | 2 | has 'forward_reads' => ( is => 'ro', isa => 'Str', required => 1 ); | |||||||||
| 17 | 2 | has 'reverse_reads' => ( is => 'ro', isa => 'Str', required => 1 ); | |||||||||
| 18 | 2 | has 'assembly' => ( is => 'ro', isa => 'Str', required => 1 ); | |||||||||
| 19 | 2 | has 'prefix' => ( is => 'ro', isa => 'Str', required => 0, default => "iva_qc"); | |||||||||
| 20 | 2 | has 'iva_qc_exec' => ( is => 'ro', isa => 'Str', required => 0, default => "/software/pathogen/external/bin/iva_qc"); | |||||||||
| 21 | 2 | has 'working_directory'=> ( is => 'ro', isa => 'Str', required => 0, default => getcwd()); | |||||||||
| 22 | |||||||||||
| 23 | |||||||||||
| 24 | |||||||||||
| 25 | 2 | ▶ | sub run { | ||||||||
|
Subroutine
run: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||
| 26 | 2 | my ($self) = @_; | |||||||||
| 27 | |||||||||||
| 28 | # remember cwd and cd into working directory | ||||||||||
| 29 | 2 | my $cwd = getcwd(); | |||||||||
| 30 | 2 | my $iva_qc_dir = $self->working_directory."/iva_qc"; | |||||||||
| 31 | 2 | ▶ | if (! -d $iva_qc_dir) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 32 | 2 | mkdir $iva_qc_dir; | |||||||||
| 33 | } | ||||||||||
| 34 | 2 | chdir( $iva_qc_dir ); | |||||||||
| 35 | |||||||||||
| 36 | 2 | my $cmd = join( | |||||||||
| 37 | ' ', | ||||||||||
| 38 | ( | ||||||||||
| 39 | $self->iva_qc_exec, | ||||||||||
| 40 | '-f', $self->forward_reads, | ||||||||||
| 41 | '-r', $self->reverse_reads, | ||||||||||
| 42 | '--ref_db', $self->db, | ||||||||||
| 43 | $self->assembly, | ||||||||||
| 44 | $self->prefix, | ||||||||||
| 45 | ) | ||||||||||
| 46 | ); | ||||||||||
| 47 | |||||||||||
| 48 | 2 | ▶ | system($cmd) and warn "Error running iva_qc with: $cmd \n"; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 49 | |||||||||||
| 50 | # delete files and directories that were considered unnecessary | ||||||||||
| 51 | 2 | unlink($self->prefix.'.contig_placement.R', | |||||||||
| 52 | $self->prefix.'.reads_mapped_to_assembly.bam', | ||||||||||
| 53 | $self->prefix.'.reads_mapped_to_assembly.bam.bai', | ||||||||||
| 54 | $self->prefix.'.reads_mapped_to_assembly.bam.flagstat', | ||||||||||
| 55 | $self->prefix.'.reads_mapped_to_ref.bam', | ||||||||||
| 56 | $self->prefix.'.reads_mapped_to_ref.bam.bai', | ||||||||||
| 57 | $self->prefix.'.reads_mapped_to_ref.bam.flagstat', | ||||||||||
| 58 | ); | ||||||||||
| 59 | 2 | rmtree($self->prefix.'.gage'); | |||||||||
| 60 | |||||||||||
| 61 | #change back to cwd | ||||||||||
| 62 | 2 | chdir ($cwd); | |||||||||
| 63 | |||||||||||
| 64 | |||||||||||
| 65 | } | ||||||||||
| 66 | |||||||||||
| 67 | |||||||||||
| 68 | 2 | ▶ | no Moose; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 69 | 2 | __PACKAGE__->meta->make_immutable; | |||||||||
| 70 | 2 | 1; | |||||||||
| 71 | |||||||||||
| 72 | __END__ | ||||||||||