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
        Advanced Tools Transforming the Field of Cytogenomics
        by seqadmin


        At the intersection of cytogenetics and genomics lies the exciting field of cytogenomics. It focuses on studying chromosomes at a molecular scale, involving techniques that analyze either the whole genome or particular DNA sequences to examine variations in structure and behavior at the chromosomal or subchromosomal level. By integrating cytogenetic techniques with genomic analysis, researchers can effectively investigate chromosomal abnormalities related to diseases, particularly...
        09-26-2023, 06:26 AM
      • 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

      ad_right_rmr

      Collapse

      News

      Collapse

      Topics Statistics Last Post
      Started by seqadmin, 09-29-2023, 09:38 AM
      0 responses
      10 views
      0 likes
      Last Post seqadmin  
      Started by seqadmin, 09-27-2023, 06:57 AM
      0 responses
      13 views
      0 likes
      Last Post seqadmin  
      Started by seqadmin, 09-26-2023, 07:53 AM
      0 responses
      30 views
      0 likes
      Last Post seqadmin  
      Started by seqadmin, 09-25-2023, 07:42 AM
      0 responses
      18 views
      0 likes
      Last Post seqadmin  
      Working...
      X