Unconfigured Ad

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dnusol
    Senior Member
    • Jul 2009
    • 136

    #1

    samtools specific region

    I have downloaded all fasta files for human chromosomes and merged them with cat. In order to use the "region" option in samtools view command, do I have to specify the exact header of the fasta file?

    so for example if I want to analyse only a specific region in chromosome 12:

    $ samtools view gi|89161190|ref|NC_000012.10|NC_000012 Homo sapiens chromosome 12, reference assembly, complete sequence:1000000-2000000

    I guess it's better then to modify the header to something like ">chr12".

    Any suggestions?

    Thanks
  • krobison
    Senior Member
    • Nov 2007
    • 734

    #2
    I would modify the header; if you don't you'll always need to put quotes around & type that whole mess. I don't believe in any case you would need the description information -- just the text up to the first space (but my samtools-indexed FASTA files lack descriptions, so I can't be sure)

    How did you convert FASTA to SAM? Or did you mean to say "samtools index"?

    Comment

    • bioinfosm
      Senior Member
      • Jan 2008
      • 483

      #3
      definitely, some sed commands to remove the ugly string and put >chr10 as header. Helps later on as well, when using UCSC or IGV!
      --
      bioinfosm

      Comment

      • dnusol
        Senior Member
        • Jul 2009
        • 136

        #4
        Thanks for your help

        I indexed the fasta reference using bwa, but before doing that I changed the headers using sed. If after aligning against the whole genome, just wanted to get subalignments for a specific region, I have to use the samtools view command with the region option, right?
        Last edited by dnusol; 03-17-2010, 12:30 AM.

        Comment

        • dnusol
          Senior Member
          • Jul 2009
          • 136

          #5
          Actually, just found out that the samtools view command does not work with the "region" option unless you feed an indexed BAM file, or so it seems:

          $ samtools view -uS /s_1/s_1.sam.gz chr6:136000000:146000000 | ./samtools sort - /s_1/s_1
          [samopen] SAM header is present: 25 sequences.
          [main_samview] random alignment retrieval only works for indexed BAM files.

          any suggestions?

          Comment

          • dnusol
            Senior Member
            • Jul 2009
            • 136

            #6
            I will answer myself.

            I first sorted and then indexed the BAM file. Then the region option seems to work.

            D.

            Comment

            • krobison
              Senior Member
              • Nov 2007
              • 734

              #7
              You just need to index (with "samtools index") the bam file that "samtools sort" generated -- then you are off to the races

              Comment

              • bioinfosm
                Senior Member
                • Jan 2008
                • 483

                #8
                I think its sort, and then index, but perhaps it works in the other order as well
                --
                bioinfosm

                Comment

                • genbio64
                  Member
                  • Dec 2009
                  • 42

                  #9
                  Does anyone know of a way to use Samtools to split off individual chromosomes for easier viewing? If I attempt to use samtools view <myfile.bam> chr1 I receive a bam file that I can no longer view because it does not associate with the indexed file it was derived from.

                  Comment

                  • nilshomer
                    Nils Homer
                    • Nov 2008
                    • 1283

                    #10
                    Originally posted by genbio64 View Post
                    Does anyone know of a way to use Samtools to split off individual chromosomes for easier viewing? If I attempt to use samtools view <myfile.bam> chr1 I receive a bam file that I can no longer view because it does not associate with the indexed file it was derived from.
                    Could you post the error message when it complains?
                    Try:
                    Code:
                    rm myfile.bam.bai
                    samtools index myfile.bam
                    samtools view -b myfile.bam chr1 > myfile.chr1.bam
                    samtools view -b myfile.bam chr2 > myfile.chr2.bam
                    ...

                    Comment

                    • genbio64
                      Member
                      • Dec 2009
                      • 42

                      #11
                      @nilshomer
                      I'll try that.

                      thanks

                      Comment

                      Latest Articles

                      Collapse

                      • SEQadmin2
                        Beyond CRISPR/Cas9: Understand, Choose, and Use the Right Genome Editing Tool
                        by SEQadmin2



                        CRISPR/Cas9 sparked the gene editing revolution for both research and therapeutics.1 But this system still showed severe issues that limited its applications. The most prominent were the heavy reliance on PAM sequences, delivery limitations, double-stranded breaks that prompt unintended edits and cell death, and editing inefficiency (both in targeting and in knock-in reliability).

                        Despite this, “CRISPR helped turn genome editing from a specialized technique into
                        ...
                        07-31-2026, 11:01 AM
                      • SEQadmin2
                        Proteomic Platforms: How to Choose the Right Analytical Strategy to Improve Detection and Clinical Applications
                        by SEQadmin2


                        Proteomics platforms are evolving rapidly, with advances in mass spectrometry and affinity-based approaches expanding what researchers can detect and at what scale. As the field moves toward deeper proteome coverage and clinical applications, scientists face an increasingly complex landscape of tools. This article will explore how researchers are navigating these choices to find the right platform for their work.

                        The systematic characterization of the human proteome has
                        ...
                        07-20-2026, 11:48 AM

                      ad_right_rmr

                      Collapse

                      News

                      Collapse

                      Topics Statistics Last Post
                      Started by SEQadmin2, 08-06-2026, 07:41 AM
                      0 responses
                      17 views
                      0 reactions
                      Last Post SEQadmin2  
                      Started by SEQadmin2, 08-03-2026, 10:13 AM
                      0 responses
                      33 views
                      0 reactions
                      Last Post SEQadmin2  
                      Started by SEQadmin2, 07-31-2026, 02:55 AM
                      0 responses
                      43 views
                      0 reactions
                      Last Post SEQadmin2  
                      Started by SEQadmin2, 07-24-2026, 12:17 PM
                      0 responses
                      26 views
                      0 reactions
                      Last Post SEQadmin2  
                      Working...