MikeAxtell / bam2wig

Conversion of a BAM alignment to wiggle and bigwig coverage files, with flexible reporting options
GNU General Public License v3.0
16 stars 5 forks source link

Error "FATAL: Failed to open a temp file for chrom lengths" #6

Closed haowuisu closed 4 years ago

haowuisu commented 4 years ago

I am trying to use bam2wig to convert a bam file to a bigwig file for genome visualization. I got an issue at the third step of bam2wig, and the program failed to open the temp file "chr_lens_temp.txt".

I have installed and loaded wigtobigwig. My BAM file has been sorted and indexed. The header is as follows,

$ samtools view -H PB_ATAC_T2.filtered.bam @hd VN:1.5 SO:coordinate @sq SN:1 LN:307041717 @sq SN:2 LN:244442276 @sq SN:3 LN:235667834 @sq SN:4 LN:246994605 @sq SN:5 LN:223902240 @sq SN:6 LN:174033170 @sq SN:7 LN:182381542 @sq SN:8 LN:181122637 @sq SN:9 LN:159769782 @sq SN:10 LN:150982314 @sq SN:Pt LN:140384 @sq SN:Mt LN:569630 ....

The code I run the program was as follows:

module load bam2wig module load wigtobigwig

bam2wig PB_ATAC_T2.filtered.bam

Why did the error occur? How to fix it?

Thanks.

MikeAxtell commented 4 years ago

That looks like line 633 of code and only reason I can see why that line would fail is that you don't have permissions to create and open a new file in your working directory, smells like a permissions issue you need to resolve if you are using an HPC cluster.

I will also make a suggestion to investigate deeptools (https://deeptools.readthedocs.io/en/develop/) for this purpose instead of using my crummy old bam2wig script. deeptools is much more actively maintained and less likely to be buggy ! Specifically deeptools bamCoverage (https://deeptools.readthedocs.io/en/develop/content/tools/bamCoverage.html) will do what you need.

Good luck, Mike

From: haowuisu notifications@github.com Reply-To: MikeAxtell/bam2wig reply@reply.github.com Date: Sunday, October 4, 2020 at 8:34 PM To: MikeAxtell/bam2wig bam2wig@noreply.github.com Cc: Subscribed subscribed@noreply.github.com Subject: [MikeAxtell/bam2wig] Error "FATAL: Failed to open a temp file for chrom lengths" (#6)

I am trying to use bam2wig to convert a bam file to a bigwig file for genome visualization. I got an issue at the third step of bam2wig, and the program failed to open the temp file "chr_lens_temp.txt".

I have installed and loaded wigtobigwig. My BAM file has been sorted and indexed. The header is as follows,

$ samtools view -H PB_ATAC_T2.filtered.bam @hdhttps://nam01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fhd&data=02%7C01%7Cmja18%40psu.edu%7C217184753071462c1de808d868c672aa%7C7cf48d453ddb4389a9c1c115526eb52e%7C0%7C0%7C637374548819315599&sdata=jBpf59PYiZ7YyNqyioEMP%2BB5dd3xbG2bsQLYx9%2BehGQ%3D&reserved=0 VN:1.5 SO:coordinate @sqhttps://nam01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fsq&data=02%7C01%7Cmja18%40psu.edu%7C217184753071462c1de808d868c672aa%7C7cf48d453ddb4389a9c1c115526eb52e%7C0%7C0%7C637374548819325595&sdata=Inl4Xtn%2FGyjnMJxjckiHpIBvv3LeHlmHu8G29oyBOMc%3D&reserved=0 SN:1 LN:307041717 @sqhttps://nam01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fsq&data=02%7C01%7Cmja18%40psu.edu%7C217184753071462c1de808d868c672aa%7C7cf48d453ddb4389a9c1c115526eb52e%7C0%7C0%7C637374548819330592&sdata=f90OQsKJbvmYNOnwho6Dnazw2HlinQNOO0js6tvp%2FMs%3D&reserved=0 SN:2 LN:244442276 @sqhttps://nam01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fsq&data=02%7C01%7Cmja18%40psu.edu%7C217184753071462c1de808d868c672aa%7C7cf48d453ddb4389a9c1c115526eb52e%7C0%7C0%7C637374548819335589&sdata=C5c6%2BA1XB1Ufh72hpl8YudsOUSUaZaN9kpxKoupx4Yo%3D&reserved=0 SN:3 LN:235667834 @sqhttps://nam01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fsq&data=02%7C01%7Cmja18%40psu.edu%7C217184753071462c1de808d868c672aa%7C7cf48d453ddb4389a9c1c115526eb52e%7C0%7C0%7C637374548819340587&sdata=rWijQn6NlL4RMLmOlSHqoAEXJKeXOcWFRIawNIJESbg%3D&reserved=0 SN:4 LN:246994605 @sqhttps://nam01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fsq&data=02%7C01%7Cmja18%40psu.edu%7C217184753071462c1de808d868c672aa%7C7cf48d453ddb4389a9c1c115526eb52e%7C0%7C0%7C637374548819345585&sdata=%2FgCzfAxXE89hMg6bnuQIyAFZXEJ5h8ZJd4sxW5JaqK8%3D&reserved=0 SN:5 LN:223902240 @sqhttps://nam01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fsq&data=02%7C01%7Cmja18%40psu.edu%7C217184753071462c1de808d868c672aa%7C7cf48d453ddb4389a9c1c115526eb52e%7C0%7C0%7C637374548819350583&sdata=MxrsVuD7drw4CW8FT4fq8VxsqeMN6E%2B%2Bfkhh5HRmx%2BY%3D&reserved=0 SN:6 LN:174033170 @sqhttps://nam01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fsq&data=02%7C01%7Cmja18%40psu.edu%7C217184753071462c1de808d868c672aa%7C7cf48d453ddb4389a9c1c115526eb52e%7C0%7C0%7C637374548819355581&sdata=lOm%2BvsieObR1yi3yf7dV%2BTAr6zbTTv92uIEOs2LBG3Y%3D&reserved=0 SN:7 LN:182381542 @sqhttps://nam01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fsq&data=02%7C01%7Cmja18%40psu.edu%7C217184753071462c1de808d868c672aa%7C7cf48d453ddb4389a9c1c115526eb52e%7C0%7C0%7C637374548819360587&sdata=wTb4bEYRhdntPVUPNhVprmCvumNv2yiTk8TPxQeIFts%3D&reserved=0 SN:8 LN:181122637 @sqhttps://nam01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fsq&data=02%7C01%7Cmja18%40psu.edu%7C217184753071462c1de808d868c672aa%7C7cf48d453ddb4389a9c1c115526eb52e%7C0%7C0%7C637374548819370582&sdata=d0cbs0sqqT8mcBET1W8LJAq5gF5EFE2MWs7FJP%2FoHaw%3D&reserved=0 SN:9 LN:159769782 @sqhttps://nam01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fsq&data=02%7C01%7Cmja18%40psu.edu%7C217184753071462c1de808d868c672aa%7C7cf48d453ddb4389a9c1c115526eb52e%7C0%7C0%7C637374548819375577&sdata=M64ERWo20YZ26W%2FRo40pzoGa81ASqNwXjdmYnBNBcB4%3D&reserved=0 SN:10 LN:150982314 @sqhttps://nam01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fsq&data=02%7C01%7Cmja18%40psu.edu%7C217184753071462c1de808d868c672aa%7C7cf48d453ddb4389a9c1c115526eb52e%7C0%7C0%7C637374548819380576&sdata=gMTKQ9xPmUXmFMx7EDPCXDQSp3%2BoPQictkCnrdEN%2Fh4%3D&reserved=0 SN:Pt LN:140384 @sqhttps://nam01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fsq&data=02%7C01%7Cmja18%40psu.edu%7C217184753071462c1de808d868c672aa%7C7cf48d453ddb4389a9c1c115526eb52e%7C0%7C0%7C637374548819385573&sdata=OJDdIpm5qFWszRhbUmQiIJXO37vwH5yI7LEaMKsXEDA%3D&reserved=0 SN:Mt LN:569630 ....

The code I run the program was as follows:

module load bam2wig module load wigtobigwig

bam2wig PB_ATAC_T2.filtered.bam

Why did the error occur? How to fix it?

Thanks.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://nam01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FMikeAxtell%2Fbam2wig%2Fissues%2F6&data=02%7C01%7Cmja18%40psu.edu%7C217184753071462c1de808d868c672aa%7C7cf48d453ddb4389a9c1c115526eb52e%7C0%7C0%7C637374548819390574&sdata=D57bGgVD2IJOErcrtNvzzRHMGTglw6%2BRwEIjQ615efw%3D&reserved=0, or unsubscribehttps://nam01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FABUJPCKUEMYCTRYEVAMU5KLSJEICBANCNFSM4SEBNJ2A&data=02%7C01%7Cmja18%40psu.edu%7C217184753071462c1de808d868c672aa%7C7cf48d453ddb4389a9c1c115526eb52e%7C0%7C0%7C637374548819395568&sdata=AwezjKaHX%2FDKiygDWN91asNXZ99hRcYm%2B55SGOfPsik%3D&reserved=0.

haowuisu commented 4 years ago

Great, thanks!