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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T06:20:50+00:00 2026-06-18T06:20:50+00:00

I have a file after parse it using following code with open (‘cl1_vs_cl1.blast’, ‘rb’)

  • 0

I have a file after parse it using following code

with open ('cl1_vs_cl1.blast', 'rb') as csvfile:
read= csv.reader(csvfile, delimiter='\t', quotechar='|')                    
for row in read:
print row[0],row[1],row[11]

it will generate a file like

A B = n1
A C = n2
A D = n3
B C = n4
B D = n5
......

i would like to assign the pairwised data into a 2D array.

  A B C D .....
A   n1 n2 n3
B n1    
C n2 n4
D n3 n5 ....... 

How can i achieve it?
if I also want to save the pairwised data as a hash of hashs in perl how i suppose to do it?
Thanks a lot!

…

  • 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-18T06:20:51+00:00Added an answer on June 18, 2026 at 6:20 am

    For the hash part (also known as a dictionary in python)

    from collections import defaultdict
    myHash = defaultdict(defaultdict) # dictionary
    for row in read:
        myHash[row[0]][row[1]] = row[11]
    

    This will give allow you to access your info by myHash[‘A’][‘B’] and get back n1

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following basic code to read a text file from a StreamReader:
I am trying to parse an XML file in java, after I have to
I have a need to rename a file after download using php cURL. Here's
I have a text file having words that i need to validate. After following
I am using lxml to read my xml file. I am using a code
gcc 4.5.1 c89 I am using the following code to read in a line
I have the following data in an XML file which i am reading using
I have the following very simple XML file and I want to quickly parse
I have the following xml file which I am parsing using NSXMLParser : <geometry
Is it possible to reload a form after 'file-input' change? I have a form

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.