Seqanswers Leaderboard Ad

Collapse

Announcement

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

  • SAM header, difference between using sam tools or awk to filter ?

    I have filtered SAM files to get only the aligned reads with samtools view -F4.
    my output is a file in SAM format, the header is lost, but I can still convert the file to BAM and then use picardtools "addOrReplaceReadGroups" to add a header.

    this time I have a list of read names in a txt file and I used awk to find the matching rows in the SAM file. of course the header is lost, and I cannot convert this file to BAM to add the header back so I can index the file and visualize the alignments.

    I can open both files in a spreadsheet, they look and act exactly the same.
    is there some kind of identifier that is lost when awk writes the new file? Or will I have to use the matching fastq reads and redo the alignment?

    I am trying to find regions in a virus that has matching sequences in a plant genome. So I did: align all reads to virus genome, filter out aligned reads. align those virus reads to plant genome, filter again. Now I need to see where these reads align in the virus, and since they are already contained in the first alignment file I thought I could just separate them out......

  • #2
    You can grab the header from your bam file by doing
    Code:
     samtools view -H your.bam > header.txt
    That can then be added back to your filtered sam.

    Comment


    • #3
      You could also try to do this analysis in one step. Use bbsplit.sh from BBMap with both genomes. Look for reads that map to both genomes. Those would presumably be the reads you are interested in.

      Comment


      • #4
        Thank you GenoMax.
        the header suggestion almost worked, in one case, not so much in the other because it is too long I suspect.
        and thanks for the BBsplit suggestion as well.It obviously does alignment along the way, but does not mention anything about the aligner and since I work with very short reads, <30 nt, that can be an issue.
        either way, what I really needed to see was the alignments, so I ended up using excel and making histograms from the SAM files.

        Comment

        Latest Articles

        Collapse

        • 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
        • seqadmin
          Strategies for Sequencing Challenging Samples
          by seqadmin


          Despite advancements in sequencing platforms and related sample preparation technologies, certain sample types continue to present significant challenges that can compromise sequencing results. Pedro Echave, Senior Manager of the Global Business Segment at Revvity, explained that the success of a sequencing experiment ultimately depends on the amount and integrity of the nucleic acid template (RNA or DNA) obtained from a sample. “The better the quality of the nucleic acid isolated...
          03-22-2024, 06:39 AM

        ad_right_rmr

        Collapse

        News

        Collapse

        Topics Statistics Last Post
        Started by seqadmin, 04-11-2024, 12:08 PM
        0 responses
        18 views
        0 likes
        Last Post seqadmin  
        Started by seqadmin, 04-10-2024, 10:19 PM
        0 responses
        22 views
        0 likes
        Last Post seqadmin  
        Started by seqadmin, 04-10-2024, 09:21 AM
        0 responses
        17 views
        0 likes
        Last Post seqadmin  
        Started by seqadmin, 04-04-2024, 09:00 AM
        0 responses
        49 views
        0 likes
        Last Post seqadmin  
        Working...
        X