<p>Remove the <code>getAbsolutePath</code> call — your path is already absolute. <code>getAbsolutePath</code> garbles it, as you can see in the error message.</p>

CC BY-SA 3.0
2018-03-13T13:00:32.793Z
By removing the getAbsolutePath call I get the following error:   terminate called after throwing an instance of 'seqan::UnknownExtensionError'
  what():  Unknown file extension of /home/omair/TFG/Files/9827_2#49.bam: iostream error

Process finished with exit code 134 (interrupted by signal 6: SIGABRT)
Omair Iqbal
CC BY-SA 3.0
2018-03-13T13:03:59.577Z
@OmairIqbal Ensure that seqan was compiled with zlib support. See [here for details](https://github.com/seqan/seqan/issues/871).
Devon Ryan
CC BY-SA 3.0
2018-03-13T12:28:25.073Z
2018-03-13T12:28:25.073Z
Konrad Rudolph
<p>When I try to open a simple bam file with the SeqAn library using the following code:</p>

<pre><code>CharString bamFileInName = getAbsolutePath("/home/omair/TFG/Files/9827_2#49.bam")
BamFileIn bamFileIn(toCString(bamFileInName));
</code></pre>

<p>I get the following error:</p>

<pre><code>terminate called after throwing an instance of 'seqan::FileOpenError'
  what():  Could not open file /home/omair/Programs/seqan//home/omair/TFG/Files/9827_2#49.bam: iostream error

Process finished with exit code 134 (interrupted by signal 6: SIGABRT)
</code></pre>

<p>The file exists and the path is correct.</p>

CC BY-SA 3.0
2018-03-12T19:20:10.107Z
cross posted: https://www.biostars.org/p/302804/
Pierre
CC BY-SA 3.0
2018-03-12T21:53:05.720Z
Do you really have a file called `/home/omair/TFG/Files/9827_2#49.bam`? Please [edit] your question and show the exact code you are using. What you have posted has to be a copy/paste error, it makes no sense.
terdon
CC BY-SA 3.0
2018-03-13T15:38:31.640Z
Duplicate of https://bioinformatics.stackexchange.com/questions/3804/cannot-open-bam-files-with-the-seqan-library
Kamil S Jaron
<sam><reads><c++>
While opening a Bam file with the SeqAn library I get 'seqan::FileOpenError'
# While opening a Bam file with the SeqAn library I get 'seqan::FileOpenError'

(Asked by: username_0 on 2018-03-12)

When I try to open a simple bam file with the SeqAn library using the following code:
CharString bamFileInName = getAbsolutePath("/home/omair/TFG/Files/9827_2#49.bam")
BamFileIn bamFileIn(toCString(bamFileInName));

I get the following error:
terminate called after throwing an instance of 'seqan::FileOpenError'
  what():  Could not open file /home/omair/Programs/seqan//home/omair/TFG/Files/9827_2#49.bam: iostream error

Process finished with exit code 134 (interrupted by signal 6: SIGABRT)

The file exists and the path is correct.

**Tags:** sam, reads, c++
> **Comments:**
> **username_1**: cross posted: https://www.biostars.org/p/302804/  
> **username_2**: Do you really have a file called `/home/omair/TFG/Files/9827_2#49.bam`? Please [edit] your question and show the exact code you are using. What you have posted has to be a copy/paste error, it makes no sense.  
> **username_3**: Duplicate of https://bioinformatics.stackexchange.com/questions/3804/cannot-open-bam-files-with-the-seqan-library  

---

## 1 answers

### Answer by username_4 on 2018-03-13. Score: 3

Remove the `getAbsolutePath` call — your path is already absolute. `getAbsolutePath` garbles it, as you can see in the error message.

> **Comments:**
> **username_0**: By removing the getAbsolutePath call I get the following error:   terminate called after throwing an instance of 'seqan::UnknownExtensionError'   what():  Unknown file extension of /home/omair/TFG/Files/9827_2#49.bam: iostream error  Process finished with exit code 134 (interrupted by signal 6: SIGABRT)  
> **username_5**: @OmairIqbal Ensure that seqan was compiled with zlib support. See [here for details](https://github.com/seqan/seqan/issues/871).  

---

