Seqanswers Leaderboard Ad

Collapse

Announcement

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

  • fasta sequence: 0 based or 1 based index

    When we say the position of a sequence, is zero based or one based?
    Because I want to extract a sub sequence from a long one.
    Code:
    AGCTTT
    012345
    OR
    Code:
    AGCTTT
    123456
    Thanks.

  • #2
    That is undefined if you don't specify which system (or language) you're working with.

    Comment


    • #3
      Okay. If the sequence is given and a position 63150935 is given as well. I want to get 1000kb size around this point by C#.
      Then
      Code:
      string trunk = sequence.Substring(63150935-500000,1000000);
      or
      Code:
      string trunk = sequence.Substring(63150934-500000,1000000);
      Which one is correct?
      Last edited by ardmore; 11-15-2011, 08:26 AM.

      Comment


      • #4
        In c# the indices are 0 based, so the first one would be apppropriate if your position is also defined as 0 based.

        If it was 1 based (for example, if it comes from Ensembl), you'll need to do the second one though.

        Comment


        • #5
          My question is not for C#. I meant that I am not sure whether the sequence is defined as 0 based or not. The sequence is a fasta file or extracted from a genome.

          Comment


          • #6
            The sequence is not your issue. A sequence itself is not '0 based', it's just a list of characters.
            Where does your position 63150935 come from?

            Comment


            • #7
              It is from a bam file output. If we define a region such as chr22:10000-20000.
              And we get the consensus sequence, we only interest one small region around a specific position.
              How to?

              Comment


              • #8
                If it's from a BAM/SAM file, then look at the BAM/SAM specification:



                For example, the fourth field of SAM files is 1-based:
                POS: 1-based leftmost mapping POSition of the first matching base. The first base in a reference
                sequence has coordinate 1. POS is set as 0 for an unmapped read without coordinate. If POS is
                0, no assumptions can be made about RNAME and CIGAR.
                whereas the internal BAM representation is 0-based:
                pos / 0-based leftmost coordinate (= POS − 1) / int32 t / [-1]

                Comment


                • #9
                  Thank you.

                  Comment

                  Latest Articles

                  Collapse

                  • seqadmin
                    Non-Coding RNA Research and Technologies
                    by seqadmin




                    Non-coding RNAs (ncRNAs) do not code for proteins but play important roles in numerous cellular processes including gene silencing, developmental pathways, and more. There are numerous types including microRNA (miRNA), long ncRNA (lncRNA), circular RNA (circRNA), and more. In this article, we discuss innovative ncRNA research and explore recent technological advancements that improve the study of ncRNAs.

                    Nobel Prize for MicroRNA Discovery
                    This week,...
                    10-07-2024, 08:07 AM
                  • seqadmin
                    Recent Developments in Metagenomics
                    by seqadmin





                    Metagenomics has improved the way researchers study microorganisms across diverse environments. Historically, studying microorganisms relied on culturing them in the lab, a method that limits the investigation of many species since most are unculturable1. Metagenomics overcomes these issues by allowing the study of microorganisms regardless of their ability to be cultured or the environments they inhabit. Over time, the field has evolved, especially with the advent...
                    09-23-2024, 06:35 AM

                  ad_right_rmr

                  Collapse

                  News

                  Collapse

                  Topics Statistics Last Post
                  Started by seqadmin, 10-11-2024, 06:55 AM
                  0 responses
                  12 views
                  0 likes
                  Last Post seqadmin  
                  Started by seqadmin, 10-02-2024, 04:51 AM
                  0 responses
                  110 views
                  0 likes
                  Last Post seqadmin  
                  Started by seqadmin, 10-01-2024, 07:10 AM
                  0 responses
                  115 views
                  0 likes
                  Last Post seqadmin  
                  Started by seqadmin, 09-30-2024, 08:33 AM
                  1 response
                  121 views
                  0 likes
                  Last Post EmiTom
                  by EmiTom
                   
                  Working...
                  X