Seqanswers Leaderboard Ad

Collapse

Announcement

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

  • 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

  • #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


    • #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


      • #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


        • #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


          • #6
            I will answer myself.

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

            D.

            Comment


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

              Comment


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

                Comment


                • #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


                  • #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


                    • #11
                      @nilshomer
                      I'll try that.

                      thanks

                      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, Today, 08:47 AM
                      0 responses
                      12 views
                      0 likes
                      Last Post seqadmin  
                      Started by seqadmin, 04-11-2024, 12:08 PM
                      0 responses
                      60 views
                      0 likes
                      Last Post seqadmin  
                      Started by seqadmin, 04-10-2024, 10:19 PM
                      0 responses
                      59 views
                      0 likes
                      Last Post seqadmin  
                      Started by seqadmin, 04-10-2024, 09:21 AM
                      0 responses
                      54 views
                      0 likes
                      Last Post seqadmin  
                      Working...
                      X