# Samtool merge error after HISAT2

**URL:** https://help.galaxyproject.org/t/samtool-merge-error-after-hisat2/4190
**Category:** usegalaxy.org support
**Tags:** mapping, server-side-error, samtools
**Created:** [July 29, 2020, 12:22pm UTC](https://help.galaxyproject.org/t/samtool-merge-error-after-hisat2/4190 "2020-07-29T12:22:38Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![jnguyen1](https://sea2.discourse-cdn.com/flex020/user_avatar/help.galaxyproject.org/jnguyen1/32/4914_2.png) [@jnguyen1](https://help.galaxyproject.org/u/jnguyen1)
#### Post date: [July 29, 2020, 12:22pm UTC](https://help.galaxyproject.org/t/samtool-merge-error-after-hisat2/4190/1 "2020-07-29T12:22:38Z")

</div>

Hi,  
I have used samtool merge with a couple of HISAT2 bam files, and when completed, although the datasets are green, I get the following error:

[E::idx\_find\_and\_load] Could not retrieve index file for ‘/galaxy-repl/main/files/043/098/dataset\_43098901.dat’  
[E::idx\_find\_and\_load] Could not retrieve index file for ‘/galaxy-repl/main/files/043/098/dataset\_43098901.dat’

The samtool merge .bam file can be opened on IGV, but when I try to convert it to .tdf file for normalisation, I get the message “error: null”, so I think something is wrong with the samtool merge step.

I have used the following settings:

Samtools merge

Dataset Information

| Number: | 54 |
| --- | --- |
| Name: | Samtools merge on data 50 and data 49 |
| Created: | Sun Jul 26 09:21:13 2020 (UTC) |
| Filesize: | 3.4 GB |
| Dbkey: | hg\_g1k\_v37 |
| Format: | bam |

### Job Information

| Galaxy Tool ID: | toolshed.g2.bx.psu.edu/repos/iuc/samtools\_merge/samtools\_merge/1.9 |
| --- | --- |
| Galaxy Tool Version: | 1.9 |
| Tool Version: | Version: 1.9 (using htslib 1.9) |
| Tool Standard Output: | [stdout](https://usegalaxy.org/datasets/bbd44e69cb8906b59ff9cf8439d59652/stdout) |
| Tool Standard Error: | [stderr](https://usegalaxy.org/datasets/bbd44e69cb8906b59ff9cf8439d59652/stderr) |
| Tool Exit Code: | 0 |
| History Content API ID: | bbd44e69cb8906b59ff9cf8439d59652 |
| Job API ID: | bbd44e69cb8906b5cdcb8eff35777ca2 |
| History API ID: | d8a0c9490972cc7d |
| UUID: | edacc3d6-bcae-454e-919a-ba6e487dff6a |

Tool Parameters

| Input Parameter | Value |
| --- | --- |
| Alignments in BAM format | \* [49: HISAT2 on data 14 and data 13: aligned reads (BAM)](https://usegalaxy.org/datasets/bbd44e69cb8906b583c11402263c1fd9/show_params) |
| \* [50: HISAT2 on data 22 and data 21: aligned reads (BAM)](https://usegalaxy.org/datasets/bbd44e69cb8906b5e5cf26e04bec2566/show_params) | |
| Merge files in a region | Empty. |
| File to take @ headers from | |
| Make @ RG headers unique | False |
| Make @ PG headers unique | False |
| random seed | 1 |

Inheritance Chain

Samtools merge on data 50 and data 49

Job Dependencies

| Dependency | Dependency Type | Version |
| --- | --- | --- |
| samtools | conda | 1.9 |

Dataset peek

Binary bam alignments file

* * *

TIA

---

<div class="post-metadata">

### Author: ![astrov](https://sea2.discourse-cdn.com/flex020/user_avatar/help.galaxyproject.org/astrov/32/957_2.png) [@astrov](https://help.galaxyproject.org/u/astrov)
#### Post date: [July 29, 2020, 7:55pm UTC](https://help.galaxyproject.org/t/samtool-merge-error-after-hisat2/4190/2 "2020-07-29T19:55:30Z")

</div>

Are you able to run igv and perform the conversion on the original files before the merge?

---

<div class="post-metadata">

### Author: ![jnguyen1](https://sea2.discourse-cdn.com/flex020/user_avatar/help.galaxyproject.org/jnguyen1/32/4914_2.png) [@jnguyen1](https://help.galaxyproject.org/u/jnguyen1)
#### Post date: [July 30, 2020, 11:39am UTC](https://help.galaxyproject.org/t/samtool-merge-error-after-hisat2/4190/3 "2020-07-30T11:39:35Z")

</div>

Hi,  
Yes I was able to convert the original bam files to tdf in IGV before the merge.  
So that means the problem lies somewhere with the samtool merge?

---

<div class="post-metadata">

### Author: ![wm75](https://sea2.discourse-cdn.com/flex020/user_avatar/help.galaxyproject.org/wm75/32/56_2.png) [@wm75](https://help.galaxyproject.org/u/wm75)
#### Post date: [July 30, 2020, 3:00pm UTC](https://help.galaxyproject.org/t/samtool-merge-error-after-hisat2/4190/4 "2020-07-30T15:00:23Z")

</div>

I don’t know how to assist with the IGV conversion issue itself, but if it helps excluding error sources:

> [@jnguyen1](#):
>
> [E::idx\_find\_and\_load] Could not retrieve index file for ‘/galaxy-repl/main/files/043/098/dataset\_43098901.dat’  
> [E::idx\_find\_and\_load] Could not retrieve index file for ‘/galaxy-repl/main/files/043/098/dataset\_43098901.dat’

You are currently getting this stderr message for _every_ BAM dataset because of what looks like a bug in the latest release of Galaxy. AFAIK, the BAM dataset itself is unaffected by this and will work just fine in downstream analyses.

---

<div class="post-metadata">

### Author: ![astrov](https://sea2.discourse-cdn.com/flex020/user_avatar/help.galaxyproject.org/astrov/32/957_2.png) [@astrov](https://help.galaxyproject.org/u/astrov)
#### Post date: [July 30, 2020, 5:42pm UTC](https://help.galaxyproject.org/t/samtool-merge-error-after-hisat2/4190/5 "2020-07-30T17:42:20Z")

</div>

Are you able to run any other tools successfully with the new set?

---

<div class="post-metadata">

### Author: ![jnguyen1](https://sea2.discourse-cdn.com/flex020/user_avatar/help.galaxyproject.org/jnguyen1/32/4914_2.png) [@jnguyen1](https://help.galaxyproject.org/u/jnguyen1)
#### Post date: [August 1, 2020, 10:12am UTC](https://help.galaxyproject.org/t/samtool-merge-error-after-hisat2/4190/7 "2020-08-01T10:12:26Z")

</div>

But I can’t use it for my tpm analyses because of the conversion.  
Should I wait for a new release and redo this when the bug isn’t in it anymore?

---

<div class="post-metadata">

### Author: ![jnguyen1](https://sea2.discourse-cdn.com/flex020/user_avatar/help.galaxyproject.org/jnguyen1/32/4914_2.png) [@jnguyen1](https://help.galaxyproject.org/u/jnguyen1)
#### Post date: [August 1, 2020, 10:13am UTC](https://help.galaxyproject.org/t/samtool-merge-error-after-hisat2/4190/8 "2020-08-01T10:13:04Z")

</div>

@astrov can only load the sam set on IGV, nothing else

---

<div class="post-metadata">

### Author: ![wm75](https://sea2.discourse-cdn.com/flex020/user_avatar/help.galaxyproject.org/wm75/32/56_2.png) [@wm75](https://help.galaxyproject.org/u/wm75)
#### Post date: [August 3, 2020, 6:33am UTC](https://help.galaxyproject.org/t/samtool-merge-error-after-hisat2/4190/9 "2020-08-03T06:33:08Z")

</div>

I guess you misunderstood what I was trying to say.  
My point was that the error message you’re seeing in Galaxy is most likely _unrelated_ to your issue. Don’t consider it in your debugging efforts, that’s all I wanted to say.
