DiltheyLab/HLA-LA

Error - [main_samview] fail to read the header from "-".

pablosoro opened this issue · 1 comments

Hi,

I'm running some samples through HLA*LA and I've been hit by this error.

Extract reads from 1 regions...
Extract unmapped reads...
[main_samview] fail to read the header from "-".
Extraction command .../.conda/envs/HLA_typing/bin/samtools view -@ 39  canu_trimmed/HLA-DRB1_1_R1.sorted.bam '*' | awk '{if ($3 == "*") print $0}' | .../.conda/envs/HLA_typing/bin/samtools view -bo .../HLA_output/canu_trimmed/HLA_DRB1_1_R1/extraction_unmapped.bam - failed at .../.conda/envs/HLA_typing/bin/HLA-LA.pl line 420.

I found an old issue that dealt with this [https://github.com//issues/63] Is this the current advice? Many thanks.

I installed HLA-LA via bioconda on 08/08/23.

My bin/HLA-LA.pl looks like this on lines 418-421:

 	if(system($extraction_command_unmapped) != 0)
	{
		die "Extraction command $extraction_command_unmapped failed";
	}

However I can see there's a change made on 20/07/23 (624f6fd) where the code changes to:

	if(system($extraction_command_unmapped) != 0)
	{
		#die "Extraction command $extraction_command_unmapped failed";
		my $count_unmapped = qq($samtools_bin view -\@ $threads_minus_1 $view_T_switch $BAM '*' | awk '{if (\$3 == "*") print \$0}' | wc);
		open(COUNT, "$count_unmapped |") or die "Cannot open pipe to count unmapped reads";
		my $wc_out = <COUNT>;
		chomp($wc_out);
		close(COUNT);
		die "Cannot parse wc output: '$wc_out'" unless($wc_out =~ /^\s*(\d+)\s+(\d+)\s+/); 
		my $n_unmapped_reads = $1;

		if($n_unmapped_reads != 0)
		{
			die "Extraction command $extraction_command_unmapped failed - there are unmapped reads [$n_unmapped_reads]";
		}
		else
		{
			print "No unmapped reads, you can ignore the samtools warning if one was emitted...\n";
			my $extraction_command_unmapped_generateEmptyBAM = qq($samtools_bin view -bo $target_extraction_unmapped -\@ $threads_minus_1 $view_T_switch $BAM '*');
			system($extraction_command_unmapped_generateEmptyBAM) and die "Command $extraction_command_unmapped_generateEmptyBAM failed (empty BAM generation, no unmapped reads";
		}
	}

I was wondering if this difference may be the cause of the error? I tried to alter the code but then I get an error regarding PRG_MHC_GRCh38_withIMGT (HLA-LA is unable to find it although I didn't change the location). Reverting the changes gives back the original error regarding the header.