BAM to BIGWIG
1
0
Entering edit mode
7.2 years ago

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 • 11k views
ADD COMMENT
2
Entering edit mode

Couldn't find the folder you want to use

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

ADD REPLY
0
Entering edit mode

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'
ADD REPLY
1
Entering edit mode

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

ADD REPLY
0
Entering edit mode

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!

ADD REPLY
0
Entering edit mode

Is'nt the above mentioned python code only converts BAM to wiggle (NOT bigwig) ?

http://github.com/chapmanb/bcbb/blob/master/nextgen/scripts/bam_to_wiggle.py

ADD REPLY
0
Entering edit mode

you need to have wigToBigWig as mentioned in this post

ADD REPLY
0
Entering edit mode

Okay I got it ... Thanks:)

ADD REPLY
0
Entering edit mode

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

ADD REPLY
1
Entering edit mode

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.

ADD REPLY
0
Entering edit mode

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

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?

ADD REPLY
0
Entering edit mode

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

ADD REPLY
0
Entering edit mode

Hello robbenstijn!

It appears that your post has been cross-posted to another site: http://seqanswers.com/forums/showthread.php?t=74398

This is typically not recommended as it runs the risk of annoying people in both communities.

ADD REPLY
7
Entering edit mode
7.2 years ago
EagleEye 7.5k

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

ADD COMMENT

Login before adding your answer.

Traffic: 1928 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