折腾这么多都是白瞎,STAR就有输出没有别对上的pair-end reads的功能

参见:How To Filter Mapped Reads With Samtools

I had the same issue but with Paired End Reads, and I solved using samtools and bamToFastq. You can find bamToFastq here: https://code.google.com/p/hydra-sv/

  • If you need unmappedR1.fastq (containing both paired and unpaired R1 unmapped reads) and unmappedR2.fastq ( containing both paired and unpaired R2 unmapped reads).

Use samtools -f 4 to extract all unmapped reads :

samtools view -b -f 4 file.bam > file_unmapped.bam
bamToFastq -bam file_unmapped.bam -fq1 unmappedR1.fastq -fq2 unmappedR2.fastq

  

  • If you need unmappedpairedR1.fastq (containing only paired  R1 unmapped reads) and unmappedpairedR2.fastq ( containing only paired R2 unmapped reads). Meaning you need all paired reads where at least one of them is unmapped.

Use samtools -F 2 to discard only reads mapped in proper pair:

samtools view -b -F 2 file.bam > file_unmapped.bam
bamToFastq -bam file_unmapped.bam -fq1 unmappedpairedR1.fastq -fq2 unmappedpairedR2.fastq

  

怎么从bam文件中提取出比对OR没比对上的paired reads | bamToFastq | STAR的更多相关文章

  1. [数据科学] 从csv, xls文件中提取数据

    在python语言中,用丰富的函数库来从文件中提取数据,这篇博客讲解怎么从csv, xls文件中得到想要的数据. 点击下载数据文件http://seanlahman.com/files/databas ...

  2. 调用opencv相关函数,从视频流中提取出图片序列&&&&jpg图片序列,转化成avi格式视频

    /************************ @HJ 2017/3/30 参考http://blog.sina.com.cn/s/blog_4b0020f301010qcz.html修改的代码 ...

  3. psfgettable - 从控制台字体中提取出嵌入的Unicode字符表

    总览 psfgettable 字体文件 [输出文件] 描述 psfgettable 命令从一个 .psf 格式的控制台字体中提取出嵌入的 Unicode字符表, 以易读格式输入到一个ASCII文件, ...

  4. JSFinder:一个在js文件中提取URL和子域名的脚本

    JSFinder介绍 JSFinder是一款用作快速在网站的js文件中提取URL,子域名的脚本工具. 支持用法 简单爬取 深度爬取 批量指定URL/指定JS 其他参数 以往我们子域名多数使用爆破或DN ...

  5. 使用Python从PDF文件中提取数据

    前言 数据是数据科学中任何分析的关键,大多数分析中最常用的数据集类型是存储在逗号分隔值(csv)表中的干净数据.然而,由于可移植文档格式(pdf)文件是最常用的文件格式之一,因此每个数据科学家都应该了 ...

  6. [SimplePlayer] 4. 从视频文件中提取音频

    提取音频,具体点来说就是提取音频帧.提取方法与从视频文件中提取图像的方法基本一样,这里仅列出其中的不同点: 1. 由于目的提取音频,因此在demux的时候需要指定的是提取audio stream Au ...

  7. 利用ROS工具从bag文件中提取图片

    bag文件是ROS常用的数据存储格式,因此要从bag文件中提取数据就需要了解一点ROS的背景知识. 1. 什么是ROS及其优势 ROS全称Robot Operating System,是BSD-lic ...

  8. [转]【流媒體】H264—MP4格式及在MP4文件中提取H264的SPS、PPS及码流

    [流媒體]H264—MP4格式及在MP4文件中提取H264的SPS.PPS及码流 SkySeraph Apr 1st 2012  Email:skyseraph00@163.com 一.MP4格式基本 ...

  9. 从ROS bag文件中提取图像

    从ROS bag文件中提取图像 创建launch文件,如下: export.launch <launch> <node pkg="rosbag" type=&qu ...

随机推荐

  1. tf.argmax()以及axis解析

    首先,明确一点,tf.argmax可以认为就是np.argmax.tensorflow使用numpy实现的这个API.    简单的说,tf.argmax就是返回最大的那个数值所在的下标.    这个 ...

  2. Print a file's last modified date in Bash

    date -r <filename> #!/usr/bin/env bash for i in /var/log/*.out; do stat -f "%Sm" -t ...

  3. c# 之继承、封装、多态

    虽然理解了继承和封装,但是多态总是忘记其定义,很容易被忽略,通过这一次的查找资料和总结能帮助自己更好的理解 1/多态的概念: 同一操作作用于不通过的对象,可以有不同的解释,产生不同的执行结果,这就是多 ...

  4. 用js互相调用iframe页面内的js函数

    http://www.jb51.net/web/18555.html 1,首先获得右栏iframe对象 var frames=document.getElementById("frameid ...

  5. Basic Mathematics You Should Mastered

    Basic Mathematics You Should Mastered 2017-08-17  21:22:40  1. Statistical distance  In statistics,  ...

  6. Linux 解决 firefox 中文页面乱码问题

    1.由于 firefox 默认是允许网页自己选择字体,在 Linux 上便会出现部分网站的乱码情况.因此可以取消允许页面自己选择字体这个选项便能解决部分乱码情况.

  7. numa.h:No such file or directory 解决方法

    参考: numa.h:No such file or directory numa.h:No such file or directory 解决方法 Ubuntu: $ apt-get install ...

  8. 17. --cover-- 覆盖掩盖 (词19)

  9. 【NOI 2016】优秀的拆分

    Problem Description 如果一个字符串可以被拆分为 \(AABB\) 的形式,其中 \(A\) 和 \(B\) 是任意非空字符串,则我们称该字符串的这种拆分是优秀的. 例如,对于字符串 ...

  10. 【译】第37节---EF6-异步查询和保存

    原文:http://www.entityframeworktutorial.net/entityframework6/async-query-and-save.aspx 你可以在.NET4.5下使用 ...