This is a test version of Biostars. For the public version, visit https://www.biostars.org.
BAM to BIGWIG

I'm trying to convert a BAM file to a BIGWIG file on my mac using the following link:

https://github.com/chapmanb/bcbb/blo...m_to_wiggle.py

Could someone explain what commands I have to put into the terminal (or in Sublime Text)? My BAM file is called Galaxy6RmDupdata.bam. I couldn't figure this out myself from the explanation in the link itself. Any help would be greatly appreciated!

Many thanks,

Stijn

github bam bigwig terminal

Couldn't find the folder you want to use

For running a python script : ./ script.py or python script.py

I tried this, but when I run:

python BAM_BIGWIG.py Galaxy6RmDupdata.bam (Galaxy6RmDupdata.bam is the name of my bam file)

I get:

Traceback (most recent call last):
  File "BAM_BIGWIG.py", line 136, in <module>
    main(*args, **kwargs)
  File "BAM_BIGWIG.py", line 62, in main
    convert_to_bigwig(wig_file, chr_sizes, config, outfile)
  File "BAM_BIGWIG.py", line 108, in convert_to_bigwig
    cl = [get_program("ucsc_bigwig", config, default="wigToBigWig"), wig_file, size_file, bw_file]
  File "/Users/Stijn/anaconda/lib/python2.7/site-packages/bcbio/pipeline/config_utils.py", line 188, in get_program
    return _get_program_cmd(name, pconfig, config, default)
  File "/Users/Stijn/anaconda/lib/python2.7/site-packages/bcbio/pipeline/config_utils.py", line 214, in wrap
    raise CmdNotFound(" ".join(map(repr, (fn.func_name, name, pconfig, default))))
bcbio.pipeline.config_utils.CmdNotFound: '_get_program_cmd' 'ucsc_bigwig' {'cmd': 'wigToBigWig', 'dir': 'wigToBigWig'} 'wigToBigWig'

I still can't find your python file Are you sure about the usage of the script?

I renamed the bam_to_wiggle.py file from the link above to BAM_BIGWIG.py. Does this answer your question?

Thanks for your help btw!

Okay I got it ... Thanks:)

Yes about that, do you know how to install this?

What I did was that i went to this link: http://hgdownload.cse.ucsc.edu/admin/exe/ Clicked on macOSX.i386/ Clicked on wigToBigWig And then this file started to download. But I'll probably need to install it right? Now I posted it in the same directory as the python file, but it still gives the same error messages as is shown above... Also the command pip install wigToBigWig in the terminal doesn't work, this only gives:

Could not find a version that satisfies the requirement wigToBigWig (from versions: ) No matching distribution found for wigToBigWig

There is no installation needed. You are downloading a pre-compiled program. You may need to add execute permissions by doing sudo chmod u+x wigToBigWig. After that you can run it like ./wigToBigWig options from the directory where it is located.

I did just that and it worked. Now I get another error, would you happen to know what it means? Thanks!

Traceback (most recent call last):
  File "BAM_BIGWIG.py", line 136, in <module>
    main(*args, **kwargs)
  File "BAM_BIGWIG.py", line 62, in main
    convert_to_bigwig(wig_file, chr_sizes, config, outfile)
  File "BAM_BIGWIG.py", line 109, in convert_to_bigwig
    subprocess.check_call(cl)
  File "/Users/Stijn/anaconda/lib/python2.7/subprocess.py", line 181, in check_call
    retcode = call(*popenargs, **kwargs)
  File "/Users/Stijn/anaconda/lib/python2.7/subprocess.py", line 168, in call
    return Popen(*popenargs, **kwargs).wait()
  File "/Users/Stijn/anaconda/lib/python2.7/subprocess.py", line 390, in __init__
    errread, errwrite)
  File "/Users/Stijn/anaconda/lib/python2.7/subprocess.py", line 1024, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory

Error is about not finding a file/directory in your $PATH or the directly where you are running the command from. Can you post the full command you used?

Are you sure that your version of macOS is 32 bit and not 64 bit. Try with 'macOSX.x86_64/' version.

1 answer

1) samtools mpileup: Convert BAM to wiggle

2) twoBitInfo: Calculate chromosome sizes for hg19 or any genome you are dealing with

3) wigToBigWig: wiggle to bigWig

Note: For macOS select tool for appropriate OS from here

Log in to answer this question.