Seqanswers Leaderboard Ad

Collapse

Announcement

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

  • Samtools error: fail to open file XXX_sorted.bam.0000

    Hi,

    I have a bam files and I want to sort them. i used the following command

    samtools sort control_1.bam -f control_1_sorted.bam

    It produces temporary files and later when trying to merge them it throws an error "No such file or directory
    [bam_merge_core] fail to open file control_1_sorted.bam.0000"

    Please guide me to solve it.

  • #2
    Usage: samtools sort [options...] [in.bam]

    try writing your command as:
    samtools sort -f control_1_sorted.bam control_1.bam

    Comment


    • #3
      "-f" is a legacy option and just not needed anymore.

      just use
      Code:
      samtools sort control_1.bam control_1_sorted
      to get a coordinate-sorted file named control_1_sorted.bam

      if you want to have the same file sorted by names, use
      Code:
      samtools sort -n control_1.bam control_1_sorted

      Comment


      • #4
        For what it's worth, I too prefer the "legacy" format when dealing only with BAM files. The new sort command format takes twice as long to type, since you have to specify the output format and the prefix.

        Comment


        • #5
          @dpryan: You are seriously complaining about typing speed? In that case I would go for scripting it. With a short script name it will be the shortest possible solution
          Code:
          bamFile=$1
          sortBam="${bamFile%.*}_sorted"
          
          samtools sort $bamFile $sortBam

          Comment


          • #6
            That's the legacy format The new format would be

            Code:
            samtools sort -O bam -T tmp input.bam > output.bam
            Of course that'd be scripted with a bunch of files, but with even then if you're only dealing with BAM then the legacy format is slightly quicker to type.

            Now I wonder if I ever submitted a pull request on how -T and -O are documented and set...

            Comment


            • #7
              oh... yes... of course... looks like my mind is already on the weekend

              Comment


              • #8
                I know the feeling Schönes Wochenende!

                Comment

                Latest Articles

                Collapse

                • seqadmin
                  Advancing Precision Medicine for Rare Diseases in Children
                  by seqadmin




                  Many organizations study rare diseases, but few have a mission as impactful as Rady Children’s Institute for Genomic Medicine (RCIGM). “We are all about changing outcomes for children,” explained Dr. Stephen Kingsmore, President and CEO of the group. The institute’s initial goal was to provide rapid diagnoses for critically ill children and shorten their diagnostic odyssey, a term used to describe the long and arduous process it takes patients to obtain an accurate...
                  12-16-2024, 07:57 AM
                • seqadmin
                  Recent Advances in Sequencing Technologies
                  by seqadmin



                  Innovations in next-generation sequencing technologies and techniques are driving more precise and comprehensive exploration of complex biological systems. Current advancements include improved accessibility for long-read sequencing and significant progress in single-cell and 3D genomics. This article explores some of the most impactful developments in the field over the past year.

                  Long-Read Sequencing
                  Long-read sequencing has seen remarkable advancements,...
                  12-02-2024, 01:49 PM

                ad_right_rmr

                Collapse

                News

                Collapse

                Topics Statistics Last Post
                Started by seqadmin, 12-17-2024, 10:28 AM
                0 responses
                33 views
                0 likes
                Last Post seqadmin  
                Started by seqadmin, 12-13-2024, 08:24 AM
                0 responses
                48 views
                0 likes
                Last Post seqadmin  
                Started by seqadmin, 12-12-2024, 07:41 AM
                0 responses
                34 views
                0 likes
                Last Post seqadmin  
                Started by seqadmin, 12-11-2024, 07:45 AM
                0 responses
                46 views
                0 likes
                Last Post seqadmin  
                Working...
                X