Postagens

Mostrando postagens de dezembro, 2016

Como filtrar os reads mapeados com o SamTools

retirado de : https://www.biostars.org/p/56246/ Hi, You get a bam (machine readable sam ) file after mapping, and it contains information about mapped and unmapped reads. To get the unmapped reads from a bam file use : samtools view -f 4 file.bam > unmapped.sam , the output will be in sam to get the output in bam use : samtools view -b -f 4 file.bam > unmapped.bam To get only the mapped reads use the parameter 'F', which works like -v of grep and skips the alignments for a specific flag. samtools view -b -F 4 file.bam > mapped.bam From the manual ; there are different int codes you can use with the parameter 'f', based on what you want : -f INT Only output alignments with all bits in INT present in the FLAG field. INT can be in hex in the format of /^0x[0-9A-F]+/ [0] Each bit in the FLAG field is defined as: Flag Chr Description 0x0001 p the read is paired in sequencing 0x0002 P the