samtools and docker
1
0
Entering edit mode
6.5 years ago
genya35 ▴ 50

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 • 3.4k views
ADD COMMENT
1
Entering edit mode
6.5 years ago
Eric Lim ★ 2.2k

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
ADD COMMENT
0
Entering edit mode

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?

ADD REPLY
0
Entering edit mode

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

ADD REPLY
0
Entering edit mode

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`;
ADD REPLY

Login before adding your answer.

Traffic: 1600 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6