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
                        Recent Advances in Sequencing Analysis Tools
                        by seqadmin


                        The sequencing world is rapidly changing due to declining costs, enhanced accuracies, and the advent of newer, cutting-edge instruments. Equally important to these developments are improvements in sequencing analysis, a process that converts vast amounts of raw data into a comprehensible and meaningful form. This complex task requires expertise and the right analysis tools. In this article, we highlight the progress and innovation in sequencing analysis by reviewing several of the...
                        05-06-2024, 07:48 AM
                      • 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

                      ad_right_rmr

                      Collapse

                      News

                      Collapse

                      Topics Statistics Last Post
                      Started by seqadmin, Yesterday, 06:35 AM
                      0 responses
                      15 views
                      0 likes
                      Last Post seqadmin  
                      Started by seqadmin, 05-09-2024, 02:46 PM
                      0 responses
                      21 views
                      0 likes
                      Last Post seqadmin  
                      Started by seqadmin, 05-07-2024, 06:57 AM
                      0 responses
                      18 views
                      0 likes
                      Last Post seqadmin  
                      Started by seqadmin, 05-06-2024, 07:17 AM
                      0 responses
                      19 views
                      0 likes
                      Last Post seqadmin  
                      Working...
                      X