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
                  Essential Discoveries and Tools in Epitranscriptomics
                  by seqadmin




                  The field of epigenetics has traditionally concentrated more on DNA and how changes like methylation and phosphorylation of histones impact gene expression and regulation. However, our increased understanding of RNA modifications and their importance in cellular processes has led to a rise in epitranscriptomics research. “Epitranscriptomics brings together the concepts of epigenetics and gene expression,” explained Adrien Leger, PhD, Principal Research Scientist...
                  04-22-2024, 07:01 AM
                • seqadmin
                  Current Approaches to Protein Sequencing
                  by seqadmin


                  Proteins are often described as the workhorses of the cell, and identifying their sequences is key to understanding their role in biological processes and disease. Currently, the most common technique used to determine protein sequences is mass spectrometry. While still a valuable tool, mass spectrometry faces several limitations and requires a highly experienced scientist familiar with the equipment to operate it. Additionally, other proteomic methods, like affinity assays, are constrained...
                  04-04-2024, 04:25 PM

                ad_right_rmr

                Collapse

                News

                Collapse

                Topics Statistics Last Post
                Started by seqadmin, Yesterday, 11:49 AM
                0 responses
                15 views
                0 likes
                Last Post seqadmin  
                Started by seqadmin, 04-24-2024, 08:47 AM
                0 responses
                16 views
                0 likes
                Last Post seqadmin  
                Started by seqadmin, 04-11-2024, 12:08 PM
                0 responses
                62 views
                0 likes
                Last Post seqadmin  
                Started by seqadmin, 04-10-2024, 10:19 PM
                0 responses
                60 views
                0 likes
                Last Post seqadmin  
                Working...
                X