{"__v":0,"_id":"579cbd8df3f4d50e00b547d6","category":{"project":"57618347b65324200072d6a5","version":"57618347b65324200072d6a8","_id":"5761912d207db7170022fbe9","__v":0,"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2016-06-15T17:32:29.121Z","from_sync":false,"order":2,"slug":"workflows","title":"Workflows"},"parentDoc":null,"project":"57618347b65324200072d6a5","user":"57617c8caa540f3600bfed20","version":{"__v":8,"_id":"57618347b65324200072d6a8","project":"57618347b65324200072d6a5","createdAt":"2016-06-15T16:33:11.587Z","releaseDate":"2016-06-15T16:33:11.587Z","categories":["57618347b65324200072d6a9","5761912d207db7170022fbe9","57619455a7c9f729009a74e0","576e8ae1f37ab41700147471","5797b8e5209a6e0e00b8321b","57989a8817ced017003c4c69","579ca6f3d46f960e0029a8ec","579ca703fefb1d0e00c94f06"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"blobtools v0.9.19","version_clean":"0.9.19","version":"0.9.19"},"updates":[],"next":{"pages":[],"description":""},"createdAt":"2016-07-30T14:45:33.130Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":4,"body":"### Motivation\nRead-filtering strategies \n\n### File requirements\n\nRead-filtering strategies allow the filtering of sequencing reads based on \n* a mapping file \n* a list of sequences in the assembly\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"# 1) Generate index of contigs\\nsamtools faidx ASSEMBLY.fna\\n\\n# 2) Subset index using list of contigs of interest (list.txt)\\ngrep -w -f list.txt ASSEMBLY. fai > list.fai\\n\\n# 3) Filter unmapped reads\\nsamtools view -bS -f12 FILE.bam > FILE.u_u.bam\\nsamtools bam2fq FILE.u_u.bam | gzip > FILE.u_u.ilv.fq.gz\\n\\n# 4A) Filter pairs where both reads map to list of contigs\\nsamtools view -t list.fai -bS -F12 FILE.bam > FILE.m_m.bam\\nsamtools bam2fq FILE.m_m.bam | gzip > FILE.m_m.ilv.fq.gz\\n\\n# 4B) Filter pairs where both reads map\\nsamtools view -bS -F12 FILE.bam > FILE.m_m.bam\\nsamtools bam2fq FILE.m_m.bam | gzip > FILE.m_m.ilv.fq.gz\\n\\n# 5) Filter pairs where one read of a pair maps (use -t list.fai if necessary)\\nsamtools view -bS -f8 -F4 FILE.bam > FILE.m_u.bam\\nsamtools view -bS -f4 -F8 FILE.bam > FILE.u_m.bam\\nsamtools merge -n FILE.one_mapped.bam FILE.m_u.bam FILE.u_m.bam\\nsamtools sort -n -T FILE.temp -O bam FILE.one_mapped.bam > FILE.one_mapped.bam.sorted;\\nmv FILE.one_mapped.bam.sorted FILE.one_mapped.bam\\nsamtools bam2fq FILE.one_mapped.bam | gzip > FILE.one_mapped.ilv.fq.gz\",\n      \"language\": \"text\"\n    }\n  ]\n}\n[/block]","excerpt":"","slug":"read-filtering-strategies","type":"basic","title":"Read-filtering strategies"}

Read-filtering strategies


### Motivation Read-filtering strategies ### File requirements Read-filtering strategies allow the filtering of sequencing reads based on * a mapping file * a list of sequences in the assembly [block:code] { "codes": [ { "code": "# 1) Generate index of contigs\nsamtools faidx ASSEMBLY.fna\n\n# 2) Subset index using list of contigs of interest (list.txt)\ngrep -w -f list.txt ASSEMBLY. fai > list.fai\n\n# 3) Filter unmapped reads\nsamtools view -bS -f12 FILE.bam > FILE.u_u.bam\nsamtools bam2fq FILE.u_u.bam | gzip > FILE.u_u.ilv.fq.gz\n\n# 4A) Filter pairs where both reads map to list of contigs\nsamtools view -t list.fai -bS -F12 FILE.bam > FILE.m_m.bam\nsamtools bam2fq FILE.m_m.bam | gzip > FILE.m_m.ilv.fq.gz\n\n# 4B) Filter pairs where both reads map\nsamtools view -bS -F12 FILE.bam > FILE.m_m.bam\nsamtools bam2fq FILE.m_m.bam | gzip > FILE.m_m.ilv.fq.gz\n\n# 5) Filter pairs where one read of a pair maps (use -t list.fai if necessary)\nsamtools view -bS -f8 -F4 FILE.bam > FILE.m_u.bam\nsamtools view -bS -f4 -F8 FILE.bam > FILE.u_m.bam\nsamtools merge -n FILE.one_mapped.bam FILE.m_u.bam FILE.u_m.bam\nsamtools sort -n -T FILE.temp -O bam FILE.one_mapped.bam > FILE.one_mapped.bam.sorted;\nmv FILE.one_mapped.bam.sorted FILE.one_mapped.bam\nsamtools bam2fq FILE.one_mapped.bam | gzip > FILE.one_mapped.ilv.fq.gz", "language": "text" } ] } [/block]