Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
pablosoro opened this issue Oct 18, 2023 · 1 comment
Open

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

pablosoro opened this issue Oct 18, 2023 · 1 comment

Comments

@pablosoro
Copy link

pablosoro commented Oct 18, 2023

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.

@pablosoro
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant