tseemann / samclip

Filter SAM file for soft and hard clipped alignments
GNU General Public License v3.0
46 stars 10 forks source link

sam header missing #4

Closed michieitel closed 6 years ago

michieitel commented 6 years ago

Dear Torsten,

I was trying your script on a bam file that I produced by mapping nanopore reads to a reference assembly. It turns out that your scripts outputs a sam file without sam header.

These are the commands I used: minimap2 -t 40 -ax map-ont reference.fasta nanopore_reads_raw.fastq.gz | samtools view -S -bT reference.fasta - > nanopore_reads_minimap2_mapped.bam

samtools faidx reference.fasta

samtools view nanopore_reads_minimap2_mapped.bam | samclip --max 40 --ref reference.fasta > nanopore_reads_minimap2_mapped_filtered.sam

Did I do sth wrong?

Thanks Michael

michieitel commented 6 years ago

In fact. It seems samclip does not spit out a regular .sam bam but a text file ...

tseemann commented 6 years ago

SAM files are text files.

The documentationc clearly shows you need the -h option for view:

# the -h is to emsure the SAM header is included
% samtools view -h in.bam | samclip --ref ref.fa | samtools sort > out.bam