mcfrith / last-rna

MIT License
48 stars 6 forks source link

retaining sam headers maf to sam #4

Closed LordGenome closed 6 years ago

LordGenome commented 6 years ago

Hi, this may be a samtools question, apologies if that is the case. I'm trying to samtools view the sam file to bam, but it complains there is no header.

head_100_myseq.sam.txt head_100_myseq.maf.txt

This is what I did from the fastq file: $ awk 'NR % 4 == 2 {print ">" ++n "\n" $0}' myseq.fastq > myseq.fa $ last-train -P3 /Reference_Sequence/chromFa/chrX/mydb myseq.fa > myseq.par $ lastal -P8 -p myseq.par /Volumes/GRT01_8TB/FMR1_runs/Reference_Sequence/chromFa/chrX/mydb myseq.fa $ last-split -m1e-1 >myseq.maf $ maf-convert sam myseq.maf >myseq.sam $ samtools view -bS myseq.sam >unsorted_myseq.bam [E::sam_parse1] missing SAM header [W::sam_read1] Parse error at line 2 [main_samview] truncated file.

LordGenome commented 6 years ago

It was a simple samtools fix thus: samtools view -ht /reference/chrX.fa.fai myseq.sam >myseq_sam_headers.sam

mcfrith commented 6 years ago

Glad that you could figure it out quickly. There are some hints here: http://last.cbrc.jp/doc/maf-convert.html