Header Leaderboard Ad

Collapse

Changing RGSM without changing any RGID, RGPL etc

Collapse

Announcement

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

  • Changing RGSM without changing any RGID, RGPL etc

    Hi there,
    I have a bam file which was created by merging the two bam files – each a different run of same sample. Somehow while adding the read group information I added the wrong sample name to it.

    Now I want to replace the Sample Name to correct sample name. I know I can use picard tool 'AddOrReplaceReadGroup' or samtools but it changes all the read group info. What I want is replacing new SM info only

    What I have is:
    @RG ID:A PL:ILLUMINA LB:250BP SM:X
    @RG ID:B PL:ILLUMINA LB:250BP SM:X

    What I want is:

    @RG ID:A PL:ILLUMINA PU:NA LB:250BP SM:Y
    @RG ID:B PL:ILLUMINA PU:NA LB:250BP SM:Y

    Let me know if this can be done easily without going back to the original bam files and merging them again after changing the SM info in each
    Thanks
    Last edited by akhattri; 10-25-2013, 08:32 PM.

  • #2
    I'm not quite sure if I get the question that you're asking. There's a 'samtools reheader' function that allows you to replace headers in a BAM file with the header from a [possibly empty] SAM file.

    FWIW, the read groups specified on the mapping lines must link back to a read group line in the header -- in the BAM representation, this is an integer lookup, while in the SAM representation this is a unique ID. See SAM Specification, page 3:

    Each @RG line must have a unique ID. The value of ID is used in the RG tags of alignment records. Must be unique among all read groups in header section

    Comment


    • #3
      Thanks gringer. I found a post describing the similar way to do it:

      samtools view -H mybamfile.bam | sed -e 's/SM:X/SM:Y/' | samtools reheader - mybamfile.bam > mybamfile.reheadered.bam


      I validated the output BAM file with ValidateSAM. Seems like it has worked. But I will post here if I encounter any problem with this file.
      Thanks

      Comment

      Latest Articles

      Collapse

      • seqadmin
        How RNA-Seq is Transforming Cancer Studies
        by seqadmin



        Cancer research has been transformed through numerous molecular techniques, with RNA sequencing (RNA-seq) playing a crucial role in understanding the complexity of the disease. Maša Ivin, Ph.D., Scientific Writer at Lexogen, and Yvonne Goepel Ph.D., Product Manager at Lexogen, remarked that “The high-throughput nature of RNA-seq allows for rapid profiling and deep exploration of the transcriptome.” They emphasized its indispensable role in cancer research, aiding in biomarker...
        09-07-2023, 11:15 PM
      • seqadmin
        Methods for Investigating the Transcriptome
        by seqadmin




        Ribonucleic acid (RNA) represents a range of diverse molecules that play a crucial role in many cellular processes. From serving as a protein template to regulating genes, the complex processes involving RNA make it a focal point of study for many scientists. This article will spotlight various methods scientists have developed to investigate different RNA subtypes and the broader transcriptome.

        Whole Transcriptome RNA-seq
        Whole transcriptome sequencing...
        08-31-2023, 11:07 AM

      ad_right_rmr

      Collapse

      News

      Collapse

      Topics Statistics Last Post
      Started by seqadmin, 09-22-2023, 09:05 AM
      0 responses
      14 views
      0 likes
      Last Post seqadmin  
      Started by seqadmin, 09-21-2023, 06:18 AM
      0 responses
      11 views
      0 likes
      Last Post seqadmin  
      Started by seqadmin, 09-20-2023, 09:17 AM
      0 responses
      13 views
      0 likes
      Last Post seqadmin  
      Started by seqadmin, 09-19-2023, 09:23 AM
      0 responses
      28 views
      0 likes
      Last Post seqadmin  
      Working...
      X