BSSeeker / BSseeker2

A versatile aligning pipeline for bisulfite sequencing data
http://pellegrini.mcdb.ucla.edu/BS_Seeker2/
MIT License
60 stars 25 forks source link

Passing parameters to the pysam.sort() #9

Closed markmcdowall closed 7 years ago

markmcdowall commented 8 years ago

Hi,

When running the bs_seeker2-call_methylation.py script I was finding that it failed to correctly pass the input and output bam files to the pysam.sort() function.

I found that by changing line 106 from:

pysam.sort(options.infilename, sorted_input_filename)

to

pysam.sort("-o", sorted_input_filename + '.bam', "-T", sorted_input_filename, options.infilename)

fixed the issue that I was having.

I am using python 2.7.5 and I am on the master branch of BS-Seeker2 which was checked out on the 28th July.

Hope that this helps,

Mark

guoweilong commented 8 years ago

Dear Mark,

Thanks for writing me this comment.

May I know which system you were working on? Linux or Mac?

Could you also paste the reported message to me? Thanks a lot.

I'll keep tracking of it.

Best, Weilong

markmcdowall commented 8 years ago

Hi Weilong,

I'm using Linux RHEL 7 and the output is:

$ time python bs_seeker2-call_methylation.py --input=datasets/PRJNA257496/GSM1465024/tmp/SRR1536575_1.filtered.matching_1.fastq_bspe.bam --output-prefix=output --db=bs_utils/reference_genomes/GCA_000001405.22.fa_bowtie2/

     BS-Seeker2 v2.0.10 - Nov 5, 2015

[2016-08-03 08:09:01] sorting BS-Seeker alignments
Traceback (most recent call last):
  File "bs_seeker2-call_methylation.py", line 106, in <module>
    pysam.sort(options.infilename, sorted_input_filename)
  File "env/lib/python2.7/site-packages/pysam/utils.py", line 75, in __call__
    stderr))
pysam.utils.SamtoolsError: 'samtools returned with error 1: stdout=, stderr=[bam_sort] Use -T PREFIX / -o FILE to specify temporary and final output files\nUsage: samtools sort [options...] [in.bam]\nOptions:\n  -l INT     Set compression level, from 0 (uncompressed) to 9 (best)\n  -m INT     Set maximum memory per thread; suffix K/M/G recognized [768M]\n  -n         Sort by read name\n  -o FILE    Write final output to FILE rather than standard output\n  -T PREFIX  Write temporary files to PREFIX.nnnn.bam\n  -@, --threads INT\n             Set number of sorting and compression threads [1]\n      --input-fmt-option OPT[=VAL]\n               Specify a single input file format option in the form\n               of OPTION or OPTION=VALUE\n  -O, --output-fmt FORMAT[,OPT[=VAL]]...\n               Specify output format (SAM, BAM, CRAM)\n      --output-fmt-option OPT[=VAL]\n               Specify a single output file format option in the form\n               of OPTION or OPTION=VALUE\n      --reference FILE\n               Reference sequence FASTA FILE [null]\n'

real    0m0.196s
user    0m0.041s
sys     0m0.022s

Cheers,

Mark

guoweilong commented 7 years ago

@markmcdowall Just notice not finished this conversation.

This problem should have been finished in the latest version.

Best, Weilong