Skip to content

Commit

Permalink
Merge 8ece2e4 into 46a3a2d
Browse files Browse the repository at this point in the history
  • Loading branch information
projectoriented committed Jun 17, 2021
2 parents 46a3a2d + 8ece2e4 commit 2b6dab0
Show file tree
Hide file tree
Showing 6 changed files with 277 additions and 2 deletions.
23 changes: 23 additions & 0 deletions containers/hmtnote/Dockerfile
@@ -0,0 +1,23 @@
################## BASE IMAGE ######################

FROM clinicalgenomics/mip_base:2.1

################## METADATA ######################

LABEL base_image="clinicalgenomics/mip_base:2.1"
LABEL version="1"
LABEL software="HmtNote"
LABEL software.version="0.7.2"
LABEL extra.binaries="HmtNote"
LABEL maintainer="Clinical-Genomics/MIP"

RUN conda install pip python=3.7

## Clean up after conda
RUN /opt/conda/bin/conda clean -tipsy

RUN pip install --no-cache-dir hmtnote==0.7.2

RUN hmtnote dump

WORKDIR /data/
1 change: 1 addition & 0 deletions definitions/install_parameters.yaml
Expand Up @@ -81,6 +81,7 @@ rd_dna:
- gatk4
- genmod
- glnexus
- hmtnote
- htslib
- manta
- mip
Expand Down
4 changes: 2 additions & 2 deletions lib/MIP/Cli/Mip/Install.pm
Expand Up @@ -132,7 +132,7 @@ sub _build_usage {
[
qw{ arriba bedtools blobfish bootstrapann bwa bwakit bwa-mem2 cadd chanjo
chromograph cnvnator cyrius deeptrio deepvariant delly expansionhunter fastqc gatk
gatk4 genmod gffcompare glnexus htslib manta megafusion mip mip_scripts multiqc
gatk4 genmod gffcompare glnexus hmtnote htslib manta megafusion mip mip_scripts multiqc
pdfmerger perl peddy picard plink preseq python rhocall rseqc rtg-tools salmon sambamba
smncopynumbercaller star star-fusion stranger stringtie svdb telomerecat tiddit
trim-galore ucsc upd utilities varg vcf2cytosure vcfanno vep vts }
Expand All @@ -154,7 +154,7 @@ sub _build_usage {
[
qw{ arriba bedtools blobfish bootstrapann bwa bwakit bwa-mem2 cadd chanjo
chromograph cnvnator cyrius deeptrio deepvariant delly expansionhunter fastqc gatk
gatk4 genmod gffcompare glnexus htslib manta megafusion mip mip_scripts multiqc
gatk4 genmod gffcompare glnexus hmtnote htslib manta megafusion mip mip_scripts multiqc
pdfmerger perl peddy picard plink preseq python rhocall rseqc rtg-tools salmon sambamba
smncopynumbercaller star star-fusion stranger stringtie svdb telomerecat tiddit
trim-galore ucsc upd utilities varg vcf2cytosure vcfanno vep vts }
Expand Down
131 changes: 131 additions & 0 deletions lib/MIP/Program/HmtNote.pm
@@ -0,0 +1,131 @@
package MIP::Program::HmtNote;

use 5.026;
use Carp;
use charnames qw{ :full :short };
use English qw{ -no_match_vars };
use open qw{ :encoding(UTF-8) :std };
use Params::Check qw{ allow check last_error };
use utf8;
use warnings;
use warnings qw{ FATAL utf8 };

## CPANM
use autodie qw{ :all };
use Readonly;

## MIPs lib/
use MIP::Constants qw{ $SPACE };
use MIP::Environment::Executable qw{ get_executable_base_command };
use MIP::Unix::Standard_streams qw{ unix_standard_streams };
use MIP::Unix::Write_to_file qw{ unix_write_to_file };

BEGIN {
require Exporter;
use base qw{ Exporter };

# Set the version for version checking
# Functions and variables which can be optionally exported
our @EXPORT_OK = qw{ hmtnote_annotate };
}

Readonly my $BASE_COMMAND => q{hmtnote};

sub hmtnote_annotate {

## Function : Perl wrapper for hmtnote version 0.7.2
## Returns : @commands
## Arguments: $filehandle => Filehandle to write to
## : $infile_path => Input.vcf
## : $offline => An argument if running the command offline
## : $outfile_path => Annotate.vcf
## : $stderrfile_path => Stderrfile path
## : $stderrfile_path_append => Append stderr info to file path
## : $stdinfile_path => Stdinfile path
## : $stdoutfile_path => Stdoutfile path

my ($arg_href) = @_;

## Flatten argument(s)
my $filehandle;
my $infile_path;
my $offline;
my $outfile_path;
my $stderrfile_path;
my $stderrfile_path_append;
my $stdinfile_path;
my $stdoutfile_path;

## Default(s)

my $tmpl = {
filehandle => {
store => \$filehandle,
},
infile_path => {
defined => 1,
required => 1,
store => \$infile_path,
strict_type => 1,
},
offline => {
allow => [ undef, 0, 1 ],
store => \$offline,
strict_type => 1,
},
outfile_path => {
defined => 1,
required => 1,
store => \$outfile_path,
strict_type => 1,
},
stderrfile_path => {
store => \$stderrfile_path,
strict_type => 1,
},
stderrfile_path_append => {
store => \$stderrfile_path_append,
strict_type => 1,
},
stdinfile_path => { store => \$stdinfile_path, strict_type => 1, },
stdoutfile_path => {
store => \$stdoutfile_path,
strict_type => 1,
},
};

check( $tmpl, $arg_href, 1 ) or croak q{Could not parse arguments!};

my @commands =
( get_executable_base_command( { base_command => $BASE_COMMAND, } ), qw{ annotate } );

push @commands, $infile_path;
push @commands, $outfile_path;

if ($offline) {

push @commands, q{--offline};
}

push @commands,
unix_standard_streams(
{
stderrfile_path => $stderrfile_path,
stderrfile_path_append => $stderrfile_path_append,
stdinfile_path => $stdinfile_path,
stdoutfile_path => $stdoutfile_path,
}
);

unix_write_to_file(
{
commands_ref => \@commands,
filehandle => $filehandle,
separator => $SPACE,

}
);
return @commands;
}

1;
116 changes: 116 additions & 0 deletions t/hmtnote_annotate.t
@@ -0,0 +1,116 @@
#!/usr/bin/env perl

use 5.026;
use Carp;
use charnames qw{ :full :short };
use English qw{ -no_match_vars };
use File::Basename qw{ dirname };
use File::Spec::Functions qw{ catdir };
use FindBin qw{ $Bin };
use open qw{ :encoding(UTF-8) :std };
use Params::Check qw{ allow check last_error };
use Test::More;
use utf8;
use warnings qw{ FATAL utf8 };

## CPANM
use autodie qw{ :all };
use Modern::Perl qw{ 2018 };

## MIPs lib/
use lib catdir( dirname($Bin), q{lib} );
use MIP::Constants qw{ $COMMA $SPACE };
use MIP::Test::Commands qw{ test_function };

BEGIN {

use MIP::Test::Fixtures qw{ test_import };

### Check all internal dependency modules and imports
## Modules with import
my %perl_module = ( q{MIP::Program::HmtNote} => [qw{ hmtnote_annotate }], );

test_import( { perl_module_href => \%perl_module, } );
}

use MIP::Program::HmtNote qw{ hmtnote_annotate };

diag( q{Test hmtnote_annotate from HmtNote.pm}
. $COMMA
. $SPACE . q{Perl}
. $SPACE
. $PERL_VERSION
. $SPACE
. $EXECUTABLE_NAME );

## Base arguments
my @function_base_commands = qw{ hmtnote };

my %base_argument = (
filehandle => {
input => undef,
expected_output => \@function_base_commands,
},
stderrfile_path => {
input => q{stderrfile.test},
expected_output => q{2> stderrfile.test},
},
stderrfile_path_append => {
input => q{stderrfile.test},
expected_output => q{2>> stderrfile.test},
},
stdoutfile_path => {
input => q{stdoutfile.test},
expected_output => q{1> stdoutfile.test},
},
);

## Can be duplicated with %base_argument and/or %specific_argument
## to enable testing of each individual argument
my %required_argument = (
infile_path => {
input => q{myfile.vcf},
expected_output => q{myfile.vcf},
},
outfile_path => {
input => q{outfile.vcf},
expected_output => q{outfile.vcf},
},
);

my %specific_argument = (
offline => {
input => 1,
expected_output => q{--offline},
},
infile_path => {
input => q{myfile.vcf},
expected_output => q{myfile.vcf},
},
outfile_path => {
input => q{outfile.vcf},
expected_output => q{outfile.vcf},
},
);

## Coderef - enables generalized use of generate call
my $module_function_cref = \&hmtnote_annotate;

## Test both base and function specific arguments
my @arguments = ( \%base_argument, \%specific_argument );

ARGUMENT_HASH_REF:
foreach my $argument_href (@arguments) {

my @commands = test_function(
{
argument_href => $argument_href,
do_test_base_command => 1,
function_base_commands_ref => \@function_base_commands,
module_function_cref => $module_function_cref,
required_argument_href => \%required_argument,
}
);
}

done_testing();
4 changes: 4 additions & 0 deletions templates/mip_install_config.yaml
Expand Up @@ -98,6 +98,10 @@ container:
executable:
glnexus_cli:
uri: quay.io/mlin/glnexus:v1.3.1
hmtnote:
executable:
hmtnote:
uri: docker.io/clinicalgenomics/hmtnote:0.7.2
htslib:
executable:
bcftools:
Expand Down

0 comments on commit 2b6dab0

Please sign in to comment.