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 8647021
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T12:57:42+00:00 2026-06-12T12:57:42+00:00

I am working on some FASTA-like sequences (not FASTA, but something I have defined

  • 0

I am working on some FASTA-like sequences (not FASTA, but something I have defined that’s similar for some culled PDB from the PISCES server).

I have a question. I have a small no of sequences called nCatSeq, for which there are MULTIPLE nBasinSeq. I go through a large PDB file and I want to extract for each nCatSeq the corresponding nBasinSeq without redundancies in a dictionary. The code snippet that does this is given below.

nCatSeq=item[1][n]+item[1][n+1]+item[1][n+2]+item[1][n+3]
nBasinSeq=item[2][n]+item[2][n+1]+item[2][n+2]+item[2][n+3]
if nCatSeq not in potBasin:
    potBasin[nCatSeq]=nBasinSeq
else:   
    if nBasinSeq not in potBasin[nCatSeq]:
        potBasin[nCatSeq]=potBasin[nCatSeq],nBasinSeq
    else:
        pass

I get the following as the answer for one nCatSeq,

'4241': ((('VUVV', 'DDRV'), 'DDVG'), 'VUVV')

what I want however is :

‘4241’: (‘VUVV’, ‘DDRV’, ‘DDVG’, ‘VUVV’)

I don’t want all the extra brackets due to the following command

potBasin[nCatSeq]=potBasin[nCatSeq],nBasinSeq 

(see above code snippet)

Is there a way to do this ?

  • 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-12T12:57:43+00:00Added an answer on June 12, 2026 at 12:57 pm

    You can add them as tuples:

    if nCatSeq not in potBasin:
        potBasin[nCatSeq] = (nBasinSeq,)
    else:
        if nBasinSeq not in potBasin[nCatSeq]:
            potBasin[nCatSeq] = potBasin[nCatSeq] + (nBasinSeq,)
    

    That way, rather than:

    (('VUVV', 'DDRV'), 'DDVG')
    # you will get
    ('VUVV', 'DDRV', 'DDVG') # == ('VUVV', 'DDRV')+ ('DDVG',)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Working on some tweaks for a build script, I noticed that the output from
I'm working some code that inserts csv rows into an SQLite database using Python.
I have some working code with a crutch to add BOM marker to a
When working on some Javascript for a web application, I noticed that I had
jQuery for some reason isn't working.I'd like to know what the problem is.Here is
I working on a website, some of the features are similar to Stackoverflow. One
I have to store some intervals in mssql db. I'm aware that the datetime's
I'm a scientist working mostly with C++, but I would like to find a
I am currently working with some code that my co-worker wrote. Here is a
I am working on a project that involves sending some very small encrypted messages

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.