Unconfigured Ad

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sasignor
    Member
    • Sep 2009
    • 28

    #1

    read groups

    This is a problem for which there are many posts already. Yet having spent two days googling my problems, and having them unresolved, I am going to ask. I have 17 samples from two subspecies that I want to eventually analyze in vcftools for some basic population genetics. From what I can tell, this requires them to be all in one file with some sort of distinguishing header for the different subspecies. So I am trying to add headers to the .sam files and then merge them such that this will be possible.

    I have tried using sampe:

    ./bwa sampe -r "@RG\tID:3\tSM:3\tPL:illumina" reference.txt in.sai in.sai in.fastq in.fastq > header.sam

    And this does add the header, but just as one line in the file @RG. Adding it using samtools merge -rh and a text file does not seem to work at all.

    Using picard to merge the files seems to maintain the headers, again as one line.

    java -Xmx2g -jar MergeSamFiles.jar

    but when it is finalized as a vcf all distinguishing tags are gone.

    Perhaps I am mistaken as to the input that vcf requires? How else is it supposed to tell between populations?

    Are these headers not enough to tag the reads?
    Last edited by sasignor; 01-07-2014, 01:24 PM.
  • dpryan
    Devon Ryan
    • Jul 2011
    • 3478

    #2
    If you already have the alignments, just use picard tools AddOrReplaceReadGroups (adding read groups should alter every alignment, so if you "samtools view sample1.bam | head" before and after adding read groups you should see a difference). We'd have to see and example of from the VCF file to see if things are going amiss there.

    Comment

    • rskr
      Senior Member
      • Oct 2010
      • 249

      #3
      Originally posted by sasignor View Post
      This is a problem for which there are many posts already. Yet having spent two days googling my problems, and having them unresolved, I am going to ask. I have 17 samples from two subspecies that I want to eventually analyze in vcftools for some basic population genetics. From what I can tell, this requires them to be all in one file with some sort of distinguishing header for the different subspecies. So I am trying to add headers to the .sam files and then merge them such that this will be possible.

      I have tried using sampe:

      ./bwa sampe -r "@RG\tID:3\tSM:3\tPL:illumina" reference.txt in.sai in.sai in.fastq in.fastq > header.sam

      And this does add the header, but just as one line in the file @RG. Adding it using samtools merge -rh and a text file does not seem to work at all.

      Using picard to merge the files seems to maintain the headers, again as one line.

      java -Xmx2g -jar MergeSamFiles.jar

      but when it is finalized as a vcf all distinguishing tags are gone.

      Perhaps I am mistaken as to the input that vcf requires? How else is it supposed to tell between populations?

      Are these headers not enough to tag the reads?
      I use the -h option in samtools merge to specify a separate header file, for the header file I print the header from one of the bam file then concatenate the @RG tags for all of the samples to the header.

      Something like:

      Samtools view -h file1.bam | grep ^@ > header.txt
      Cat rg.txt header.txt > rg_header.txt
      Samtools merge -h rg_header.txt out.bam file*.bam

      Where rg.txt has the @RG tags.

      It is a weird operation IMO, if there were a simpler way to do it, I would like to know, I can post more details if it isn't clear how to do it this way.

      Comment

      Latest Articles

      Collapse

      • SEQadmin2
        Multiomic Liquid Biopsy: What DNA/RNA Panels Reveal That DNA Alone Can’t
        by SEQadmin2



        Tumors contain complex mixtures of cell populations that evolve in response to treatment and host-specific factors. Tissue biopsies provide only static snapshots of a tumor’s state. But what if we could follow that evolution over time using a minimally invasive technique?

        Liquid biopsies can detect tumor-derived material circulating in the bloodstream, providing a way to study treatment response, detect emerging resistance, and discover new biomarkers. Circulating
        ...
        10-14-2026, 09:55 AM
      • SEQadmin2
        New Genomics Technologies Take Aim at Long-Standing Limits
        by SEQadmin2


        Researchers using sequencing and genomics tools often have to make trade-offs. They can choose between speed or scale, short reads or long-range information, or targeted panels or a view of the whole transcriptome. New technologies that have been released this year are built to address those tough choices.

        We asked six companies the same four questions to learn about their latest products. The new technologies bring a lot to the table, including rethinking sequencing
        ...
        09-28-2026, 10:25 AM

      ad_right_rmr

      Collapse

      News

      Collapse

      Topics Statistics Last Post
      Started by SEQadmin2, 10-22-2026, 11:13 AM
      0 responses
      26 views
      0 reactions
      Last Post SEQadmin2  
      Started by SEQadmin2, 10-22-2026, 10:48 AM
      0 responses
      20 views
      0 reactions
      Last Post SEQadmin2  
      Started by SEQadmin2, 10-15-2026, 10:52 AM
      0 responses
      36 views
      0 reactions
      Last Post SEQadmin2  
      Started by SEQadmin2, 10-14-2026, 05:39 AM
      0 responses
      43 views
      0 reactions
      Last Post SEQadmin2  
      Working...