Answers.Body: <p>You can simply replace the sequence and quality scores with a single <code>*</code> in each field. The CIGAR information will still be there, so it will be apparent where there were InDels and possibly mismatches (assuming your aligning uses <code>=</code> and <code>X</code> CIGAR operations), but since the actual sequence of these variants cannot be known this is quite anonymized.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-06-19T21:53:05.560Z
Answers.LastActivityDate: 2020-06-19T21:53:05.560Z
Answers.UserDisplayName: Devon Ryan
Body: <p>I have a bam file of, for instance, RNA-Seq, which contains patient-identifiable data in the form of Single Nucleotide Polymorphisms (SNPs) throughout.</p>
  <p>I would like a technique to take this aligned bam file and replace all the non-reference bases with the reference bases at the equivalent positions (hard-clipping any soft-clipped bases while doing so), in order to have an anonymised bam file without the patient-identifiable information.</p>
  <p>What is the best way to do this? I want the resulting anonymised bam file to have the reads in the same positions, for downstream tools that care about the alignment positions.</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-06-19T20:51:28.883Z
Comments.Text: Hi @KraZug normally patient confidentiality is maintained through anonminity of name and personal information, but not to anonymize the DNA by ad hoc editting. No ethics committee would request that. Personally, I don't agree here.
Comments.UserDisplayName: M__
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-06-19T21:49:07.600Z
Comments.Text: In the event of a publication, normally you can submit to ega or dbgap https://www.ncbi.nlm.nih.gov/gap/docs/submissionguide/#:~:text=To%20comply%20with%20HIPAA%2C%20personally,submitted%20in%20dbGaP%20data%20files. and they have a set of guidelines on how u de-identify samples
Comments.UserDisplayName: StupidWolf
Tags: <sam><ngs>
Title: How to anonymise a bam file
ThreadText: # How to anonymise a bam file
  
  (Asked by: username_0 on 2020-06-19)
  
  I have a bam file of, for instance, RNA-Seq, which contains patient-identifiable data in the form of Single Nucleotide Polymorphisms (SNPs) throughout.
  
  I would like a technique to take this aligned bam file and replace all the non-reference bases with the reference bases at the equivalent positions (hard-clipping any soft-clipped bases while doing so), in order to have an anonymised bam file without the patient-identifiable information.
  
  What is the best way to do this? I want the resulting anonymised bam file to have the reads in the same positions, for downstream tools that care about the alignment positions.
  
  **Tags:** sam, ngs
  
  > **Comments:**
  > **username_1**: Hi @KraZug normally patient confidentiality is maintained through anonminity of name and personal information, but not to anonymize the DNA by ad hoc editting. No ethics committee would request that. Personally, I don't agree here.  
  > **username_2**: In the event of a publication, normally you can submit to ega or dbgap https://www.ncbi.nlm.nih.gov/gap/docs/submissionguide/#:~:text=To%20comply%20with%20HIPAA%2C%20personally,submitted%20in%20dbGaP%20data%20files. and they have a set of guidelines on how u de-identify samples  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_3 on 2020-06-19. Score: 1
  
  You can simply replace the sequence and quality scores with a single `*` in each field. The CIGAR information will still be there, so it will be apparent where there were InDels and possibly mismatches (assuming your aligning uses `=` and `X` CIGAR operations), but since the actual sequence of these variants cannot be known this is quite anonymized.
  
  
  ---
  
  