Entering edit mode
10.2 years ago
marina-orlova
▴
90
Hello!
Can't convert SAM to BAM.
My SAM-file has a header:
@SQ SN:2L AS:FlyBase r5 LN:23011544 SP:Drosophila melanogaster
@SQ SN:2LHet AS:FlyBase r5 LN:368872 SP:Drosophila melanogaster
@SQ SN:2R AS:FlyBase r5 LN:21146708 SP:Drosophila melanogaster
@SQ SN:2RHet AS:FlyBase r5 LN:3288761 SP:Drosophila melanogaster
@SQ SN:3L AS:FlyBase r5 LN:24543557 SP:Drosophila melanogaster
@SQ SN:3LHet AS:FlyBase r5 LN:2555491 SP:Drosophila melanogaster
@SQ SN:3R AS:FlyBase r5 LN:27905053 SP:Drosophila melanogaster
@SQ SN:3RHet AS:FlyBase r5 LN:2517507 SP:Drosophila melanogaster
@SQ SN:4 AS:FlyBase r5 LN:1351857 SP:Drosophila melanogaster
@SQ SN:X AS:FlyBase r5 LN:22422827 SP:Drosophila melanogaster
@SQ SN:XHet AS:FlyBase r5 LN:204112 SP:Drosophila melanogaster
@SQ SN:YHet AS:FlyBase r5 LN:347038 SP:Drosophila melanogaster
@SQ SN:M AS:FlyBase r5 LN:19517 SP:Drosophila melanogaster
@SQ SN:U AS:FlyBase r5 LN:10049159 SP:Drosophila melanogaster
@SQ SN:Uextra AS:FlyBase r5 LN:29004788 SP:Drosophila melanogaster
HWI-EAS146:8:1:3:289#0 16 Uextra 11516293 255 36M * 0 0 NGGAGNCAAATGCCTCGTCATCTAATTAGTGACGCG aaa^_aa\^TG\\LYLY`_`aBBBBBBBBBBBBBBB
HWI-EAS146:8:1:3:289#0 16 Uextra 10227800 255 36M * 0 0 NGGAGNCAAATGCCTCGTCATCTAATTAGTGACGCG aaa^_aa\^TG\\LYLY`_`aBBBBBBBBBBBBBBB
HWI-EAS146:8:1:3:289#0 16 Uextra 20746385 255 36M * 0 0 NGGAGNCAAATGCCTCGTCATCTAATTAGTGACGCG aaa^_aa\^TG\\LYLY`_`aBBBBBBBBBBBBBBB
I write a command:
samtools view -bS file.sam > file.bam
No error is displayed, program stops working successfully but created BAM file can't be opened (The error is: type of archive is not supported).
BAM file can't be opened : by which software ?
Usually I can see content of bam file just with gedit
god kills a kitten every time you're doing this :-)
Thank you for the help) The problem was in running samtools from root (doesn't allow to write files).
You may be talking about sam file. Try running:
samtools view -H file.bam
. This command will show the header of the bam file.Thank you, I saw that the bam file is ok.
But I can't convert it to sorted bam file (and I thought that the mistake was at step of sam-to-bam converting).
I wrote a command:
samtools sort file.bam file_sorted
. the mistake is:As Pierre indicated take some time to go through the samtools manual because most of these are basic stuff. About your sort error: samtools splits the big bam file for sort purpose. It seems that you may have deleted those intermediate files and when samtools tried to merge them it didn't find them. Don't delete any intermediate files until the sort process is done.
Don't ever delete anything while any program is working)
Thank you for your help. The error was that I run program while being in root and it doesn't allow to write files. Too little experience with Linux..
Hi,
I'd suggest mentioning that you're a "linux beginner" in your questions. That would help us tweak our geek levels suitably :-)