Verified Commit 8b810e2d authored by Michael R. Crusoe's avatar Michael R. Crusoe 🏳️‍🌈
Browse files

support samtools >= 1.10

parent ebd72bea
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
bio-tradis (1.4.5+dfsg-2) UNRELEASED; urgency=medium

  * Team upload.
  * debian/patches/samtools1.10: remove version parsing code that can't handle
    samtools version 1.10

 -- Michael R. Crusoe <michael.crusoe@gmail.com>  Wed, 25 Dec 2019 13:28:31 +0100

bio-tradis (1.4.5+dfsg-1) unstable; urgency=medium

  * Team upload.
+76 −0
Original line number Diff line number Diff line
Author: Michael R. Crusoe <michael.crusoe@gmail.com>
Description: skip broken samtools version parsing code that can't handle version 1.10+
--- bio-tradis.orig/lib/Bio/Tradis/Samtools.pm
+++ bio-tradis/lib/Bio/Tradis/Samtools.pm
@@ -20,40 +20,6 @@
 
 has 'exec'         => ( is => 'ro', isa => 'Str', default => 'samtools' );
 has 'threads'      => ( is => 'ro', isa => 'Int', default => 1 );
-has 'exec_version' => ( is => 'ro', isa => 'Str', lazy    => 1, builder => '_build_exec_version' );
-
-sub _build_exec_version {
-    my ($self) = @_;
-		
-    my $fp = $self->find_exe($self->exec);
-		if(!$fp)
-		{
-			 exit("ERROR: Can't find required ".$self->exec." in your \$PATH");
-  	}
-		my $cmd_version = $self->exec." 2>&1 | grep Version";
-		my ($version_string) = qx($cmd_version);
-		
-		if(defined($version_string))
-		{
-			#Version: 0.1.19-44428cd
-			#Version: 1.2 (using htslib 1.2)
-			# we dont use 3rd number in version so just look for 0.1, 1.2
-			if($version_string =~ /Version:[\t\s]+(\d+)\.(\d+)/)
-			{
-				return $1.'.'.$2;
-			}
-			else
-			{
-				print STDERR "ERROR: Couldn't identify samtools version";
-			}
-		}
-		else
-		{
-			print STDERR "ERROR: Couldn't identify samtools version";
-		}
-		# reasonable fallback
-    return '0.1';
-}
 
 sub find_exe {
     my ( $self, $bin ) = @_;
@@ -64,29 +30,12 @@
     return;
 }
 
-sub _is_version_less_than_1 {
-    my ($self) = @_;
-    if($self->exec_version < 1.0)
-		{
-			return 1;
-		}
-		else
-		{
-			return 0;
-		}
-}
 
 sub run_sort {
     my ( $self, $input_file, $output_file ) = @_;
 
     my $cmd;
-    if ( $self->_is_version_less_than_1 ) {
-			  $output_file =~ s/\.bam//i;
-        $cmd = join( ' ', ( $self->exec, 'sort', $input_file, $output_file) );
-    }
-    else {
-        $cmd = join( ' ', ( $self->exec, 'sort', '-@', $self->threads, '-O', 'bam', '-T', $input_file.'.tmp',  '-o', $output_file, $input_file ) );
-    }
+    $cmd = join( ' ', ( $self->exec, 'sort', '-@', $self->threads, '-O', 'bam', '-T', $input_file.'.tmp',  '-o', $output_file, $input_file ) );
     system($cmd);
 }
 

debian/patches/series

0 → 100644
+1 −0
Original line number Diff line number Diff line
samtools1.10
+1 −1
Original line number Diff line number Diff line
#!/usr/bin/make -f

# DH_VERBOSE := 1
DH_VERBOSE := 1
export LC_ALL=C.UTF-8

TEST_FILES = $(shell find t -name "*.t")