Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8578227
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T20:20:19+00:00 2026-06-11T20:20:19+00:00

Finding coding sequence cds_position = ” cds_start = 0 cds_end = 0 cds_sequence =

  • 0

Finding coding sequence

cds_position = ''
cds_start = 0
cds_end = 0
cds_sequence = ''

for line in data:
    cds_temp = ''
    if re.findall(r' CDS ',line):
        cds_temp = cds_temp + line.replace('\n','')
        position = re.search(r'(\d+)\.\.(\d+)',cds_temp)
        cds_start = cds_start + int(position.group(1))
        cds_end = cds_end + int(position.group(2))
        cds_position = str(cds_start)+':'+str(cds_end)

cds_sequence = cds_sequence + sequence[(cds_start-1):(cds_end-1)]

I get this error

Traceback (most recent call last):
  File "Upstream_ORF.py", line 357, in <module>
    GenBank_Reader(test_file)
  File "Upstream_ORF.py", line 317, in GenBank_Reader
    cds_start = cds_start + int(position.group(1))
AttributeError: 'NoneType' object has no attribute 'group'

ok I really don’t understand why I am getting this error.

i wrote a script that goes through a file of a particular format line by line and whenever it encounters a particular string followed by 10 spaces, it takes the number values that follow it

 exon            1..1333
                 /gene="BRD2"
                 /gene_synonym="D6S113E; FSH; FSRG1; NAT; RING3; RNF3"
                 /inference="alignment:Splign:1.39.8"
                 /number=3
 STS             350..463
                 /gene="BRD2"
                 /gene_synonym="D6S113E; FSH; FSRG1; NAT; RING3; RNF3"
                 /standard_name="CGCb278"
                 /db_xref="UniSTS:240930"

so whenever it finds the word exon followed by 10 spaces it takes the numberes flanking the ‘..’
it worked for 5 different files but for one of them it just isn’t working and it is the exact same format. i’m not sure why its working now because it still works with the other ones. i found all the occurences it says ‘exon’ in the file and none of them were flanked by 10 spaces like the one i was looking for.

why would this error come up when it works for other files with the same format ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T20:20:21+00:00Added an answer on June 11, 2026 at 8:20 pm

    If re.search returns None, that means that it failed to find a match. The file in question must have something different about it which causes the expression to fail.

    Couple of little comments about your code:

    • if re.findall(r' CDS ',line): is unnecessary. Just do if ' CDS ' in line:, which does a substring search.
    • Instead of line.replace('\n','') you should use line.rstrip('\n'), as that is more typical.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm finding myself coding C3 for the first time, and using Visual Studio for
Please help me in finding the optimized solutions to these interesting data structure questions:
Sometimes when I make coding mistakes I spend a lot of time finding the
Even though I have done bit of coding in java, I'm still finding it
I'm coding a binary search tree and I'm having a little trouble finding a
Coming from a C++ background, I am finding cloning of objects in C# a
Finding articles with ANY of a set of tags is a relatively simple join,
For finding the nearest neighbor, Space Partitioning is one of the algorithms. How does
I'm having troubles finding a bad query that's really causing high CPU load due
I am having trouble finding an answer to this. Consider the clipping code below:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.