Cram files: failed to populate reference on Travis CI

448 views
Skip to first unread message

Wouter De Coster

unread,
Dec 1, 2017, 11:24:07 AM12/1/17
to Pysam User group
Hi,

When I process a cram file on my server everything works fine, no errors. When I do the same on Travis CI I get the following:

[E::cram_get_ref] Failed to populate reference for id 0
[E::cram_decode_slice] Unable to fetch reference #0 1..2100774
[E::cram_next_slice] Failure to decode slice

I reasoned that this is the case because it cannot find the reference fasta with which the cram file was made, so I included the reference in the test dataset.
My test data is a GitHub repo which gets cloned for testing on Travis CI (https://github.com/wdecoster/nanotest). 

However, the path in the cram header is an absolute path on my computer, and the path on Travis CI is obviously not the same.
I guess if I could specify in pysam which reference fasta to use everything would be fine? I guess pysam/samtools attempts to fetch the reference fasta.
Or should I manually adapt the cram header to get a relative path to the reference?

Do you have suggestions on how to fix this?

Cheers,
Wouter

Andreas Heger

unread,
Dec 4, 2017, 3:39:21 PM12/4/17
to pysam-us...@googlegroups.com
Hi Wouter,

AlignmentFile() accepts to option 'reference_name':

reference_filename : string
Path to a FASTA-formatted reference file. Valid only for CRAM
files.
When reading a CRAM file, this overrides both ``$REF_PATH`` and
the URL
specified in the header (``UR`` tag), which are normally used
to find
the reference.

Best wishes,
Andreas
> --
> You received this message because you are subscribed to the Google
> Groups "Pysam User group" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to pysam-user-gro...@googlegroups.com
> <mailto:pysam-user-gro...@googlegroups.com>.
> For more options, visit https://groups.google.com/d/optout.

Wouter De Coster

unread,
Dec 4, 2017, 4:08:27 PM12/4/17
to Pysam User group
Hi Andreas,

Great, that should fix it. Thanks!
I've looked for something like this in the documentation, is it possible that it's undocumented? Or perhaps I just looked in the wrong places...

Cheers,
Wouter

Wouter De Coster

unread,
Dec 5, 2017, 3:58:43 AM12/5/17
to pysam-us...@googlegroups.com
On second thought, that doesn't solve it. I can't hardcode a path to a reference file just for testing applications. Guess I'll see if I can convert the bam to cram on Travis CI.

--
You received this message because you are subscribed to a topic in the Google Groups "Pysam User group" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/pysam-user-group/gSHniBzljcw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to pysam-user-group+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages