[BioPython] info_dictionary
Giovanni Marco Dall'Olio
dalloliogm at gmail.com
Mon Jun 11 05:31:03 EDT 2007
Hi Irene!
If I understand your problem correctly, you have a dictionary in which the
keys are created by concatenating many variables:
dict_key = AA + '_' + num + '_' + dssp + '....'
In my humble opinion, it's bad to create this kind of dictionary... it's
better to use a more branched structure, e.g.:
dict_dssp = {dssp : {AA : {num : (structure, ...), ...}, ...}, ...}
which is easier to handle, so for example you can extract the keys with
dict_dssp.items (to get a list of all the dssps) or dict_dssp[dssp1].items
(for all the items in a given dssp), and so on.
Anyway, if you can't change to this structure you can find some useful
information here:
- http://aspn.activestate.com/ASPN/Python/Cookbook/Recipe/52306
2007/6/10, irene farabella <irene.farabella at gmail.com>:
>
> hi
> i am a beginner in python.
> from DSSP file i made a dictionary like that:
> dict2[AA_num_dssp,chain] = (structure,AA_name_dssp)
> i need of it in my small programm.
> i never work with a dictionary that have the keys like that.
> i have to sort the key of the dictionay... how can i do?
> usualy when i have only the AA_num i can mutate it in a list an then sort
> it...
> but in this case...mmm
> thanks for help me!!
> and sorry for the english..
> _______________________________________________
> BioPython mailing list - BioPython at lists.open-bio.org
> http://lists.open-bio.org/mailman/listinfo/biopython
>
--
-----------------------------------------------------------
My Blog on Bioinformatics (italian): http://dalloliogm.wordpress.com
More information about the BioPython
mailing list