Hi! How can I convert a CRAM file to BAM file without using any FASTA file? I found the following command but it doesn't work :
samtools view -bh file.cram -o file.bam
I have downloaded a CRAM file and i should convert it to BAM file but i can't so if there is another command or another way please let me know it. Thanks!
1 answer
Sorry, accidentally deleted my previous answer.
The problem here is that you need the reference fasta file that was used to build the CRAM file in the first place. CRAM uses reference-based compression, so it essentially only stores those nucleotides that (per alignment) are different from the reference. Hence, without reference, you cannot recreate the original sequence (or BAM in this case). The reference is the genome fasta file that was used. For human this is a few GBs in size, not 100G what you say, don't mix it up fastq files, so sequencing data. It is the reference genome sequence that was used to make the CRAM file.
Log in to answer this question.
after running the command it is supposed to convert the file,but through 30 minutes I was looking at the bam file. I found that it is just 112.5kb although the CRAM file is 3.9 Gb! as well as the command doesn't give me any response!
actually, I'm a beginner and learning from the Computational Exome and Genome Analysis book. as it is written:
4.4 1000 GENOMES EXOME DATA For the investigation of de novo variants in Chapter 18 we downloaded WES data for a trio (mother, father, and daughter). The sequences were generated as a part of the 1000 Genomes project [111]. The data can be downloaded at the 1000G FTP site using wget:
The sequence data is compressed in the CRAM format that is de-scribed in Chapter 9. It can be converted to BAM format using the following command.
The NA12891.fasta file is 100Gb I can't download it
Please use
ADD COMMENT/ADD REPLYwhen responding to existing posts to keep threads logically organized.SUBMIT ANSWERis for new answers to original questionThanks to you for drawing my attention.
Can you link the file? A reference fasta file is unlikely to be 100G.
the link of this file: ftp://ftp.ddbj.nig.ac.jp/ddbj_database/dra/sralite/ByExp/litesra/SRX/SRX207/SRX207113/SRR622458/
That is the SRA data file for the sample. It seems to be aligned to the NCBI GRCh37 so that should be the reference you need to use for converting these files.