Skip to content

samtools reheader: fail to open temp file 'reheaderKIWo81': Permission denied #2165

Description

@YuanfengZhang

Are you using the latest version of samtools and HTSlib? If not, please specify.

(run samtools --version) YES, v1.21.

Please describe your environment.

  • OS Linux AMD64
  • gcc(Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0

Please specify the steps taken to generate the issue, the command you are running and the relevant output.

  1. Running the following command line on a cloud server where I have no permission of the /tmp dir for my submitted job:
samtools reheader -c 'sed -E "
    s/NC_000015\.10/chr15/g;
    s/NC_000022\.11/chr22/g;
    s/NC_000004\.12/chr4/g;
    s/NC_000007\.14/chr7/g;
    s/NC_000002\.12/chr2/g;
    s/NC_000012\.12/chr12/g;
    s/NC_000019\.10/chr19/g;
    s/NC_000014\.9/chr14/g;
    s/NC_000006\.12/chr6/g;
    s/NC_000020\.11/chr20/g;
    s/NC_000018\.10/chr18/g;
    s/NC_000021\.9/chr21/g;
    s/NC_000017\.11/chr17/g;
    s/NC_000001\.11/chr1/g;
    s/NC_000005\.10/chr5/g;
    s/NC_000013\.11/chr13/g;
    s/NC_000008\.11/chr8/g;
    s/NC_012920\.1/chrM/g;
    s/NC_000016\.10/chr16/g;
    s/NC_000003\.12/chr3/g;
    s/NC_000024\.10/chrY/g;
    s/NC_000010\.11/chr10/g;
    s/NC_000009\.12/chr9/g;
    s/NC_000011\.10/chr11/g;
    s/NC_000023\.11/chrX/g;
"' "${mapped_dir}/ax.bam" > "${refined_dir}/ax.bam"

Error:

samtools reheader: fail to open temp file 'reheaderKIWo81': Permission denied
[main_reheader] failed to read the header from 'sed -E "
s/NC_000015\.10/chr15/g;
s/NC_000022\.11/chr22/g;
s/NC_000004\.12/chr4/g;
s/NC_000007\.14/chr7/g;
s/NC_000002\.12/chr2/g;
s/NC_000012\.12/chr12/g;
s/NC_000019\.10/chr19/g;
s/NC_000014\.9/chr14/g;
s/NC_000006\.12/chr6/g;
s/NC_000020\.11/chr20/g;
s/NC_000018\.10/chr18/g;
s/NC_000021\.9/chr21/g;
s/NC_000017\.11/chr17/g;
s/NC_000001\.11/chr1/g;
s/NC_000005\.10/chr5/g;
s/NC_000013\.11/chr13/g;
s/NC_000008\.11/chr8/g;
s/NC_012920\.1/chrM/g;
s/NC_000016\.10/chr16/g;
s/NC_000003\.12/chr3/g;
s/NC_000024\.10/chrY/g;
s/NC_000010\.11/chr10/g;
s/NC_000009\.12/chr9/g;
s/NC_000011\.10/chr11/g;
s/NC_000023\.11/chrX/g;
"'.
  1. save the sed cmdln as sed_script.txt, run this:
samtools reheader \
    -c "sed -E -f ${debug_dir}/sed_script.txt"
    "${mapped_dir}/ax.bam" > "${refined_dir}/ax.bam"

The error is the same.

  1. run the same cmdln on my local Ubuntu server where I can access the /tmp dir, the reheader succeeds.
  2. tricks like ln -s $(pwd) /tmp do not work.
  3. There is no -T option for reheader like some other functions.

If my prediction is true, maybe you should generalize the -T option to all the functions?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions