This is a test version of Biostars. For the public version, visit https://www.biostars.org.
samtools and docker

Hello,

I've pull and image secessfully and now trying to run samtools sort, however, docker is not finding the bam file. Any suggestions?

Here is the code:

docker run -v /home/yey/mdl3/results:/data --rm biocontainers/samtools sort \
-T /tmp/HD753_IonXpress_007.sorted  \
-o /home/yey/mdl3/results/HD753_IonXpress_007.sorted.bam /home/yley/mdl3/results/HD753_IonXpress_007.bam

I get an error message "sort: cannot read: /home/yey/mdl3/results/HD753_IonXpress_007.bam: No such file or directory"

Thanks

software docker

1 answer

Your volume is mounted to /data, so you'd need to change your command line to reflect that.

docker run -v /home/yey/mdl3/results:/data --rm biocontainers/samtools sort \
-T /tmp/HD753_IonXpress_007.sorted  \
-o /data/HD753_IonXpress_007.sorted.bam /data/HD753_IonXpress_007.bam

sort command seems to be working but not index command. I get the following error. docker: Error response from daemon: OCI runtime create failed: container_linux.go:348: starting container process caused "exec: \"index\": executable file not found in $PATH": unknown. Is this a known issue?

Instead of using ... biocontainers/samtools index ..., try ... biocontainers/samtools samtools index ... and it should work.

Thanks, sort and index seem to work, however, can't get view command to work. Does not produce any error messages but doesn't make a smaller bam based on the position provided. I've tested this code and file on a different machine where samtools was intalled and it worked.

Here is the code:

my $bam_file_sorted = "/data/HD753_IonXpress_007.sorted.bam"; 
my $bam_folder_dir = "/home/yey/mdl3/results/SN2-280-OFA_TL127067_051418_AAB";

my $chr = 7;
my $new_start_position = 55242330;
my $new_end_position = 55242615;

my $position_string = "chr".$chr.":".$new_start_position."-".$new_end_position;
my $smaller_bam_name = "/data/HD753_IonXpress_007_region_EGFR_e20.bam";

my $cmd3 = `docker run -v $bam_folder_dir:/data --rm biocontainers/samtools samtools view -hb $bam_file_sorted $position_string > $smaller_bam_name`;

Log in to answer this question.