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

An error:[E::sam_hdr_create] Invalid header line: must start with @HD/@SQ/@RG/@PG/@CO #2024

Open
shizuka0420 opened this issue Apr 10, 2024 · 4 comments

Comments

@shizuka0420
Copy link

shizuka0420 commented Apr 10, 2024

When I tried to use samtools(version:1.19.2) to view sam files, it occured an error.
[E::sam_hdr_create] Invalid header line: must start with @HD/@SQ/@RG/@PG/@co
However, I have checked many times about the header of sam files, which are fit to the format.
A part of the sam file is as follow:
image
The code to get the sam files is as follow:
bowtie -x "$REF_GENOME_INDEX" -f "$FILE" -S "$SAM_FILE"
Does anyone know how to solve this problem? Is the sam file damaged when my bowtie is in use?

@whitwham
Copy link
Contributor

Can you post the entire header as a text file? Can you also tell us what samtools command you were using.

@shizuka0420
Copy link
Author

Can you post the entire header as a text file? Can you also tell us what samtools command you were using.

Thanks for your reply.
The command is samtools view + filename
A entire header is showed in the text file as follow, please help me check if there is a problem.
headersam.txt

@jkbonfield
Copy link
Contributor

Usually when I see such errors it's because there is something else being mixed in with stdout and you're using a pipe. Possibly related to nohup or sometimes caused by some batch submission systems. The full command line and what environment it is being ran under may well impact this.

However I also see your header file uses spaces instead of tabs. This is an error. It may be how you saved it, or something like cut and paste. Or possibly it's what samtools is complaining about. However it looks to give different error with spaces, so I think this malformed headersam.txt is a second problem.

@shizuka0420
Copy link
Author

Usually when I see such errors it's because there is something else being mixed in with stdout and you're using a pipe. Possibly related to nohup or sometimes caused by some batch submission systems. The full command line and what environment it is being ran under may well impact this.

However I also see your header file uses spaces instead of tabs. This is an error. It may be how you saved it, or something like cut and paste. Or possibly it's what samtools is complaining about. However it looks to give different error with spaces, so I think this malformed headersam.txt is a second problem.

Thank you for your detailed answer.I will try to regenerate the sam file and check the separator.

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

3 participants