On Tue, 11 Jul 2017, Amelia Lawrence wrote:

I am currently using a python package methylpy, which uses samtools as a
dependency. When calling samtools in the package script I'm getting a
binary output in my terminal window. When viewing the package code I see
two different methods of calling samtools, one that is active and one that
is inactive. I was wondering if the code that is active is somehow wrong
and I should be using the inactive code when calling samtools, and was
hoping that you would be able to point me in the right direction.

Active python code:

subprocess.check_call(shlex.split(path_to_samtools+"samtools sort
"+path_to_files+sample+"_processed_reads_"+str(current_library)+"_no_clonal.bam
-o
"+path_to_files+sample+"_processed_reads_"+str(current_library)+"_no_clonal.bam"))

Inactive python Code:

   #subprocess.check_call(shlex.split(path_to_samtools+"samtools sort
"+path_to_files+sample+"_processed_reads_"+str(current_library)+"_no_clonal.bam
"+path_to_files+sample+"_processed_reads_"+str(current_library)+"_no_clonal"))

In version 1.0, the way you specify the output file to samtools sort changed. The python script has been updated to use the new method. The old way of invoking sort was removed in version 1.3.

Also, when run with a file (CG-16C-N_S18_L004_R1_001) it seems to be saying
my input is the same as my output (see below). This was all done with the
active code.

/usr/local/intel64/broadwell/gcc/samtools-0.1.19/bin//samtools sort
CG-16C-N_S18_L004_R1_001_processed_reads_libA_no_clonal.bam -o
CG-16C-N_S18_L004_R1_001_processed_reads_libA_no_clonal.bam


Any advice on the matter would be greatly appreciated. Thank you very much
for your time.

It looks like you're using samtools-0.1.19. You should upgrade to the latest release (currently 1.5). It has a lot of improvements over the earlier versions.

The instructions on the methylpy wiki page
(https://bitbucket.org/schultzmattd/methylpy/wiki/Installing%20methylpy)
are a bit misleading, as they have an example of how to download samtools-0.1.19 but tell you to "update the link in the wget line with the link to the latest version". They should update their instructions so that the link at least points to a version that works with their software.

You are correct that methylpy it using the same file name for the input and output. This works because sort reads the entire input file before overwiting it with the output one. It's generally not a good idea as if sort fails you can end up losing the input file, but it's safe if the file being sorted is an intermediate one and the original data is intact elsewhere. You would need to discuss the wisdom of doing this with the methylpy developers.

Rob Davies              r...@sanger.ac.uk
The Sanger Institute    http://www.sanger.ac.uk/
Hinxton, Cambs.,        Tel. +44 (1223) 834244
CB10 1SA, U.K.          Fax. +44 (1223) 494919


--
The Wellcome Trust Sanger Institute is operated by Genome Research Limited, a charity registered in England with number 1021457 and a company registered in England with number 2742969, whose registered office is 215 Euston Road, London, NW1 2BE.
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Samtools-help mailing list
Samtools-help@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/samtools-help

Reply via email to