logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

samtools-reset - removes the alignment information added by aligners and updates flags accordingly

Author

       Written by Vasudeva Sarma of the Wellcome Sanger Institute.

Description

       Removes the alignment information added by the aligner. CIGAR and reference data are removed.  Flags  are
       updated  as unmapped, non-duplicate and as not a proper pair.  If the alignment was in reverse direction,
       data and its quality values are reversed and complemented and the reverse flag is  reset.   Supplementary
       and secondary alignment data are discarded.

       Aux  tags  that  will be retained in output can be controlled by keep-tag and remove-tag/x. These options
       take tags as comma separated lists.  Aux tags AS, CC, CG, CP, H1, H2, HI, H0, IH, MC, MD, MQ, NM, SA  and
       TS are removed by default, this can be overridden using keep-tag.

       PG  and  RG  tags  from input are written on the output by default.  CO lines are not retained after this
       operation.

       The sort order is unchanged, so users may consider combining this with samtoolscollate or sort-n if  it
       is a requirement to group pairs of sequences together.

Examples

       Basic usage, to reset the data:

         samtools reset -o out.bam in.bam

       To keep aux tags RG and BC in the output:

         samtools reset -o out.sam --keep-tag RG,BC in.bam

       To discard PG entries from 'bwa_index' onwards,

         samtools reset -o out.sam --reject-PG=bwa_index

       To set output format for use within a pipeline:

         samtools collate -O -u input.cram | \
           samtools reset --output-fmt BAM,level=0 | \
           myaligner -I bam -o out.bam

Name

       samtools-reset - removes the alignment information added by aligners and updates flags accordingly

Options

-oFILE Output file to which reset data is to be written. If not given, standard output will be used.

       -xSTR,--remove-tagSTR
               Read  tag(s)  to  exclude  from  output (repeatable) [null].  This can be a single tag or a comma
               separated list.  Alternatively the option itself can be repeated multiple times.

               If the list starts with a `^' then it is negated and treated as a  request  to  remove  all  tags
               except those in STR. The list may be empty, so -x^ will remove all tags.

       --keep-tagSTR
               This  keeps  only tags listed in STR and is directly equivalent to --remove-tag^STR.  Specifying
               an empty list will remove all tags.  If both  --keep-tag  and  --remove-tag  are  specified  then
               --keep-tag has precedence.

       --reject-PGpgid
               The  PG  line  which has the ID matching pgid and all subsequent PG lines will be removed. If the
               option itself is absent, the default, all PG entries will be in output.

       --no-RG RG lines in input will be discarded with this option. By default, RG lines  will  be  present  in
               output.

               With this option, RG aux tags will also be discarded.

       --no-PG Do not add a @PG line to the header of the output file listing the reset command.  By default the
               PG entry for reset will be present in the output.

       --dupflag
               Keep the duplicate flag as it is. This option is absent by default and alignments are marked non-
               duplicates.

       -@,--threadN
               This gives the number of worker threads to be used.

       -O,--output-fmtFMT[,options]
               Sets the format of the output file and any associated format-specific options.  If this option is
               not present, the format is identified from the output file name extension.

See Also

samtools(1), samtools-collate(1)

       Samtools website: <http://www.htslib.org/>

samtools-1.21                                   12 September 2024                              samtools-reset(1)

Synopsis

       samtools  reset  [-oFILE] [-x,--remove-tagSTR] [--keep-tagSTR] [--reject-PGpgid] [--no-RG] [--no-PG]
       [--dupflag] [...]

See Also