Seqanswers Leaderboard Ad

Collapse

Announcement

Collapse
No announcement yet.
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • pick out nonmapped pairs from bwa

    Hi,

    I have used bwa to align paired-end read against to refseq and output sam file.

    Now,I have a problem.

    If I want to pick out the read like bowtie's parameter --un.

    How can I do like bowtie's output?

    Like bowite's maual

    Paired-end reads will be written to two parallel files with _1 and _2 inserted in the filename, e.g., if <filename> is unaligned.fq, the #1 and #2 mates that fail to align will be written to unaligned_1.fq and unaligned_2.fq respectively.

  • #2
    As far as I know, there's no way to get it make you the fastq of the unmapped reads. However, you can get a sam/bam file containing only unmapped reads, and from that you can make the fq with a simple script.

    samtools view -F 0x0004 your.bam > unmapped.sam

    the 4 flag is set when the read is unmapped. -F will make sure that only reads with the 4 flag are included in the sam.

    Comment


    • #3
      Originally posted by swbarnes2 View Post
      As far as I know, there's no way to get it make you the fastq of the unmapped reads. However, you can get a sam/bam file containing only unmapped reads, and from that you can make the fq with a simple script.

      samtools view -F 0x0004 your.bam > unmapped.sam

      the 4 flag is set when the read is unmapped. -F will make sure that only reads with the 4 flag are included in the sam.
      Thanks!!

      But it has a problem, if pairs has only one mapped,and the other is nonmapped.

      I can't pick out both reads.

      I know bowtie --un in pairs,if one is map ,one is numapped. it will also output to unmapped_1.fa and unmapped_2.fa

      Comment


      • #4
        samtools view -F 0x0004 your.bam > unmapped.sam

        Will get all the unmapped reads

        samtools view -F 0x0008 your.bam > unmapped_mates.sam

        will get all the reads whose mates are unmapped.

        Or, once you have the names of the unmapped read, you could go through your fastqs and pull out both reads that have that name

        Comment


        • #5
          Originally posted by swbarnes2 View Post
          samtools view -F 0x0004 your.bam > unmapped.sam

          Will get all the unmapped reads

          samtools view -F 0x0008 your.bam > unmapped_mates.sam

          will get all the reads whose mates are unmapped.

          Or, once you have the names of the unmapped read, you could go through your fastqs and pull out both reads that have that name

          OK I see ,Thanks a lot!

          Comment


          • #6
            samtools view -Sb -F 2 your.sam > not_proper_pair.bam

            will give you the reads which are not mapped in proper pairs. the output can be converted to fastq or used in BWA directly (-b option).

            Comment


            • #7
              Originally posted by volks View Post
              samtools view -Sb -F 2 your.sam > not_proper_pair.bam

              will give you the reads which are not mapped in proper pairs. the output can be converted to fastq or used in BWA directly (-b option).
              Hi,thanks for yorr reply

              I have seen manual in bwa

              -b Specify the input read sequence file is the BAM format. For paired-end data, two ends in a pair must be grouped together and options -1 or -2 are usually applied to specify which end should be mapped. Typical command lines for mapping pair-end data in the BAM format are:
              bwa aln ref.fa -b1 reads.bam > 1.sai
              bwa aln ref.fa -b2 reads.bam > 2.sai
              bwa sampe ref.fa 1.sai 2.sai reads.bam reads.bam > aln.sam

              -0 When -b is specified, only use single-end reads in mapping.
              -1 When -b is specified, only use the first read in a read pair in mapping (skip single-end reads and the second reads).
              -2 When -b is specified, only use the second read in a read pair in mapping.
              I don't understand why -b parapeter can converted to fastq in BWA directly?

              Comment


              • #8
                Originally posted by louis7781x View Post
                I don't understand why -b parapeter can converted to fastq in BWA directly?
                with -b you can use a BAM as input, for example if you want to align the unmapped reads to a different genome. it is not converted to fastq, but there are other tools for that.

                Comment

                Latest Articles

                Collapse

                • seqadmin
                  Essential Discoveries and Tools in Epitranscriptomics
                  by seqadmin




                  The field of epigenetics has traditionally concentrated more on DNA and how changes like methylation and phosphorylation of histones impact gene expression and regulation. However, our increased understanding of RNA modifications and their importance in cellular processes has led to a rise in epitranscriptomics research. “Epitranscriptomics brings together the concepts of epigenetics and gene expression,” explained Adrien Leger, PhD, Principal Research Scientist...
                  04-22-2024, 07:01 AM
                • seqadmin
                  Current Approaches to Protein Sequencing
                  by seqadmin


                  Proteins are often described as the workhorses of the cell, and identifying their sequences is key to understanding their role in biological processes and disease. Currently, the most common technique used to determine protein sequences is mass spectrometry. While still a valuable tool, mass spectrometry faces several limitations and requires a highly experienced scientist familiar with the equipment to operate it. Additionally, other proteomic methods, like affinity assays, are constrained...
                  04-04-2024, 04:25 PM

                ad_right_rmr

                Collapse

                News

                Collapse

                Topics Statistics Last Post
                Started by seqadmin, Today, 08:47 AM
                0 responses
                11 views
                0 likes
                Last Post seqadmin  
                Started by seqadmin, 04-11-2024, 12:08 PM
                0 responses
                60 views
                0 likes
                Last Post seqadmin  
                Started by seqadmin, 04-10-2024, 10:19 PM
                0 responses
                59 views
                0 likes
                Last Post seqadmin  
                Started by seqadmin, 04-10-2024, 09:21 AM
                0 responses
                54 views
                0 likes
                Last Post seqadmin  
                Working...
                X