This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Using samtools with GCS (google cloud storage) on a docker container seems to give "Protocol Not Supported" error

enter image description hereHaving an issue trying to use the samtools view gs://mybucket/myfile.bam > myfile.bam when using this command with docker.

Always get the error "samtools view: failed to open "gs://mybucket/myfile.bam" for reading: Protocol not supported"

Although the command works just fine GCP VMs, Im unable to recreate this in a docker container.

samtools gcs

This is a bit late, but the first thing to go is to run samtools --version and make sure the docker samtools is configured with the the GCS protocols.

1 answer

export GOOGLE_APPLICATION_CREDENTIALS="./credentials.json"
export GCS_OAUTH_TOKEN=$(gcloud auth print-access-token)

gcloud storage cp <yourbai.bai> mybai.bai

#Download specific chromosome of BAM file
samtools view -h -b -L chr1 mybai.bai gcs://mybam.bam > "mybam.bam"

I have got it to work with this sort of script.

Log in to answer this question.