# bam2wig.py \_ error when converting BAM to Wiggle

**URL:** https://help.galaxyproject.org/t/bam2wig-py-error-when-converting-bam-to-wiggle/6198
**Category:** usegalaxy.org support
**Tags:** troubleshooting
**Created:** [June 14, 2021, 10:17am UTC](https://help.galaxyproject.org/t/bam2wig-py-error-when-converting-bam-to-wiggle/6198 "2021-06-14T10:17:05Z")
**Posts on this page:** 12
**Page:** 1

<div class="post-metadata">

### Author: ![AliciaNevers](https://avatars.discourse-cdn.com/v4/letter/a/71c47a/32.png) [@AliciaNevers](https://help.galaxyproject.org/u/AliciaNevers)
#### Post date: [June 14, 2021, 10:17am UTC](https://help.galaxyproject.org/t/bam2wig-py-error-when-converting-bam-to-wiggle/6198/1 "2021-06-14T10:17:05Z")

</div>

I aligned RNA-seq reads against a custom-build reference genome using Bowtie2. I use the produced BAM with a “chromosom” txt file to generate a WIG file using “BAM to Wiggle” but I get a message error…

**Execution resulted in the following messages:**  
“Fatal error: Exit code 1 (An error occured during execution, see stderr and stdout for more information)”  
“Fatal error: An error occured during execution, see stderr and stdout for more information”

**Tool generated the following standard error:**  
“Processing CP004075.1 …  
Processing CP001179.1 …  
Traceback (most recent call last):  
File “/cvmfs/main.galaxyproject.org/deps/\_conda/envs/\_\_rseqc@2.6.4/bin/bam2wig.py”, line 105, in   
main()  
File “/cvmfs/main.galaxyproject.org/deps/\_conda/envs/\_\_rseqc@2.6.4/bin/bam2wig.py”, line 102, in main  
obj.bamTowig(outfile = options.output\_prefix, chrom\_sizes = chromSizes, chrom\_file = options.chromSize, q\_cut = options.map\_qual, skip\_multi=options.skip\_multi,strand\_rule = options.strand\_rule, WigSumFactor=norm\_factor)  
File “/cvmfs/main.galaxyproject.org/deps/\_conda/envs/\_\_rseqc@2.6.4/lib/python2.7/site-packages/qcmodule/SAM.py”, line 2597, in bamTowig  
if strandRule[key] == ‘+’:Fwig[pos] +=1.0  
KeyError: ‘+’”

Could anyone help me please?  
Thanks,  
Alicia

---

<div class="post-metadata">

### Author: ![gallardoalba](https://sea2.discourse-cdn.com/flex020/user_avatar/help.galaxyproject.org/gallardoalba/32/1903_2.png) [@gallardoalba](https://help.galaxyproject.org/u/gallardoalba)
#### Post date: [June 14, 2021, 7:51pm UTC](https://help.galaxyproject.org/t/bam2wig-py-error-when-converting-bam-to-wiggle/6198/2 "2021-06-14T19:51:53Z")

</div>

Hi @AliciaNevers,  
according to the [source code](https://github.com/dnanexus/rseqc/blob/master/rseqc/lib/qcmodule/SAM.py#L2599), there is a problem with the StrandRule; which kind of reads are you using (single or paired) and which output did you get from [Infer experiment](https://usegalaxy.eu/root?tool_id=toolshed.g2.bx.psu.edu/repos/nilesh/rseqc/rseqc_infer_experiment/2.6.4.1).

Regards

---

<div class="post-metadata">

### Author: ![AliciaNevers](https://avatars.discourse-cdn.com/v4/letter/a/71c47a/32.png) [@AliciaNevers](https://help.galaxyproject.org/u/AliciaNevers)
#### Post date: [June 14, 2021, 8:39pm UTC](https://help.galaxyproject.org/t/bam2wig-py-error-when-converting-bam-to-wiggle/6198/3 "2021-06-14T20:39:40Z")

</div>

Thanks for your answer.  
I didn’t try the infer experiment, is it mandatory?  
My reads are single for this experiment. But I tried to run again a previous job with Paired-end reads from another experiment using “Bam to wiggle” code. I did’nt work either this time whereas it gave me nice coverage files a year ago…

Regards  
Alicia

---

<div class="post-metadata">

### Author: ![AliciaNevers](https://avatars.discourse-cdn.com/v4/letter/a/71c47a/32.png) [@AliciaNevers](https://help.galaxyproject.org/u/AliciaNevers)
#### Post date: [June 14, 2021, 8:42pm UTC](https://help.galaxyproject.org/t/bam2wig-py-error-when-converting-bam-to-wiggle/6198/4 "2021-06-14T20:42:51Z")

</div>

![Capture d'écran 2021-06-14 22.40.39](https://us1.discourse-cdn.com/flex020/uploads/galaxy/original/2X/e/efa71428ec6117b97445115d9018065127076f4a.png)  
 ![Capture d'écran 2021-06-14 22.42.00](https://us1.discourse-cdn.com/flex020/uploads/galaxy/original/2X/a/a67a2f68342c96aa7dc38b571e42bf9d094f9544.png)

---

<div class="post-metadata">

### Author: ![gallardoalba](https://sea2.discourse-cdn.com/flex020/user_avatar/help.galaxyproject.org/gallardoalba/32/1903_2.png) [@gallardoalba](https://help.galaxyproject.org/u/gallardoalba)
#### Post date: [June 17, 2021, 6:36pm UTC](https://help.galaxyproject.org/t/bam2wig-py-error-when-converting-bam-to-wiggle/6198/5 "2021-06-17T18:36:06Z")

</div>

> [@AliciaNevers](#):
>
> . But I tried to run again a previous job with Paired-end reads from another experiment using “Bam to wiggle” code. I did’nt work either this time whereas it gave me nice coverage files a year ago…

Hi @AliciaNevers,  
could you repeat the analysis with the previous tool version? [Bam to Wiggle 2.4](https://usegalaxy.eu/root?tool_id=toolshed.g2.bx.psu.edu/repos/nilesh/rseqc/rseqc_bam2wig/2.4galaxy1). If it works then we can confirm that there’s a bug in the last update.

Regards

---

<div class="post-metadata">

### Author: ![AliciaNevers](https://avatars.discourse-cdn.com/v4/letter/a/71c47a/32.png) [@AliciaNevers](https://help.galaxyproject.org/u/AliciaNevers)
#### Post date: [June 17, 2021, 8:10pm UTC](https://help.galaxyproject.org/t/bam2wig-py-error-when-converting-bam-to-wiggle/6198/6 "2021-06-17T20:10:49Z")

</div>

I’m sorry but I can’t use this previous update on the regular [usegalaxy.org](http://usegalaxy.org) and I don’t know how to transfer my account to Galaxy europe… When I try to log in with my informations on Galaxy europe i’m not recognized.  
Could you send me the link for [usegalaxy.org](http://usegalaxy.org) please?

Thanks a lot,  
Alicia

---

<div class="post-metadata">

### Author: ![gallardoalba](https://sea2.discourse-cdn.com/flex020/user_avatar/help.galaxyproject.org/gallardoalba/32/1903_2.png) [@gallardoalba](https://help.galaxyproject.org/u/gallardoalba)
#### Post date: [June 18, 2021, 3:23pm UTC](https://help.galaxyproject.org/t/bam2wig-py-error-when-converting-bam-to-wiggle/6198/7 "2021-06-18T15:23:24Z")

</div>

Hi @AliciaNevers,  
unfortunately, this is not available in [usegalaxy.org](http://usegalaxy.org), but if you share with me your history I can test it in the European instance. I’ll provide you my mail by DM.

Regards

---

<div class="post-metadata">

### Author: ![AliciaNevers](https://avatars.discourse-cdn.com/v4/letter/a/71c47a/32.png) [@AliciaNevers](https://help.galaxyproject.org/u/AliciaNevers)
#### Post date: [June 18, 2021, 3:40pm UTC](https://help.galaxyproject.org/t/bam2wig-py-error-when-converting-bam-to-wiggle/6198/8 "2021-06-18T15:40:29Z")

</div>

Hi,

Ok, I understand… What is a DM?

Can I copy the link here or you wouldn’t do like that?

Thanks in advance,

Regards,

Alicia

---

<div class="post-metadata">

### Author: ![gallardoalba](https://sea2.discourse-cdn.com/flex020/user_avatar/help.galaxyproject.org/gallardoalba/32/1903_2.png) [@gallardoalba](https://help.galaxyproject.org/u/gallardoalba)
#### Post date: [June 19, 2021, 12:53pm UTC](https://help.galaxyproject.org/t/bam2wig-py-error-when-converting-bam-to-wiggle/6198/9 "2021-06-19T12:53:10Z")

</div>

Hi @AliciaNevers,  
I repeated the analysis in the previous version and it ran fine, then the problem seems to be related to the last update. I’ll review it.

Regards

---

<div class="post-metadata">

### Author: ![AliciaNevers](https://avatars.discourse-cdn.com/v4/letter/a/71c47a/32.png) [@AliciaNevers](https://help.galaxyproject.org/u/AliciaNevers)
#### Post date: [June 19, 2021, 2:27pm UTC](https://help.galaxyproject.org/t/bam2wig-py-error-when-converting-bam-to-wiggle/6198/10 "2021-06-19T14:27:48Z")

</div>

Thanks a lot for your help, your were really efficient!  
I will wait for it to be fixed then.

Regards,  
Alicia

---

<div class="post-metadata">

### Author: ![gallardoalba](https://sea2.discourse-cdn.com/flex020/user_avatar/help.galaxyproject.org/gallardoalba/32/1903_2.png) [@gallardoalba](https://help.galaxyproject.org/u/gallardoalba)
#### Post date: [June 22, 2021, 12:02pm UTC](https://help.galaxyproject.org/t/bam2wig-py-error-when-converting-bam-to-wiggle/6198/11 "2021-06-22T12:02:44Z")

</div>

Hi @AliciaNevers,  
after testing again the datasets, I found that the latest version works fine in the [usegalaxy.eu](http://usegalaxy.eu). I created an issue in order to report the problem [https://github.com/galaxyproject/tools-iuc/issues/3751](https://github.com/galaxyproject/tools-iuc/issues/3751).

Regards

---

<div class="post-metadata">

### Author: ![jennaj](https://sea2.discourse-cdn.com/flex020/user_avatar/help.galaxyproject.org/jennaj/32/27_2.png) [@jennaj](https://help.galaxyproject.org/u/jennaj)
#### Post date: [December 21, 2023, 11:04pm UTC](https://help.galaxyproject.org/t/bam2wig-py-error-when-converting-bam-to-wiggle/6198/12 "2023-12-21T23:04:52Z")

</div>


