Документ взят из кэша поисковой машины. Адрес оригинального документа : http://kodomo.fbb.msu.ru/hg/allpy/raw-rev/3161cdaf2ff9
Дата изменения: Unknown
Дата индексирования: Tue Oct 2 07:27:04 2012
Кодировка: Windows-1251

Поисковые слова: с р р с с рер рес с с р р р р р рер р р рер

# HG changeset patch
# User boris
# Date 1284745953 -14400
# Node ID 3161cdaf2ff96a40cba48baef0531aca5d1d5c2c
# Parent 621fe8e2c1f71d1fc0ab5593e228ae38a9473144
add current version of block3d (not integrated)

diff -r 621fe8e2c1f7 -r 3161cdaf2ff9 blocks3d/AAdict.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/blocks3d/AAdict.py Fri Sep 17 21:52:33 2010 +0400
@@ -0,0 +1,2371 @@
+AAdict= {
+
+"CPI": ('x', 'p', None, None) ,
+
+"AGM": ('r', 'p', 'M', None) ,
+
+"G25": ('g', 'r', 'M', None) ,
+
+"CPN": ('c', 'd', 'M', None) ,
+
+"MA6": ('a', 'r', 'M', None) ,
+
+"NYS": ('c', 'p', 'M', None) ,
+
+"CPC": ('x', 'p', None, None) ,
+
+"8FG": ('g', 'd', 'M', None) ,
+
+"SIC": ('x', 'p', None, None) ,
+
+"PQ1": ('n', 'r', None, None) ,
+
+"PAS": ('d', 'p', 'M', None) ,
+
+"EOV": ('x', 'p', None, None) ,
+
+"B2I": ('i', 'p', 'M', None) ,
+
+"NYM": ('n', 'd', None, None) ,
+
+"URD": ('u', 'r', 'M', None) ,
+
+"NYC": ('x', 'p', None, None) ,
+
+"AGT": ('x', 'p', None, None) ,
+
+"NYG": ('x', 'p', None, None) ,
+
+"CPV": ('x', 'p', None, None) ,
+
+"TAV": ('d', 'p', 'M', None) ,
+
+"S4G": ('g', 'd', 'M', None) ,
+
+"MA7": ('a', 'd', 'M', None) ,
+
+"S4C": ('c', 'r', 'M', None) ,
+
+"UAR": ('u', 'r', 'M', None) ,
+
+"SPT": ('t', 'd', 'M', None) ,
+
+"S4U": ('u', 'r', 'M', None) ,
+
+"TAF": ('t', 'd', 'M', None) ,
+
+"5NC": ('c', 'd', 'M', None) ,
+
+"CSF": ('c', 'r', 'M', None) ,
+
+"0CS": ('a', 'p', 'M', None) ,
+
+"B2V": ('v', 'p', 'M', None) ,
+
+"TAL": ('n', 'r', None, None) ,
+
+"SCY": ('c', 'p', 'M', None) ,
+
+"KYQ": ('k', 'p', 'M', None) ,
+
+"CS8": ('n', 'r', None, None) ,
+
+"TA4": ('x', 'p', None, None) ,
+
+"ALN": ('a', 'p', 'M', None) ,
+
+"GS": ('g', 'd', 'M', None) ,
+
+"2FE": ('n', 'd', None, None) ,
+
+"VAL": ('V', 'p', None, None) ,
+
+"7DA": ('a', 'd', 'M', None) ,
+
+"XPC": ('x', 'p', None, None) ,
+
+"VAF": ('v', 'p', 'M', None) ,
+
+"VAD": ('v', 'p', 'M', None) ,
+
+"BGM": ('g', 'd', 'M', None) ,
+
+"P": ('g', 'd', 'M', None) ,
+
+"LHU": ('u', 'r', 'M', None) ,
+
+"T48": ('t', 'd', 'M', None) ,
+
+"2GT": ('t', 'd', 'M', None) ,
+
+"HMF": ('a', 'p', 'M', None) ,
+
+"BNN": ('a', 'p', 'M', None) ,
+
+"AHB": ('n', 'p', 'M', None) ,
+
+"NPH": ('c', 'p', 'M', None) ,
+
+"SIB": ('c', 'p', 'M', None) ,
+
+"SNN": ('n', 'p', 'M', None) ,
+
+"AHH": ('x', 'p', None, None) ,
+
+"JW5": ('n', 'r', None, None) ,
+
+"PBB": ('c', 'p', 'M', None) ,
+
+"PTR": ('y', 'p', 'M', None) ,
+
+"MAA": ('a', 'p', 'M', None) ,
+
+"AHS": ('x', 'p', None, None) ,
+
+"AHP": ('a', 'p', 'M', None) ,
+
+"MAD": ('a', 'r', 'M', None) ,
+
+"AHT": ('x', 'p', None, None) ,
+
+"XYG": ('x', 'p', None, None) ,
+
+"MAI": ('r', 'p', 'M', None) ,
+
+"CP1": ('c', 'd', 'M', None) ,
+
+"G2L": ('g', 'r', 'M', None) ,
+
+"FFD": ('n', 'd', None, None) ,
+
+"CML": ('c', 'p', 'M', None) ,
+
+"CMH": ('c', 'p', 'M', None) ,
+
+"ZDU": ('n', 'd', None, None) ,
+
+"PCS": ('f', 'p', 'M', None) ,
+
+"CME": ('c', 'p', 'M', None) ,
+
+"CSO": ('c', 'p', 'M', None) ,
+
+"193": ('x', 'p', None, None) ,
+
+"1TY": ('y', 'p', 'M', None) ,
+
+"CB2": ('c', 'd', 'M', None) ,
+
+"CS3": ('c', 'p', 'M', None) ,
+
+"64T": ('t', 'd', 'M', None) ,
+
+"4AC": ('n', 'r', None, None) ,
+
+"B3X": ('n', 'p', 'M', None) ,
+
+"TST": ('x', 'p', None, None) ,
+
+"CMT": ('c', 'p', 'M', None) ,
+
+"CMR": ('c', 'd', 'M', None) ,
+
+"CSH": ('x', 'p', None, None) ,
+
+"VLM": ('x', 'p', None, None) ,
+
+"G": ('G', 'r', None, None) ,
+
+"C4S": ('c', 'd', 'M', None) ,
+
+"U2L": ('u', 'r', 'M', None) ,
+
+"LSO": ('x', 'p', None, None) ,
+
+"U2N": ('n', 'd', None, None) ,
+
+"PLE": ('l', 'p', 'M', None) ,
+
+"SIN": ('x', 'p', None, None) ,
+
+"M2L": ('k', 'p', 'M', None) ,
+
+"I58": ('k', 'p', 'M', None) ,
+
+"U2P": ('u', 'r', 'M', None) ,
+
+"B2A": ('a', 'p', 'M', None) ,
+
+"TTM": ('t', 'd', 'M', None) ,
+
+"CSD": ('c', 'p', 'M', None) ,
+
+"M2G": ('g', 'r', 'M', None) ,
+
+"ASX": ('x', 'p', None, None) ,
+
+"AFF": ('n', 'd', None, None) ,
+
+"TTD": ('t', 'd', 'M', None) ,
+
+"AET": ('a', 'r', 'M', None) ,
+
+"C45": ('c', 'd', 'M', None) ,
+
+"C46": ('c', 'd', 'M', None) ,
+
+"FTR": ('w', 'p', 'M', None) ,
+
+"BLY": ('k', 'p', 'M', None) ,
+
+"C42": ('c', 'd', 'M', None) ,
+
+"C2S": ('c', 'd', 'M', None) ,
+
+"FTY": ('y', 'p', 'M', None) ,
+
+"CSA": ('c', 'p', 'M', None) ,
+
+"I5C": ('c', 'd', 'M', None) ,
+
+"ALY": ('k', 'p', 'M', None) ,
+
+"P1L": ('c', 'p', 'M', None) ,
+
+"C49": ('c', 'd', 'M', None) ,
+
+"DSP": ('d', 'p', 'M', None) ,
+
+"AFA": ('n', 'p', 'M', None) ,
+
+"P1P": ('n', 'r', None, None) ,
+
+"U25": ('u', 'r', 'M', None) ,
+
+"CHS": ('x', 'p', None, None) ,
+
+"BLE": ('l', 'p', 'M', None) ,
+
+"DSG": ('n', 'p', 'M', None) ,
+
+"DSE": ('s', 'p', 'M', None) ,
+
+"S4A": ('a', 'd', 'M', None) ,
+
+"DLS": ('k', 'p', 'M', None) ,
+
+"4SU": ('u', 'r', 'M', None) ,
+
+"MA": ('a', 'p', 'M', None) ,
+
+"TRX": ('w', 'p', 'M', None) ,
+
+"DC": ('C', 'd', None, None) ,
+
+"HLU": ('l', 'p', 'M', None) ,
+
+"HSE": ('s', 'p', 'M', None) ,
+
+"A5M": ('c', 'r', 'M', None) ,
+
+"ALS": ('a', 'p', 'M', None) ,
+
+"CBR": ('c', 'd', 'M', None) ,
+
+"SHC": ('c', 'p', 'M', None) ,
+
+"B2F": ('f', 'p', 'M', None) ,
+
+"QUO": ('g', 'r', 'M', None) ,
+
+"X4A": ('n', 'd', None, None) ,
+
+"BE2": ('x', 'p', None, None) ,
+
+"CM0": ('n', 'r', None, None) ,
+
+"GLH": ('q', 'p', 'M', None) ,
+
+"DOH": ('d', 'p', 'M', None) ,
+
+"DON": ('l', 'p', 'M', None) ,
+
+"GLM": ('x', 'p', None, None) ,
+
+"GLN": ('Q', 'p', None, None) ,
+
+"T4S": ('t', 'd', 'M', None) ,
+
+"DOC": ('c', 'd', 'M', None) ,
+
+"T3P": ('t', 'd', 'M', None) ,
+
+"DOA": ('x', 'p', None, None) ,
+
+"TOX": ('w', 'p', 'M', None) ,
+
+"SMP": ('a', 'd', 'M', None) ,
+
+"GLX": ('x', 'p', None, None) ,
+
+"GLY": ('G', 'p', None, None) ,
+
+"GLZ": ('g', 'p', 'M', None) ,
+
+"CTG": ('t', 'd', 'M', None) ,
+
+"T38": ('n', 'r', None, None) ,
+
+"AKL": ('d', 'p', 'M', None) ,
+
+"T36": ('t', 'd', 'M', None) ,
+
+"T37": ('t', 'd', 'M', None) ,
+
+"4TA": ('n', 'r', None, None) ,
+
+"CTH": ('t', 'p', 'M', None) ,
+
+"GLU": ('E', 'p', None, None) ,
+
+"RCY": ('c', 'p', 'M', None) ,
+
+"MDH": ('x', 'p', None, None) ,
+
+"MDO": ('x', 'p', None, None) ,
+
+"8OG": ('g', 'd', 'M', None) ,
+
+"HCS": ('x', 'p', None, None) ,
+
+"UD5": ('u', 'r', 'M', None) ,
+
+"O2C": ('n', 'd', None, None) ,
+
+"5FU": ('u', 'r', 'M', None) ,
+
+"SDG": ('g', 'd', 'M', None) ,
+
+"MDR": ('n', 'd', None, None) ,
+
+"BSE": ('s', 'p', 'M', None) ,
+
+"4IN": ('x', 'p', None, None) ,
+
+"FCL": ('f', 'p', 'M', None) ,
+
+"1SC": ('c', 'r', 'M', None) ,
+
+"R7A": ('c', 'p', 'M', None) ,
+
+"6IA": ('a', 'r', 'M', None) ,
+
+"XTS": ('g', 'r', 'M', None) ,
+
+"DFT": ('n', 'd', None, None) ,
+
+"FMU": ('n', 'r', None, None) ,
+
+"XTY": ('n', 'd', None, None) ,
+
+"MVA": ('v', 'p', 'M', None) ,
+
+"LTA": ('x', 'p', None, None) ,
+
+"01W": ('x', 'p', None, None) ,
+
+"DFI": ('x', 'p', None, None) ,
+
+"YG": ('g', 'r', 'M', None) ,
+
+"FMG": ('g', 'd', 'M', None) ,
+
+"DFG": ('g', 'd', 'M', None) ,
+
+"XTL": ('t', 'd', 'M', None) ,
+
+"DFC": ('c', 'd', 'M', None) ,
+
+"XTH": ('t', 'd', 'M', None) ,
+
+"NTY": ('y', 'p', 'M', None) ,
+
+"EDC": ('g', 'd', 'M', None) ,
+
+"T49": ('t', 'd', 'M', None) ,
+
+"EDA": ('a', 'd', 'M', None) ,
+
+"O12": ('x', 'p', None, None) ,
+
+"MMT": ('t', 'd', 'M', None) ,
+
+"T41": ('n', 'r', None, None) ,
+
+"LMS": ('n', 'r', None, None) ,
+
+"0AP": ('c', 'd', 'M', None) ,
+
+"ORQ": ('r', 'p', 'M', None) ,
+
+"ORN": ('a', 'p', 'M', None) ,
+
+"ALM": ('a', 'p', 'M', None) ,
+
+"VB1": ('k', 'p', 'M', None) ,
+
+"PUY": ('n', 'r', None, None) ,
+
+"SBD": ('s', 'p', 'M', None) ,
+
+"LPS": ('s', 'p', 'M', None) ,
+
+"SC": ('c', 'd', 'M', None) ,
+
+"ALT": ('a', 'p', 'M', None) ,
+
+"GL3": ('g', 'p', 'M', None) ,
+
+"LME": ('e', 'p', 'M', None) ,
+
+"SBL": ('s', 'p', 'M', None) ,
+
+"ALQ": ('x', 'p', None, None) ,
+
+"CAB": ('a', 'p', 'M', None) ,
+
+"GPL": ('k', 'p', 'M', None) ,
+
+"CAY": ('c', 'p', 'M', None) ,
+
+"DPR": ('p', 'p', 'M', None) ,
+
+"DPQ": ('y', 'p', 'M', None) ,
+
+"DPP": ('a', 'p', 'M', None) ,
+
+"CAS": ('c', 'p', 'M', None) ,
+
+"NC1": ('s', 'p', 'M', None) ,
+
+"IYR": ('y', 'p', 'M', None) ,
+
+"CAV": ('x', 'p', None, None) ,
+
+"DPY": ('n', 'd', None, None) ,
+
+"5AA": ('a', 'd', 'M', None) ,
+
+"DPB": ('t', 'd', 'M', None) ,
+
+"CAL": ('x', 'p', None, None) ,
+
+"DPN": ('f', 'p', 'M', None) ,
+
+"BAL": ('a', 'p', 'M', None) ,
+
+"DPL": ('p', 'p', 'M', None) ,
+
+"CAF": ('c', 'p', 'M', None) ,
+
+"DPH": ('f', 'p', 'M', None) ,
+
+"HIP": ('h', 'p', 'M', None) ,
+
+"LG": ('g', 'r', 'M', None) ,
+
+"LA2": ('k', 'p', 'M', None) ,
+
+"KOR": ('m', 'p', 'M', None) ,
+
+"LC": ('c', 'r', 'M', None) ,
+
+"D4M": ('t', 'd', 'M', None) ,
+
+"5MD": ('n', 'd', None, None) ,
+
+"PGN": ('g', 'd', 'M', None) ,
+
+"NHL": ('e', 'p', 'M', None) ,
+
+"PGL": ('x', 'p', None, None) ,
+
+"TA3": ('t', 'd', 'M', None) ,
+
+"XCP": ('x', 'p', None, None) ,
+
+"DYS": ('c', 'p', 'M', None) ,
+
+"HIA": ('h', 'p', 'M', None) ,
+
+"HIC": ('h', 'p', 'M', None) ,
+
+"PGP": ('g', 'r', 'M', None) ,
+
+"AB7": ('x', 'p', None, None) ,
+
+"IIL": ('i', 'p', 'M', None) ,
+
+"DYG": ('x', 'p', None, None) ,
+
+"PGY": ('g', 'p', 'M', None) ,
+
+"A": ('A', 'r', None, None) ,
+
+"23F": ('f', 'p', 'M', None) ,
+
+"143": ('c', 'p', 'M', None) ,
+
+"HIQ": ('h', 'p', 'M', None) ,
+
+"THR": ('T', 'p', None, None) ,
+
+"PG7": ('g', 'd', 'M', None) ,
+
+"ABR": ('a', 'd', 'M', None) ,
+
+"HIS": ('H', 'p', None, None) ,
+
+"ABT": ('n', 'd', None, None) ,
+
+"PG1": ('s', 'p', 'M', None) ,
+
+"2LU": ('l', 'p', 'M', None) ,
+
+"NZH": ('h', 'p', 'M', None) ,
+
+"P5P": ('a', 'r', 'M', None) ,
+
+"STY": ('y', 'p', 'M', None) ,
+
+"PG9": ('g', 'p', 'M', None) ,
+
+"NCX": ('n', 'd', None, None) ,
+
+"NCY": ('x', 'p', None, None) ,
+
+"CFL": ('c', 'd', 'M', None) ,
+
+"3MD": ('d', 'p', 'M', None) ,
+
+"1AP": ('a', 'd', 'M', None) ,
+
+"TFE": ('t', 'd', 'M', None) ,
+
+"D3T": ('t', 'd', 'M', None) ,
+
+"TFA": ('x', 'p', None, None) ,
+
+"BHD": ('d', 'p', 'M', None) ,
+
+"ONL": ('x', 'p', None, None) ,
+
+"CFY": ('x', 'p', None, None) ,
+
+"QLG": ('x', 'p', None, None) ,
+
+"NCB": ('a', 'p', 'M', None) ,
+
+"TFQ": ('f', 'p', 'M', None) ,
+
+"XXY": ('x', 'p', None, None) ,
+
+"23S": ('x', 'p', None, None) ,
+
+"0AU": ('n', 'd', None, None) ,
+
+"GHP": ('g', 'p', 'M', None) ,
+
+"MIA": ('a', 'r', 'M', None) ,
+
+"AP7": ('a', 'd', 'M', None) ,
+
+"OAD": ('n', 'r', None, None) ,
+
+"UDP": ('n', 'r', None, None) ,
+
+"GHG": ('q', 'p', 'M', None) ,
+
+"ZFB": ('x', 'p', None, None) ,
+
+"C38": ('c', 'd', 'M', None) ,
+
+"HAQ": ('x', 'p', None, None) ,
+
+"C34": ('c', 'd', 'M', None) ,
+
+"C37": ('c', 'd', 'M', None) ,
+
+"ONE": ('u', 'r', 'M', None) ,
+
+"C31": ('c', 'r', 'M', None) ,
+
+"HAR": ('r', 'p', 'M', None) ,
+
+"TY2": ('y', 'p', 'M', None) ,
+
+"TY3": ('y', 'p', 'M', None) ,
+
+"RT": ('n', 'r', None, None) ,
+
+"4PE": ('c', 'd', 'M', None) ,
+
+"4PD": ('c', 'd', 'M', None) ,
+
+"4PC": ('c', 'd', 'M', None) ,
+
+"SAC": ('s', 'p', 'M', None) ,
+
+"PRO": ('P', 'p', None, None) ,
+
+"PRN": ('a', 'd', 'M', None) ,
+
+"6CL": ('k', 'p', 'M', None) ,
+
+"4PH": ('f', 'p', 'M', None) ,
+
+"FGL": ('g', 'p', 'M', None) ,
+
+"6CT": ('t', 'd', 'M', None) ,
+
+"IAS": ('d', 'p', 'M', None) ,
+
+"PRS": ('p', 'p', 'M', None) ,
+
+"UR3": ('u', 'r', 'M', None) ,
+
+"SAR": ('g', 'p', 'M', None) ,
+
+"TCY": ('a', 'd', 'M', None) ,
+
+"4F3": ('x', 'p', None, None) ,
+
+"TPG": ('g', 'r', 'M', None) ,
+
+"LAL": ('a', 'p', 'M', None) ,
+
+"TPC": ('c', 'd', 'M', None) ,
+
+"PPU": ('a', 'r', 'M', None) ,
+
+"CHF": ('x', 'p', None, None) ,
+
+"BFD": ('d', 'p', 'M', None) ,
+
+"TPO": ('t', 'p', 'M', None) ,
+
+"H5M": ('p', 'p', 'M', None) ,
+
+"AYG": ('x', 'p', None, None) ,
+
+"TPL": ('w', 'p', 'M', None) ,
+
+"AYA": ('a', 'p', 'M', None) ,
+
+"6MC": ('a', 'r', 'M', None) ,
+
+"6MA": ('a', 'r', 'M', None) ,
+
+"GSR": ('g', 'd', 'M', None) ,
+
+"EYS": ('x', 'p', None, None) ,
+
+"LPL": ('x', 'p', None, None) ,
+
+"6MZ": ('n', 'r', None, None) ,
+
+"PR3": ('c', 'p', 'M', None) ,
+
+"2ST": ('t', 'd', 'M', None) ,
+
+"0NC": ('a', 'p', 'M', None) ,
+
+"MRG": ('g', 'd', 'M', None) ,
+
+"KYN": ('a', 'p', 'M', None) ,
+
+"G2S": ('g', 'd', 'M', None) ,
+
+"PYX": ('c', 'p', 'M', None) ,
+
+"PYY": ('n', 'r', None, None) ,
+
+"TYN": ('y', 'p', 'M', None) ,
+
+"TYO": ('y', 'p', 'M', None) ,
+
+"KAG": ('g', 'r', 'M', None) ,
+
+"IPG": ('g', 'p', 'M', None) ,
+
+"GH3": ('g', 'r', 'M', None) ,
+
+"APP": ('x', 'p', None, None) ,
+
+"IPN": ('n', 'd', None, None) ,
+
+"TYB": ('y', 'p', 'M', None) ,
+
+"FAG": ('n', 'd', None, None) ,
+
+"DBY": ('y', 'p', 'M', None) ,
+
+"APK": ('k', 'p', 'M', None) ,
+
+"APH": ('a', 'p', 'M', None) ,
+
+"API": ('k', 'p', 'M', None) ,
+
+"TYX": ('x', 'p', None, None) ,
+
+"APO": ('x', 'p', None, None) ,
+
+"APM": ('x', 'p', None, None) ,
+
+"TYT": ('y', 'p', 'M', None) ,
+
+"TYU": ('n', 'r', None, None) ,
+
+"DBS": ('s', 'p', 'M', None) ,
+
+"DBU": ('a', 'p', 'M', None) ,
+
+"TYQ": ('y', 'p', 'M', None) ,
+
+"TYR": ('Y', 'p', None, None) ,
+
+"APE": ('x', 'p', None, None) ,
+
+"BT5": ('n', 'r', None, None) ,
+
+"KST": ('k', 'p', 'M', None) ,
+
+"2AD": ('x', 'p', None, None) ,
+
+"ARG": ('R', 'p', None, None) ,
+
+"HDP": ('n', 'd', None, None) ,
+
+"CZ2": ('c', 'p', 'M', None) ,
+
+"2AO": ('x', 'p', None, None) ,
+
+"G33": ('g', 'd', 'M', None) ,
+
+"AHO": ('a', 'p', 'M', None) ,
+
+"P2U": ('n', 'd', None, None) ,
+
+"P2T": ('t', 'd', 'M', None) ,
+
+"MG1": ('g', 'd', 'M', None) ,
+
+"G32": ('g', 'd', 'M', None) ,
+
+"2AR": ('a', 'd', 'M', None) ,
+
+"2AS": ('x', 'p', None, None) ,
+
+"G46": ('g', 'r', 'M', None) ,
+
+"G47": ('g', 'd', 'M', None) ,
+
+"G48": ('g', 'r', 'M', None) ,
+
+"G49": ('g', 'd', 'M', None) ,
+
+"OCS": ('c', 'p', 'M', None) ,
+
+"P2Y": ('p', 'p', 'M', None) ,
+
+"PHA": ('f', 'p', 'M', None) ,
+
+"NLQ": ('q', 'p', 'M', None) ,
+
+"NLP": ('l', 'p', 'M', None) ,
+
+"MLL": ('l', 'p', 'M', None) ,
+
+"CEA": ('c', 'p', 'M', None) ,
+
+"HV5": ('a', 'p', 'M', None) ,
+
+"HMR": ('r', 'p', 'M', None) ,
+
+"HRG": ('r', 'p', 'M', None) ,
+
+"CSP": ('c', 'p', 'M', None) ,
+
+"FA2": ('a', 'd', 'M', None) ,
+
+"BMP": ('n', 'r', None, None) ,
+
+"NLE": ('l', 'p', 'M', None) ,
+
+"RTP": ('n', 'r', None, None) ,
+
+"BMT": ('t', 'p', 'M', None) ,
+
+"G38": ('g', 'd', 'M', None) ,
+
+"CS4": ('c', 'p', 'M', None) ,
+
+"2FI": ('n', 'd', None, None) ,
+
+"TTS": ('y', 'p', 'M', None) ,
+
+"CS1": ('c', 'p', 'M', None) ,
+
+"CS0": ('c', 'p', 'M', None) ,
+
+"NLO": ('l', 'p', 'M', None) ,
+
+"NLN": ('l', 'p', 'M', None) ,
+
+"SHP": ('g', 'p', 'M', None) ,
+
+"CSL": ('c', 'd', 'M', None) ,
+
+"SHR": ('k', 'p', 'M', None) ,
+
+"OXX": ('d', 'p', 'M', None) ,
+
+"B3Y": ('y', 'p', 'M', None) ,
+
+"DLE": ('l', 'p', 'M', None) ,
+
+"PYA": ('a', 'p', 'M', None) ,
+
+"CSE": ('c', 'p', 'M', None) ,
+
+"5FA": ('a', 'r', 'M', None) ,
+
+"GCK": ('c', 'd', 'M', None) ,
+
+"5FC": ('c', 'd', 'M', None) ,
+
+"GGL": ('e', 'p', 'M', None) ,
+
+"B3Q": ('x', 'p', None, None) ,
+
+"B3S": ('s', 'p', 'M', None) ,
+
+"B3L": ('x', 'p', None, None) ,
+
+"A47": ('a', 'd', 'M', None) ,
+
+"A44": ('a', 'r', 'M', None) ,
+
+"5MU": ('u', 'r', 'M', None) ,
+
+"CSY": ('x', 'p', None, None) ,
+
+"A43": ('a', 'd', 'M', None) ,
+
+"A40": ('a', 'd', 'M', None) ,
+
+"B3K": ('k', 'p', 'M', None) ,
+
+"B3D": ('d', 'p', 'M', None) ,
+
+"B3E": ('e', 'p', 'M', None) ,
+
+"DLY": ('k', 'p', 'M', None) ,
+
+"MTU": ('a', 'r', 'M', None) ,
+
+"B3A": ('a', 'p', 'M', None) ,
+
+"CSS": ('c', 'p', 'M', None) ,
+
+"CSR": ('c', 'p', 'M', None) ,
+
+"CZZ": ('c', 'p', 'M', None) ,
+
+"N10": ('s', 'p', 'M', None) ,
+
+"MGG": ('r', 'p', 'M', None) ,
+
+"A35": ('a', 'd', 'M', None) ,
+
+"AFG": ('g', 'd', 'M', None) ,
+
+"BTR": ('w', 'p', 'M', None) ,
+
+"SSU": ('u', 'r', 'M', None) ,
+
+"70U": ('u', 'r', 'M', None) ,
+
+"A34": ('a', 'd', 'M', None) ,
+
+"MGN": ('q', 'p', 'M', None) ,
+
+"XCL": ('c', 'd', 'M', None) ,
+
+"G4P": ('n', 'r', None, None) ,
+
+"XCS": ('n', 'd', None, None) ,
+
+"MGQ": ('a', 'r', 'M', None) ,
+
+"ABS": ('a', 'd', 'M', None) ,
+
+"BTA": ('l', 'p', 'M', None) ,
+
+"MGV": ('g', 'r', 'M', None) ,
+
+"XCT": ('c', 'd', 'M', None) ,
+
+"TTQ": ('w', 'p', 'M', None) ,
+
+"MGY": ('g', 'p', 'M', None) ,
+
+"XCY": ('c', 'd', 'M', None) ,
+
+"NNH": ('r', 'p', 'M', None) ,
+
+"TBG": ('g', 'p', 'M', None) ,
+
+"ATD": ('t', 'd', 'M', None) ,
+
+"U8U": ('u', 'r', 'M', None) ,
+
+"SNC": ('c', 'p', 'M', None) ,
+
+"ALG": ('r', 'p', 'M', None) ,
+
+"M1G": ('g', 'd', 'M', None) ,
+
+"ATL": ('t', 'd', 'M', None) ,
+
+"ATM": ('t', 'd', 'M', None) ,
+
+"HPC": ('f', 'p', 'M', None) ,
+
+"TP1": ('t', 'd', 'M', None) ,
+
+"XUG": ('g', 'd', 'M', None) ,
+
+"ISO": ('x', 'p', None, None) ,
+
+"3MM": ('x', 'p', None, None) ,
+
+"175": ('x', 'p', None, None) ,
+
+"2TY": ('y', 'p', 'M', None) ,
+
+"CSB": ('c', 'p', 'M', None) ,
+
+"IT1": ('k', 'p', 'M', None) ,
+
+"UN1": ('x', 'p', None, None) ,
+
+"UN2": ('x', 'p', None, None) ,
+
+"ASP": ('D', 'p', None, None) ,
+
+"DTH": ('t', 'p', 'M', None) ,
+
+"SER": ('S', 'p', None, None) ,
+
+"ASU": ('n', 'd', None, None) ,
+
+"SEP": ('s', 'p', 'M', None) ,
+
+"LNT": ('x', 'p', None, None) ,
+
+"A39": ('a', 'r', 'M', None) ,
+
+"DGI": ('g', 'd', 'M', None) ,
+
+"DGN": ('q', 'p', 'M', None) ,
+
+"DGL": ('e', 'p', 'M', None) ,
+
+"SEG": ('a', 'p', 'M', None) ,
+
+"ASB": ('d', 'p', 'M', None) ,
+
+"ASA": ('d', 'p', 'M', None) ,
+
+"SEC": ('a', 'p', 'M', None) ,
+
+"SEB": ('s', 'p', 'M', None) ,
+
+"0A9": ('f', 'p', 'M', None) ,
+
+"ASK": ('d', 'p', 'M', None) ,
+
+"PVH": ('h', 'p', 'M', None) ,
+
+"ASI": ('d', 'p', 'M', None) ,
+
+"SEL": ('s', 'p', 'M', None) ,
+
+"ASN": ('N', 'p', None, None) ,
+
+"ASM": ('x', 'p', None, None) ,
+
+"ASL": ('d', 'p', 'M', None) ,
+
+"AS2": ('d', 'p', 'M', None) ,
+
+"IMC": ('c', 'd', 'M', None) ,
+
+"A3P": ('a', 'r', 'M', None) ,
+
+"CLH": ('k', 'p', 'M', None) ,
+
+"3DR": ('n', 'd', None, None) ,
+
+"FRD": ('x', 'p', None, None) ,
+
+"CLD": ('a', 'p', 'M', None) ,
+
+"CLE": ('l', 'p', 'M', None) ,
+
+"PDU": ('n', 'd', None, None) ,
+
+"CLG": ('k', 'p', 'M', None) ,
+
+"BBC": ('c', 'p', 'M', None) ,
+
+"TFO": ('a', 'd', 'M', None) ,
+
+"CLB": ('a', 'p', 'M', None) ,
+
+"TLC": ('t', 'd', 'M', None) ,
+
+"2DM": ('n', 'd', None, None) ,
+
+"A3A": ('a', 'd', 'M', None) ,
+
+"PDL": ('x', 'p', None, None) ,
+
+"3DA": ('a', 'd', 'M', None) ,
+
+"GT9": ('c', 'p', 'M', None) ,
+
+"CLV": ('x', 'p', None, None) ,
+
+"PDD": ('x', 'p', None, None) ,
+
+"1TQ": ('w', 'p', 'M', None) ,
+
+"SEM": ('x', 'p', None, None) ,
+
+"TGP": ('g', 'd', 'M', None) ,
+
+"OMC": ('c', 'r', 'M', None) ,
+
+"AEA": ('x', 'p', None, None) ,
+
+"OMG": ('g', 'r', 'M', None) ,
+
+"H2U": ('u', 'r', 'M', None) ,
+
+"A38": ('a', 'd', 'M', None) ,
+
+"DTY": ('y', 'p', 'M', None) ,
+
+"PVL": ('x', 'p', None, None) ,
+
+"ABA": ('a', 'p', 'M', None) ,
+
+"OMU": ('u', 'r', 'M', None) ,
+
+"OMT": ('m', 'p', 'M', None) ,
+
+"CRF": ('x', 'p', None, None) ,
+
+"FPA": ('f', 'p', 'M', None) ,
+
+"VMS": ('x', 'p', None, None) ,
+
+"T11": ('f', 'p', 'M', None) ,
+
+"2MR": ('r', 'p', 'M', None) ,
+
+"DNE": ('l', 'p', 'M', None) ,
+
+"5IC": ('c', 'r', 'M', None) ,
+
+"RC7": ('x', 'p', None, None) ,
+
+"BPE": ('c', 'p', 'M', None) ,
+
+"2MT": ('p', 'p', 'M', None) ,
+
+"2MU": ('u', 'r', 'M', None) ,
+
+"DG": ('G', 'd', None, None) ,
+
+"UCL": ('n', 'd', None, None) ,
+
+"DA": ('A', 'd', None, None) ,
+
+"AEI": ('d', 'p', 'M', None) ,
+
+"N5M": ('c', 'r', 'M', None) ,
+
+"5IU": ('n', 'd', None, None) ,
+
+"2MG": ('g', 'r', 'M', None) ,
+
+"AAR": ('r', 'p', 'M', None) ,
+
+"DT": ('T', 'd', None, None) ,
+
+"DU": ('n', 'd', None, None) ,
+
+"HV8": ('x', 'p', None, None) ,
+
+"MC1": ('s', 'p', 'M', None) ,
+
+"2FM": ('m', 'p', 'M', None) ,
+
+"CYS": ('C', 'p', None, None) ,
+
+"CYR": ('c', 'p', 'M', None) ,
+
+"BIL": ('x', 'p', None, None) ,
+
+"PCA": ('e', 'p', 'M', None) ,
+
+"GYC": ('x', 'p', None, None) ,
+
+"SMC": ('c', 'p', 'M', None) ,
+
+"0AC": ('g', 'p', 'M', None) ,
+
+"BIF": ('f', 'p', 'M', None) ,
+
+"2BU": ('a', 'd', 'M', None) ,
+
+"2BT": ('t', 'd', 'M', None) ,
+
+"5PC": ('c', 'd', 'M', None) ,
+
+"S2M": ('t', 'd', 'M', None) ,
+
+"5MC": ('c', 'r', 'M', None) ,
+
+"S2P": ('a', 'p', 'M', None) ,
+
+"C1X": ('k', 'p', 'M', None) ,
+
+"CYG": ('c', 'p', 'M', None) ,
+
+"CYF": ('c', 'p', 'M', None) ,
+
+"5PY": ('t', 'd', 'M', None) ,
+
+"CYJ": ('x', 'p', None, None) ,
+
+"BIU": ('i', 'p', 'M', None) ,
+
+"ENP": ('n', 'r', None, None) ,
+
+"AS9": ('x', 'p', None, None) ,
+
+"CYM": ('c', 'p', 'M', None) ,
+
+"CY3": ('c', 'p', 'M', None) ,
+
+"DHN": ('v', 'p', 'M', None) ,
+
+"CY1": ('c', 'p', 'M', None) ,
+
+"CY0": ('c', 'p', 'M', None) ,
+
+"SLZ": ('k', 'p', 'M', None) ,
+
+"CY4": ('c', 'p', 'M', None) ,
+
+"T5S": ('t', 'd', 'M', None) ,
+
+"SLR": ('p', 'p', 'M', None) ,
+
+"IML": ('i', 'p', 'M', None) ,
+
+"32S": ('x', 'p', None, None) ,
+
+"CSX": ('c', 'p', 'M', None) ,
+
+"MFC": ('x', 'p', None, None) ,
+
+"32T": ('x', 'p', None, None) ,
+
+"TFT": ('t', 'd', 'M', None) ,
+
+"MLZ": ('k', 'p', 'M', None) ,
+
+"DHU": ('u', 'r', 'M', None) ,
+
+"ASQ": ('d', 'p', 'M', None) ,
+
+"SLA": ('p', 'p', 'M', None) ,
+
+"DHP": ('x', 'p', None, None) ,
+
+"E1X": ('a', 'd', 'M', None) ,
+
+"XGL": ('g', 'd', 'M', None) ,
+
+"MCL": ('k', 'p', 'M', None) ,
+
+"TLB": ('n', 'r', None, None) ,
+
+"MCG": ('x', 'p', None, None) ,
+
+"OTB": ('x', 'p', None, None) ,
+
+"FT6": ('w', 'p', 'M', None) ,
+
+"XGA": ('n', 'd', None, None) ,
+
+"AA4": ('a', 'p', 'M', None) ,
+
+"R": ('a', 'd', 'M', None) ,
+
+"GFL": ('g', 'd', 'M', None) ,
+
+"10C": ('c', 'r', 'M', None) ,
+
+"NRQ": ('x', 'p', None, None) ,
+
+"XGU": ('g', 'd', 'M', None) ,
+
+"MCS": ('c', 'p', 'M', None) ,
+
+"D3": ('n', 'd', None, None) ,
+
+"PAQ": ('y', 'p', 'M', None) ,
+
+"2PR": ('g', 'd', 'M', None) ,
+
+"PAT": ('w', 'p', 'M', None) ,
+
+"PAU": ('a', 'p', 'M', None) ,
+
+"CH": ('c', 'r', 'M', None) ,
+
+"GCM": ('x', 'p', None, None) ,
+
+"CSZ": ('c', 'p', 'M', None) ,
+
+"GMS": ('g', 'd', 'M', None) ,
+
+"HBN": ('h', 'p', 'M', None) ,
+
+"TQQ": ('w', 'p', 'M', None) ,
+
+"2PI": ('x', 'p', None, None) ,
+
+"GSU": ('e', 'p', 'M', None) ,
+
+"CSI": ('g', 'p', 'M', None) ,
+
+"200": ('f', 'p', 'M', None) ,
+
+"EXY": ('l', 'p', 'M', None) ,
+
+"12A": ('a', 'r', 'M', None) ,
+
+"DCL": ('x', 'p', None, None) ,
+
+"UNK": ('x', 'p', None, None) ,
+
+"DCI": ('x', 'p', None, None) ,
+
+"DCG": ('g', 'd', 'M', None) ,
+
+"4HT": ('w', 'p', 'M', None) ,
+
+"CSU": ('c', 'p', 'M', None) ,
+
+"HSO": ('h', 'p', 'M', None) ,
+
+"HSL": ('s', 'p', 'M', None) ,
+
+"TLN": ('n', 'd', None, None) ,
+
+"TZB": ('x', 'p', None, None) ,
+
+"BTC": ('c', 'p', 'M', None) ,
+
+"DCY": ('c', 'p', 'M', None) ,
+
+"DCT": ('c', 'd', 'M', None) ,
+
+"4BF": ('y', 'p', 'M', None) ,
+
+"C2L": ('c', 'r', 'M', None) ,
+
+"RIA": ('a', 'r', 'M', None) ,
+
+"IAM": ('a', 'p', 'M', None) ,
+
+"B1F": ('f', 'p', 'M', None) ,
+
+"GPN": ('g', 'd', 'M', None) ,
+
+"C25": ('c', 'r', 'M', None) ,
+
+"N2C": ('x', 'p', None, None) ,
+
+"HAC": ('a', 'p', 'M', None) ,
+
+"MEG": ('e', 'p', 'M', None) ,
+
+"THO": ('x', 'p', None, None) ,
+
+"BNO": ('x', 'p', None, None) ,
+
+"125": ('u', 'r', 'M', None) ,
+
+"126": ('u', 'r', 'M', None) ,
+
+"127": ('u', 'r', 'M', None) ,
+
+"128": ('n', 'r', None, None) ,
+
+"X": ('g', 'd', 'M', None) ,
+
+"HS8": ('h', 'p', 'M', None) ,
+
+"NAM": ('a', 'p', 'M', None) ,
+
+"THC": ('t', 'p', 'M', None) ,
+
+"HRP": ('w', 'p', 'M', None) ,
+
+"MNV": ('v', 'p', 'M', None) ,
+
+"PHI": ('f', 'p', 'M', None) ,
+
+"PHM": ('f', 'p', 'M', None) ,
+
+"PHL": ('f', 'p', 'M', None) ,
+
+"CSW": ('c', 'p', 'M', None) ,
+
+"ZAD": ('a', 'r', 'M', None) ,
+
+"OIC": ('x', 'p', None, None) ,
+
+"PHE": ('F', 'p', None, None) ,
+
+"PHD": ('d', 'p', 'M', None) ,
+
+"SYS": ('c', 'p', 'M', None) ,
+
+"BG1": ('s', 'p', 'M', None) ,
+
+"NIY": ('y', 'p', 'M', None) ,
+
+"MTR": ('t', 'd', 'M', None) ,
+
+"OAS": ('s', 'p', 'M', None) ,
+
+"BRU": ('n', 'd', None, None) ,
+
+"NIT": ('x', 'p', None, None) ,
+
+"OIP": ('n', 'd', None, None) ,
+
+"0A0": ('d', 'p', 'M', None) ,
+
+"0A1": ('y', 'p', 'M', None) ,
+
+"0A2": ('k', 'p', 'M', None) ,
+
+"CRQ": ('x', 'p', None, None) ,
+
+"CRW": ('x', 'p', None, None) ,
+
+"CRU": ('e', 'p', 'M', None) ,
+
+"DMH": ('n', 'p', 'M', None) ,
+
+"PRR": ('a', 'p', 'M', None) ,
+
+"CRX": ('x', 'p', None, None) ,
+
+"DMK": ('d', 'p', 'M', None) ,
+
+"MHL": ('l', 'p', 'M', None) ,
+
+"LAA": ('d', 'p', 'M', None) ,
+
+"0ZM": ('x', 'p', None, None) ,
+
+"DMT": ('x', 'p', None, None) ,
+
+"CRG": ('x', 'p', None, None) ,
+
+"0ZJ": ('x', 'p', None, None) ,
+
+"0ZE": ('x', 'p', None, None) ,
+
+"CRK": ('x', 'p', None, None) ,
+
+"TPH": ('x', 'p', None, None) ,
+
+"1PI": ('x', 'p', None, None) ,
+
+"CRO": ('x', 'p', None, None) ,
+
+"0ZC": ('x', 'p', None, None) ,
+
+"MIS": ('s', 'p', 'M', None) ,
+
+"C36": ('c', 'd', 'M', None) ,
+
+"NFA": ('f', 'p', 'M', None) ,
+
+"PU": ('a', 'r', 'M', None) ,
+
+"G7M": ('g', 'r', 'M', None) ,
+
+"S6G": ('g', 'd', 'M', None) ,
+
+"LDH": ('k', 'p', 'M', None) ,
+
+"TCP": ('t', 'd', 'M', None) ,
+
+"TCQ": ('x', 'p', None, None) ,
+
+"8AN": ('a', 'r', 'M', None) ,
+
+"BUC": ('c', 'p', 'M', None) ,
+
+"C32": ('c', 'd', 'M', None) ,
+
+"7MG": ('g', 'r', 'M', None) ,
+
+"BUG": ('l', 'p', 'M', None) ,
+
+"LEU": ('L', 'p', None, None) ,
+
+"MHO": ('m', 'p', 'M', None) ,
+
+"C": ('C', 'r', None, None) ,
+
+"DDX": ('n', 'd', None, None) ,
+
+"OPR": ('r', 'p', 'M', None) ,
+
+"FOX": ('g', 'd', 'M', None) ,
+
+"MTY": ('y', 'p', 'M', None) ,
+
+"TC1": ('c', 'd', 'M', None) ,
+
+"FOE": ('c', 'p', 'M', None) ,
+
+"MF3": ('x', 'p', None, None) ,
+
+"DDN": ('n', 'd', None, None) ,
+
+"FME": ('m', 'p', 'M', None) ,
+
+"EFC": ('c', 'p', 'M', None) ,
+
+"DDG": ('g', 'd', 'M', None) ,
+
+"MHS": ('h', 'p', 'M', None) ,
+
+"DDE": ('h', 'p', 'M', None) ,
+
+"CR2": ('x', 'p', None, None) ,
+
+"DSN": ('s', 'p', 'M', None) ,
+
+"PSH": ('h', 'p', 'M', None) ,
+
+"6MI": ('n', 'd', None, None) ,
+
+"CR7": ('x', 'p', None, None) ,
+
+"0AV": ('a', 'd', 'M', None) ,
+
+"CR5": ('g', 'p', 'M', None) ,
+
+"MOR": ('x', 'p', None, None) ,
+
+"CR8": ('x', 'p', None, None) ,
+
+"PSA": ('f', 'p', 'M', None) ,
+
+"ANI": ('x', 'p', None, None) ,
+
+"NP3": ('n', 'd', None, None) ,
+
+"DM0": ('k', 'p', 'M', None) ,
+
+"0AA": ('v', 'p', 'M', None) ,
+
+"0AB": ('v', 'p', 'M', None) ,
+
+"FOG": ('f', 'p', 'M', None) ,
+
+"0AD": ('g', 'd', 'M', None) ,
+
+"LCC": ('n', 'd', None, None) ,
+
+"NVA": ('v', 'p', 'M', None) ,
+
+"0AG": ('l', 'p', 'M', None) ,
+
+"0AH": ('s', 'p', 'M', None) ,
+
+"1MA": ('a', 'r', 'M', None) ,
+
+"0AK": ('d', 'p', 'M', None) ,
+
+"0AM": ('a', 'd', 'M', None) ,
+
+"PST": ('t', 'd', 'M', None) ,
+
+"PSU": ('u', 'r', 'M', None) ,
+
+"1ZX": ('x', 'p', None, None) ,
+
+"ILG": ('e', 'p', 'M', None) ,
+
+"ILE": ('I', 'p', None, None) ,
+
+"5CM": ('c', 'd', 'M', None) ,
+
+"D11": ('t', 'p', 'M', None) ,
+
+"UMS": ('n', 'd', None, None) ,
+
+"X9Q": ('x', 'p', None, None) ,
+
+"FGP": ('s', 'p', 'M', None) ,
+
+"DVA": ('v', 'p', 'M', None) ,
+
+"5ZA": ('x', 'p', None, None) ,
+
+"BCC": ('x', 'p', None, None) ,
+
+"TMB": ('t', 'p', 'M', None) ,
+
+"3AH": ('h', 'p', 'M', None) ,
+
+"BCX": ('c', 'p', 'M', None) ,
+
+"KPI": ('k', 'p', 'M', None) ,
+
+"A2L": ('a', 'r', 'M', None) ,
+
+"A2M": ('a', 'r', 'M', None) ,
+
+"ILX": ('i', 'p', 'M', None) ,
+
+"PEC": ('c', 'p', 'M', None) ,
+
+"IGL": ('g', 'p', 'M', None) ,
+
+"OLE": ('x', 'p', None, None) ,
+
+"LPG": ('g', 'p', 'M', None) ,
+
+"DI": ('n', 'd', None, None) ,
+
+"ALO": ('t', 'p', 'M', None) ,
+
+"OLT": ('t', 'p', 'M', None) ,
+
+"TBM": ('t', 'p', 'M', None) ,
+
+"2AU": ('u', 'r', 'M', None) ,
+
+"LED": ('l', 'p', 'M', None) ,
+
+"OLZ": ('s', 'p', 'M', None) ,
+
+"C6C": ('c', 'p', 'M', None) ,
+
+"IEY": ('x', 'p', None, None) ,
+
+"HEU": ('n', 'd', None, None) ,
+
+"SRA": ('a', 'r', 'M', None) ,
+
+"ZTH": ('n', 'r', None, None) ,
+
+"NDN": ('n', 'd', None, None) ,
+
+"C66": ('x', 'p', None, None) ,
+
+"6CW": ('w', 'p', 'M', None) ,
+
+"CR0": ('x', 'p', None, None) ,
+
+"DBM": ('n', 'r', None, None) ,
+
+"N": ('n', 'r', None, None) ,
+
+"N6G": ('g', 'r', 'M', None) ,
+
+"ALC": ('a', 'p', 'M', None) ,
+
+"S1H": ('s', 'p', 'M', None) ,
+
+"FZN": ('k', 'p', 'M', None) ,
+
+"0SP": ('a', 'd', 'M', None) ,
+
+"OBS": ('x', 'p', None, None) ,
+
+"2NT": ('t', 'd', 'M', None) ,
+
+"K1R": ('c', 'p', 'M', None) ,
+
+"NMT": ('t', 'd', 'M', None) ,
+
+"A23": ('a', 'r', 'M', None) ,
+
+"D1P": ('n', 'd', None, None) ,
+
+"NMS": ('t', 'd', 'M', None) ,
+
+"CIR": ('r', 'p', 'M', None) ,
+
+"CH6": ('x', 'p', None, None) ,
+
+"BJH": ('x', 'p', None, None) ,
+
+"YYG": ('g', 'r', 'M', None) ,
+
+"2MA": ('a', 'r', 'M', None) ,
+
+"NMC": ('g', 'p', 'M', None) ,
+
+"0AY": ('x', 'p', None, None) ,
+
+"UFP": ('n', 'd', None, None) ,
+
+"SET": ('s', 'p', 'M', None) ,
+
+"UFR": ('n', 'd', None, None) ,
+
+"NMM": ('r', 'p', 'M', None) ,
+
+"UFT": ('n', 'd', None, None) ,
+
+"0AZ": ('p', 'p', 'M', None) ,
+
+"5IT": ('t', 'd', 'M', None) ,
+
+"DIL": ('i', 'p', 'M', None) ,
+
+"FHL": ('x', 'p', None, None) ,
+
+"0Z6": ('x', 'p', None, None) ,
+
+"AR4": ('e', 'p', 'M', None) ,
+
+"EIT": ('t', 'd', 'M', None) ,
+
+"SD2": ('x', 'p', None, None) ,
+
+"CH7": ('x', 'p', None, None) ,
+
+"N5I": ('n', 'd', None, None) ,
+
+"5AT": ('t', 'd', 'M', None) ,
+
+"LOL": ('x', 'p', None, None) ,
+
+"HYP": ('p', 'p', 'M', None) ,
+
+"IYT": ('t', 'p', 'M', None) ,
+
+"LOV": ('x', 'p', None, None) ,
+
+"LCX": ('k', 'p', 'M', None) ,
+
+"GND": ('x', 'p', None, None) ,
+
+"GNE": ('n', 'd', None, None) ,
+
+"FHU": ('u', 'r', 'M', None) ,
+
+"C12": ('x', 'p', None, None) ,
+
+"DIV": ('v', 'p', 'M', None) ,
+
+"T6A": ('a', 'r', 'M', None) ,
+
+"DIR": ('r', 'p', 'M', None) ,
+
+"AIB": ('a', 'p', 'M', None) ,
+
+"SOC": ('c', 'p', 'M', None) ,
+
+"NSK": ('x', 'p', None, None) ,
+
+"LCG": ('g', 'd', 'M', None) ,
+
+"MT2": ('m', 'p', 'M', None) ,
+
+"GAU": ('e', 'p', 'M', None) ,
+
+"PPH": ('l', 'p', 'M', None) ,
+
+"PPN": ('f', 'p', 'M', None) ,
+
+"1MG": ('g', 'r', 'M', None) ,
+
+"GAO": ('g', 'r', 'M', None) ,
+
+"FAI": ('n', 'r', None, None) ,
+
+"PPW": ('g', 'd', 'M', None) ,
+
+"2ML": ('l', 'p', 'M', None) ,
+
+"MBZ": ('n', 'd', None, None) ,
+
+"TPN": ('t', 'd', 'M', None) ,
+
+"SOY": ('s', 'p', 'M', None) ,
+
+"CBV": ('c', 'r', 'M', None) ,
+
+"MBQ": ('y', 'p', 'M', None) ,
+
+"G31": ('g', 'd', 'M', None) ,
+
+"HTI": ('c', 'p', 'M', None) ,
+
+"XX1": ('k', 'p', 'M', None) ,
+
+"6OG": ('g', 'd', 'M', None) ,
+
+"0AF": ('w', 'p', 'M', None) ,
+
+"G36": ('g', 'd', 'M', None) ,
+
+"I": ('n', 'r', None, None) ,
+
+"YOF": ('y', 'p', 'M', None) ,
+
+"HPQ": ('f', 'p', 'M', None) ,
+
+"LCA": ('a', 'r', 'M', None) ,
+
+"IU": ('u', 'r', 'M', None) ,
+
+"CYQ": ('c', 'p', 'M', None) ,
+
+"M0H": ('c', 'p', 'M', None) ,
+
+"FA5": ('n', 'r', None, None) ,
+
+"LVG": ('g', 'p', 'M', None) ,
+
+"HPH": ('x', 'p', None, None) ,
+
+"IRN": ('n', 'r', None, None) ,
+
+"Y": ('a', 'd', 'M', None) ,
+
+"IC": ('c', 'r', 'M', None) ,
+
+"4DP": ('w', 'p', 'M', None) ,
+
+"HPE": ('f', 'p', 'M', None) ,
+
+"PR5": ('a', 'r', 'M', None) ,
+
+"CDE": ('x', 'p', None, None) ,
+
+"SDP": ('s', 'p', 'M', None) ,
+
+"GN7": ('g', 'd', 'M', None) ,
+
+"ARV": ('x', 'p', None, None) ,
+
+"2AT": ('t', 'd', 'M', None) ,
+
+"T66": ('x', 'p', None, None) ,
+
+"LCK": ('k', 'p', 'M', None) ,
+
+"EHP": ('f', 'p', 'M', None) ,
+
+"CHP": ('g', 'p', 'M', None) ,
+
+"HY3": ('p', 'p', 'M', None) ,
+
+"THX": ('n', 'd', None, None) ,
+
+"LCH": ('n', 'd', None, None) ,
+
+"4MF": ('n', 'd', None, None) ,
+
+"DTR": ('w', 'p', 'M', None) ,
+
+"MOD": ('x', 'p', None, None) ,
+
+"4MM": ('x', 'p', None, None) ,
+
+"ARO": ('r', 'p', 'M', None) ,
+
+"GSS": ('g', 'd', 'M', None) ,
+
+"DRZ": ('n', 'd', None, None) ,
+
+"CCY": ('x', 'p', None, None) ,
+
+"TPQ": ('y', 'p', 'M', None) ,
+
+"5CS": ('c', 'p', 'M', None) ,
+
+"4OC": ('c', 'r', 'M', None) ,
+
+"DRP": ('n', 'd', None, None) ,
+
+"BOR": ('r', 'p', 'M', None) ,
+
+"DRT": ('t', 'd', 'M', None) ,
+
+"CCS": ('c', 'p', 'M', None) ,
+
+"TS": ('n', 'd', None, None) ,
+
+"MME": ('m', 'p', 'M', None) ,
+
+"CCL": ('k', 'p', 'M', None) ,
+
+"GSC": ('g', 'p', 'M', None) ,
+
+"DRM": ('n', 'd', None, None) ,
+
+"4FB": ('p', 'p', 'M', None) ,
+
+"GYS": ('x', 'p', None, None) ,
+
+"NAL": ('a', 'p', 'M', None) ,
+
+"6MT": ('a', 'r', 'M', None) ,
+
+"CCC": ('c', 'r', 'M', None) ,
+
+"UMP": ('u', 'r', 'M', None) ,
+
+"ML3": ('k', 'p', 'M', None) ,
+
+"LPD": ('p', 'p', 'M', None) ,
+
+"OHI": ('h', 'p', 'M', None) ,
+
+"LYR": ('k', 'p', 'M', None) ,
+
+"LYS": ('K', 'p', None, None) ,
+
+"LYX": ('k', 'p', 'M', None) ,
+
+"CYA": ('c', 'p', 'M', None) ,
+
+"LYZ": ('k', 'p', 'M', None) ,
+
+"ODP": ('n', 'r', None, None) ,
+
+"C3Y": ('c', 'p', 'M', None) ,
+
+"POM": ('p', 'p', 'M', None) ,
+
+"LYM": ('k', 'p', 'M', None) ,
+
+"LYN": ('k', 'p', 'M', None) ,
+
+"GLQ": ('e', 'p', 'M', None) ,
+
+"PIV": ('x', 'p', None, None) ,
+
+"OHS": ('d', 'p', 'M', None) ,
+
+"X9A": ('x', 'p', None, None) ,
+
+"SMT": ('n', 'r', None, None) ,
+
+"XAR": ('n', 'd', None, None) ,
+
+"CYD": ('c', 'p', 'M', None) ,
+
+"SVA": ('s', 'p', 'M', None) ,
+
+"5HT": ('t', 'd', 'M', None) ,
+
+"5HU": ('n', 'd', None, None) ,
+
+"XAL": ('a', 'd', 'M', None) ,
+
+"T": ('n', 'd', None, None) ,
+
+"5HP": ('e', 'p', 'M', None) ,
+
+"4SC": ('c', 'd', 'M', None) ,
+
+"CQR": ('x', 'p', None, None) ,
+
+"XAD": ('a', 'd', 'M', None) ,
+
+"XAE": ('n', 'd', None, None) ,
+
+"TYI": ('y', 'p', 'M', None) ,
+
+"VLL": ('x', 'p', None, None) ,
+
+"2BD": ('n', 'd', None, None) ,
+
+"IIC": ('x', 'p', None, None) ,
+
+"A66": ('x', 'p', None, None) ,
+
+"2EG": ('g', 'd', 'M', None) ,
+
+"2SA": ('n', 'r', None, None) ,
+
+"2CO": ('c', 'p', 'M', None) ,
+
+"TMD": ('t', 'p', 'M', None) ,
+
+"CXM": ('m', 'p', 'M', None) ,
+
+"ALA": ('A', 'p', None, None) ,
+
+"GOM": ('g', 'r', 'M', None) ,
+
+"2VA": ('v', 'p', 'M', None) ,
+
+"5BU": ('u', 'r', 'M', None) ,
+
+"IGU": ('g', 'd', 'M', None) ,
+
+"MLE": ('l', 'p', 'M', None) ,
+
+"T39": ('n', 'r', None, None) ,
+
+"FLT": ('y', 'p', 'M', None) ,
+
+"U37": ('u', 'r', 'M', None) ,
+
+"U36": ('u', 'r', 'M', None) ,
+
+"DHL": ('x', 'p', None, None) ,
+
+"U33": ('n', 'd', None, None) ,
+
+"TIH": ('a', 'p', 'M', None) ,
+
+"SMF": ('f', 'p', 'M', None) ,
+
+"FLA": ('a', 'p', 'M', None) ,
+
+"HOB": ('n', 'd', None, None) ,
+
+"FLE": ('l', 'p', 'M', None) ,
+
+"VDL": ('x', 'p', None, None) ,
+
+"A1P": ('n', 'd', None, None) ,
+
+"0G6": ('x', 'p', None, None) ,
+
+"LLY": ('k', 'p', 'M', None) ,
+
+"DHI": ('h', 'p', 'M', None) ,
+
+"RON": ('x', 'p', None, None) ,
+
+"PTH": ('y', 'p', 'M', None) ,
+
+"T32": ('t', 'd', 'M', None) ,
+
+"LLP": ('k', 'p', 'M', None) ,
+
+"MNU": ('u', 'r', 'M', None) ,
+
+"PTA": ('x', 'p', None, None) ,
+
+"TZO": ('x', 'p', None, None) ,
+
+"DBZ": ('a', 'p', 'M', None) ,
+
+"MNL": ('l', 'p', 'M', None) ,
+
+"APN": ('a', 'd', 'M', None) ,
+
+"OCY": ('c', 'p', 'M', None) ,
+
+"BCS": ('c', 'p', 'M', None) ,
+
+"OSE": ('s', 'p', 'M', None) ,
+
+"3TY": ('x', 'p', None, None) ,
+
+"SCS": ('c', 'p', 'M', None) ,
+
+"TYY": ('y', 'p', 'M', None) ,
+
+"0A5": ('n', 'p', 'M', None) ,
+
+"PBT": ('n', 'd', None, None) ,
+
+"CWR": ('s', 'p', 'M', None) ,
+
+"TRO": ('w', 'p', 'M', None) ,
+
+"TRN": ('w', 'p', 'M', None) ,
+
+"PYO": ('u', 'r', 'M', None) ,
+
+"ZGU": ('g', 'r', 'M', None) ,
+
+"TRG": ('k', 'p', 'M', None) ,
+
+"TRF": ('w', 'p', 'M', None) ,
+
+"R1F": ('c', 'p', 'M', None) ,
+
+"M5M": ('c', 'r', 'M', None) ,
+
+"PBF": ('f', 'p', 'M', None) ,
+
+"R1B": ('c', 'p', 'M', None) ,
+
+"DHA": ('a', 'p', 'M', None) ,
+
+"YCM": ('c', 'p', 'M', None) ,
+
+"R1A": ('c', 'p', 'M', None) ,
+
+"TRQ": ('w', 'p', 'M', None) ,
+
+"TRP": ('W', 'p', None, None) ,
+
+"T23": ('n', 'r', None, None) ,
+
+"TRW": ('w', 'p', 'M', None) ,
+
+"4FW": ('w', 'p', 'M', None) ,
+
+"IVA": ('x', 'p', None, None) ,
+
+"VOL": ('x', 'p', None, None) ,
+
+"6HT": ('t', 'd', 'M', None) ,
+
+"6HG": ('g', 'd', 'M', None) ,
+
+"MPJ": ('x', 'p', None, None) ,
+
+"C43": ('c', 'r', 'M', None) ,
+
+"MPH": ('x', 'p', None, None) ,
+
+"AVN": ('x', 'p', None, None) ,
+
+"M3L": ('k', 'p', 'M', None) ,
+
+"C5C": ('c', 'p', 'M', None) ,
+
+"HTR": ('w', 'p', 'M', None) ,
+
+"MPQ": ('g', 'p', 'M', None) ,
+
+"ESC": ('m', 'p', 'M', None) ,
+
+"3ME": ('n', 'd', None, None) ,
+
+"TYS": ('y', 'p', 'M', None) ,
+
+"6HA": ('a', 'd', 'M', None) ,
+
+"KCX": ('k', 'p', 'M', None) ,
+
+"6HC": ('c', 'd', 'M', None) ,
+
+"AVC": ('a', 'r', 'M', None) ,
+
+"GTP": ('g', 'r', 'M', None) ,
+
+"ACB": ('d', 'p', 'M', None) ,
+
+"2SI": ('x', 'p', None, None) ,
+
+"NEM": ('h', 'p', 'M', None) ,
+
+"N7P": ('p', 'p', 'M', None) ,
+
+"SUB": ('x', 'p', None, None) ,
+
+"2AG": ('g', 'p', 'M', None) ,
+
+"SUN": ('s', 'p', 'M', None) ,
+
+"SUI": ('x', 'p', None, None) ,
+
+"ACL": ('r', 'p', 'M', None) ,
+
+"SUR": ('u', 'r', 'M', None) ,
+
+"BVP": ('n', 'd', None, None) ,
+
+"HFA": ('x', 'p', None, None) ,
+
+"LET": ('x', 'p', None, None) ,
+
+"0A8": ('c', 'p', 'M', None) ,
+
+"D4P": ('x', 'p', None, None) ,
+
+"2OT": ('t', 'd', 'M', None) ,
+
+"NEP": ('h', 'p', 'M', None) ,
+
+"PMT": ('c', 'r', 'M', None) ,
+
+"2DT": ('t', 'd', 'M', None) ,
+
+"MLY": ('k', 'p', 'M', None) ,
+
+"AD2": ('a', 'd', 'M', None) ,
+
+"CGA": ('e', 'p', 'M', None) ,
+
+"NBQ": ('y', 'p', 'M', None) ,
+
+"ODS": ('x', 'p', None, None) ,
+
+"7GU": ('g', 'd', 'M', None) ,
+
+"SAH": ('c', 'p', 'M', None) ,
+
+"2DF": ('n', 'd', None, None) ,
+
+"2DA": ('a', 'd', 'M', None) ,
+
+"PCC": ('p', 'p', 'M', None) ,
+
+"ODA": ('x', 'p', None, None) ,
+
+"2DO": ('x', 'p', None, None) ,
+
+"CGU": ('e', 'p', 'M', None) ,
+
+"L2A": ('x', 'p', None, None) ,
+
+"DNG": ('l', 'p', 'M', None) ,
+
+"UMA": ('a', 'p', 'M', None) ,
+
+"PM3": ('f', 'p', 'M', None) ,
+
+"DNM": ('l', 'p', 'M', None) ,
+
+"DNL": ('k', 'p', 'M', None) ,
+
+"GMA": ('e', 'p', 'M', None) ,
+
+"1LU": ('l', 'p', 'M', None) ,
+
+"CDV": ('x', 'p', None, None) ,
+
+"ADX": ('n', 'r', None, None) ,
+
+"LKC": ('n', 'd', None, None) ,
+
+"ADD": ('x', 'p', None, None) ,
+
+"CUC": ('x', 'p', None, None) ,
+
+"DNP": ('a', 'p', 'M', None) ,
+
+"DNS": ('k', 'p', 'M', None) ,
+
+"DNR": ('c', 'd', 'M', None) ,
+
+"CG1": ('g', 'r', 'M', None) ,
+
+"Z": ('c', 'd', 'M', None) ,
+
+"GMU": ('n', 'd', None, None) ,
+
+"C99": ('x', 'p', None, None) ,
+
+"GDP": ('g', 'r', 'M', None) ,
+
+"MED": ('m', 'p', 'M', None) ,
+
+"GDR": ('g', 'd', 'M', None) ,
+
+"MEA": ('f', 'p', 'M', None) ,
+
+"LEF": ('l', 'p', 'M', None) ,
+
+"LEH": ('l', 'p', 'M', None) ,
+
+"CHG": ('x', 'p', None, None) ,
+
+"MEN": ('n', 'p', 'M', None) ,
+
+"G42": ('g', 'd', 'M', None) ,
+
+"5CG": ('g', 'd', 'M', None) ,
+
+"T31": ('u', 'r', 'M', None) ,
+
+"MEU": ('g', 'p', 'M', None) ,
+
+"MET": ('M', 'p', None, None) ,
+
+"U34": ('u', 'r', 'M', None) ,
+
+"MEQ": ('q', 'p', 'M', None) ,
+
+"MEP": ('u', 'r', 'M', None) ,
+
+"B1P": ('n', 'd', None, None) ,
+
+"IG": ('g', 'r', 'M', None) ,
+
+"T2S": ('n', 'r', None, None) ,
+
+"ZHP": ('n', 'r', None, None) ,
+
+"AZK": ('k', 'p', 'M', None) ,
+
+"U31": ('u', 'r', 'M', None) ,
+
+"LTR": ('w', 'p', 'M', None) ,
+
+"MSU": ('x', 'p', None, None) ,
+
+"1PA": ('f', 'p', 'M', None) ,
+
+"MSP": ('a', 'p', 'M', None) ,
+
+"MSO": ('m', 'p', 'M', None) ,
+
+"AZY": ('y', 'p', 'M', None) ,
+
+"ENA": ('n', 'r', None, None) ,
+
+"MSL": ('m', 'p', 'M', None) ,
+
+"PF5": ('f', 'p', 'M', None) ,
+
+"1PR": ('n', 'r', None, None) ,
+
+"3AR": ('x', 'p', None, None) ,
+
+"MSE": ('m', 'p', 'M', None) ,
+
+"AZS": ('s', 'p', 'M', None) ,
+
+"MSA": ('g', 'p', 'M', None) ,
+
+"R2P": ('x', 'p', None, None) ,
+
+"CAR": ('c', 'd', 'M', None) ,
+
+"DAB": ('a', 'p', 'M', None) ,
+
+"OTY": ('y', 'p', 'M', None) ,
+
+"DAL": ('a', 'p', 'M', None) ,
+
+"DAM": ('x', 'p', None, None) ,
+
+"TT": ('n', 'd', None, None) ,
+
+"IOY": ('f', 'p', 'M', None) ,
+
+"DAH": ('f', 'p', 'M', None) ,
+
+"8MG": ('g', 'd', 'M', None) ,
+
+"BZG": ('n', 'd', None, None) ,
+
+"ARM": ('r', 'p', 'M', None) ,
+
+"DAR": ('r', 'p', 'M', None) ,
+
+"DAS": ('d', 'p', 'M', None) ,
+
+"MCY": ('c', 'd', 'M', None) ,
+
+"SGB": ('s', 'p', 'M', None) ,
+
+"YRR": ('n', 'd', None, None) ,
+
+"NF2": ('n', 'r', None, None) ,
+
+"CNU": ('u', 'r', 'M', None) ,
+
+"E": ('a', 'd', 'M', None) ,
+
+"AA3": ('a', 'p', 'M', None) ,
+
+"GVL": ('x', 'p', None, None) ,
+
+"TNR": ('s', 'p', 'M', None) ,
+
+"HOL": ('n', 'd', None, None) ,
+
+"PTM": ('y', 'p', 'M', None) ,
+
+"AS": ('a', 'd', 'M', None) ,
+
+"U": ('U', 'r', None, None) ,
+
+"ESB": ('y', 'p', 'M', None) ,
+
+"DA2": ('x', 'p', None, None) ,
+
+"TNB": ('c', 'p', 'M', None) ,
+
+"RMP": ('a', 'd', 'M', None) ,
+
+"SME": ('m', 'p', 'M', None) ,
+
+"NDF": ('f', 'p', 'M', None) ,
+
+"BOE": ('t', 'd', 'M', None) ,
+
+"LGP": ('g', 'd', 'M', None) ,
+
+"SCH": ('c', 'p', 'M', None) ,
+
+"T2T": ('n', 'd', None, None) ,
+
+"PFF": ('f', 'p', 'M', None) ,
+
+"PCE": ('x', 'p', None, None) ,
+
+"DFO": ('x', 'p', None, None) ,
+
+"DXN": ('n', 'd', None, None) ,
+
+"KGC": ('k', 'p', 'M', None) ,
+
+"US1": ('n', 'd', None, None) ,
+
+"HHK": ('x', 'p', None, None) ,
+
+"DXD": ('n', 'd', None, None) ,
+
+"ZCY": ('c', 'r', 'M', None) ,
+
+"IEL": ('k', 'p', 'M', None)
+
+}
\ No newline at end of file
diff -r 621fe8e2c1f7 -r 3161cdaf2ff9 blocks3d/AlignmentSeq.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/blocks3d/AlignmentSeq.py Fri Sep 17 21:52:33 2010 +0400
@@ -0,0 +1,490 @@
+# -*- coding: cp1251 -*-
+
+#####################################################################
+# Класс функций, необходимых для выравнивания последовательностей
+#####################################################################
+
+
+
+
+"""
+Usage:
+
+seq_in=[]
+seq_in.append("SSNAKIDQLSSDAQTANAKADQASNDANAARSDAQAAKDDAARANQRLDNM")
+seq_in.append("NAKADQASSDAQTANAKADQASNDANAARSDAQAAKDDAARANQRADNAA")
+l=AlignmentSeq(seq_in)
+for t in l.new_sequences:
+ print t
+
+"""
+
+
+
+
+import AlignmentSeq_config
+
+vars().update(vars(AlignmentSeq_config))
+
+class AlignmentSeq:
+
+
+
+
+
+
+
+ def __init__(self,sequences):
+
+ """
+ главная функция класса
+ принимает любое число последовательностей
+ выравнивает их, причем выравненные последовательности помещаются в список new_sequences
+ словари { [новый номер атома] => старый номер атома } помещаются в список connections
+
+ self.common - список [позиция] => [список букв, список номеров цепей]
+ """
+
+
+ self.old_sequences = []
+ self.new_sequences = []
+ self.connections = []
+
+ for seq in sequences:
+ self.old_sequences.append(seq.upper().replace('-','').replace(' ',''))
+
+
+ self.common=[]
+
+
+ for i in xrange(0,len(self.old_sequences)):
+ self.unite(i)
+
+
+ for i in xrange(0,len(self.old_sequences)):
+ self.lining(i)
+##
+## return
+##
+## self.correct()
+##
+##
+##
+##
+## for str1 in self.new_sequences:
+## self.connections.append(self.recount(str1))
+
+
+
+
+
+
+
+ def cost(self,a1,a2):
+
+ """
+ функция принимает две аминокислоты и возвращает цену
+ их выравнивания
+ """
+
+
+ global matrix
+ global gaps
+
+ a1=a1.upper()
+ a2=a2.upper()
+
+ if (matrix.has_key(a1)):
+ if (matrix[a1].has_key(a2)):
+ return matrix[a1][a2]
+
+ return gaps[0]
+
+
+
+
+
+
+
+
+
+
+ def gap_cost(self,int1):
+ """
+ функция принимает число существующих ГЭПОВ и
+ возвращает штраф, который возьмется при добавлении справа ГЭПА
+ """
+
+
+ global gaps
+
+
+ if (int1 >= len(gaps)):
+ return gaps[(len(gaps)-1)]
+ else:
+ return gaps[int1]
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ def unite(self,chainN):
+
+ """
+ Создание списка выравнивания
+
+ chainN - номер цепи
+ """
+
+
+ str1=self.old_sequences[chainN]
+ len1=len(str1)
+
+
+
+
+ if (not self.common):
+ i=0
+ while (i + aminoacids=[str1[i]]
+ chains=[chainN]
+
+ self.common.append([aminoacids,chains])
+ i+=1
+
+ return
+
+
+
+
+
+
+ len2=len(self.common)
+
+
+ d=[]
+ tip_from=[]
+ already_gaps=[]
+
+
+ for i in xrange(0,len1+1):
+ d.append([])
+ already_gaps.append([])
+ tip_from.append([])
+ for j in xrange(0,len2+1):
+ d[i].append(0)
+ already_gaps[i].append([0,0])
+ tip_from[i].append(0)
+
+
+##
+## for i in xrange(1,len1+1):
+## d[i][0] = 0
+## already_gaps[i][0] = [0,1+i]
+##
+##
+## for j in xrange(1,len2+1):
+## d[0][j] = 0
+## already_gaps[0][j] = [1+j,0]
+##
+
+
+
+
+
+
+ for i in xrange(1,len1+1):
+ for j in xrange(1,len2+1):
+
+ costs=[]
+ for A in self.common[j-1][0]:
+ costs.append(self.cost(str1[i-1],A))
+ cost = max(costs)
+
+
+ insertion = d[i-1][j]
+ if (j != len2): # неконцевой гэп
+ insertion += self.gap_cost(already_gaps[i-1][j][1])
+
+
+ deletion = d[i][j-1]
+ if (i != len1): # неконцевой гэп
+ deletion += self.gap_cost(already_gaps[i][j-1][0])
+
+ substitution=d[i-1][j-1] + cost
+
+ max_way= max(insertion,deletion,substitution)
+
+ d[i][j] = max_way
+
+
+
+
+
+ if (max_way==substitution):
+ tip=3
+ if (max_way==deletion):
+ tip=2
+ if (max_way==insertion):
+ tip=1
+
+
+
+ if (tip==1): # insertion
+ already_gaps[i][j]=[0, (already_gaps[i-1][j][1]+1) ]
+
+
+ if (tip==2): # deletion
+ already_gaps[i][j]=[ (already_gaps[i][j-1][0]+1), 0 ]
+
+ if (tip==3): # substitution
+ already_gaps[i][j]=[ 0, 0 ]
+
+ tip_from[i][j]=tip
+
+
+##
+## for d1 in d:
+## for d11 in d1:
+## print d11,
+## print
+##
+##
+##
+##
+## for d1 in tip_from:
+## for d11 in d1:
+## print d11,
+## print
+##
+##
+##
+## print insertion
+## print deletion
+## print substitution
+##
+##
+##
+## print already_gaps
+##
+
+
+
+ i=len1
+ j=len2
+
+ common=[]
+
+ while (i>0 or j>0):
+ tip=tip_from[i][j]
+
+ if tip==1 or (j==0 and i>0):
+
+ aminoacids=[(str1[i-1])]
+ chains=[chainN]
+
+ common.append([aminoacids,chains])
+
+ i-=1
+
+
+
+ if tip==2 or (i==0 and j>0):
+
+ common.append(self.common[j-1])
+ j-=1
+
+
+ if (tip==3):
+
+ chains=self.common[j-1][1]
+ chains.append(chainN)
+
+ aminoacids=self.common[j-1][0]
+
+ if (not aminoacids.count(str1[i-1])):
+ aminoacids.append(str1[i-1])
+
+ common.append([aminoacids,chains])
+
+ i-=1
+ j-=1
+
+
+
+ common.reverse()
+
+ self.common=common
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ def lining(self,chainN):
+
+
+ """
+ метод создает новую выровненную последовательность
+ в self.new_sequences
+
+ chainN - номер цепи
+ """
+
+ str1=self.old_sequences[chainN]
+ len1=len(str1)
+
+ len2=len(self.common)
+
+
+ new_seq=''
+ position_in_old=0
+
+ for common_1 in self.common:
+ if (common_1[1].count(chainN)):
+ new_seq = new_seq + str1[position_in_old]
+ position_in_old += 1
+ else:
+ new_seq = new_seq + '-'
+
+ self.new_sequences.append(new_seq)
+
+
+
+
+
+
+
+##
+## """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+## метод находит позиции в гтовом выраснивании, которые можно сдвинуть
+## """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+## def correct(self):
+##
+## new_sequences=[]
+##
+## all_l = len(self.new_sequences[0]) # наименьшая из длин последовательностей
+## for str1 in self.new_sequences:
+## all_l = min (all_l,len(str1))
+##
+##
+##
+## i=0
+## while (i < all_l):
+##
+## if (i==0):
+## for str1 in self.new_sequences:
+## new_sequences.append(str1[0])
+## i+=1
+## continue
+##
+##
+## all_gaps=1
+## for str1 in self.new_sequences:
+## if (str1[i]!='-'):
+## all_gaps=0
+##
+## if (all_gaps==1):
+## i+=1
+## continue
+##
+##
+## sovmest=1
+## j=-1
+## for str1 in self.new_sequences:
+## j+=1
+## if (str1[i]!='-' and new_sequences[j][-1]!='-'):
+## sovmest=0
+## break
+##
+##
+##
+##
+## j=-1
+## for str1 in self.new_sequences:
+## j+=1
+##
+## if (sovmest==1):
+## if (str1[i]!='-'):
+## new_sequences[j] = new_sequences[j][:-1] + str1[i]
+## else:
+## new_sequences[j] = new_sequences[j] + str1[i]
+##
+##
+##
+## i+=1
+## continue
+##
+## self.new_sequences = new_sequences
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+##
+## """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+## функция возвращает словарь: [новый номер атома] => старый номер атома
+## str1 - выравненная последовательность
+## нумерацию начинаем с 0!
+## """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+## def recount(self,str1):
+## spisok={}
+##
+## len1=len(str1)
+## old_nomer = 0
+##
+## for i in xrange(0,len1):
+## s=str1[i]
+## if (s != '-'):
+## spisok[i]=old_nomer
+## old_nomer+=1
+##
+## return spisok
+
+
+
+
+
+
+
+
+
+
diff -r 621fe8e2c1f7 -r 3161cdaf2ff9 blocks3d/AlignmentSeq_config.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/blocks3d/AlignmentSeq_config.py Fri Sep 17 21:52:33 2010 +0400
@@ -0,0 +1,28 @@
+matrix={
+"A": {"A": 4, "R": -1, "N": -2, "D": -2, "C": 0, "Q": -1, "E": -1, "G": 0, "H": -2, "I": -1, "L": -1, "K": -1, "M": -1, "F": -2, "P": -1, "S": 1, "T": 0, "W": -3, "Y": -2, "V": 0, "B": -2, "Z": -1, "X": 0, "*": -4},
+"R": {"A": -1, "R": 5, "N": 0, "D": -2, "C": -3, "Q": 1, "E": 0, "G": -2, "H": 0, "I": -3, "L": -2, "K": 2, "M": -1, "F": -3, "P": -2, "S": -1, "T": -1, "W": -3, "Y": -2, "V": -3, "B": -1, "Z": 0, "X": -1, "*": -4},
+"N": {"A": -2, "R": 0, "N": 6, "D": 1, "C": -3, "Q": 0, "E": 0, "G": 0, "H": 1, "I": -3, "L": -3, "K": 0, "M": -2, "F": -3, "P": -2, "S": 1, "T": 0, "W": -4, "Y": -2, "V": -3, "B": 3, "Z": 0, "X": -1, "*": -4},
+"D": {"A": -2, "R": -2, "N": 1, "D": 6, "C": -3, "Q": 0, "E": 2, "G": -1, "H": -1, "I": -3, "L": -4, "K": -1, "M": -3, "F": -3, "P": -1, "S": 0, "T": -1, "W": -4, "Y": -3, "V": -3, "B": 4, "Z": 1, "X": -1, "*": -4},
+"C": {"A": 0, "R": -3, "N": -3, "D": -3, "C": 9, "Q": -3, "E": -4, "G": -3, "H": -3, "I": -1, "L": -1, "K": -3, "M": -1, "F": -2, "P": -3, "S": -1, "T": -1, "W": -2, "Y": -2, "V": -1, "B": -3, "Z": -3, "X": -2, "*": -4},
+"Q": {"A": -1, "R": 1, "N": 0, "D": 0, "C": -3, "Q": 5, "E": 2, "G": -2, "H": 0, "I": -3, "L": -2, "K": 1, "M": 0, "F": -3, "P": -1, "S": 0, "T": -1, "W": -2, "Y": -1, "V": -2, "B": 0, "Z": 3, "X": -1, "*": -4},
+"E": {"A": -1, "R": 0, "N": 0, "D": 2, "C": -4, "Q": 2, "E": 5, "G": -2, "H": 0, "I": -3, "L": -3, "K": 1, "M": -2, "F": -3, "P": -1, "S": 0, "T": -1, "W": -3, "Y": -2, "V": -2, "B": 1, "Z": 4, "X": -1, "*": -4},
+"G": {"A": 0, "R": -2, "N": 0, "D": -1, "C": -3, "Q": -2, "E": -2, "G": 6, "H": -2, "I": -4, "L": -4, "K": -2, "M": -3, "F": -3, "P": -2, "S": 0, "T": -2, "W": -2, "Y": -3, "V": -3, "B": -1, "Z": -2, "X": -1, "*": -4},
+"H": {"A": -2, "R": 0, "N": 1, "D": -1, "C": -3, "Q": 0, "E": 0, "G": -2, "H": 8, "I": -3, "L": -3, "K": -1, "M": -2, "F": -1, "P": -2, "S": -1, "T": -2, "W": -2, "Y": 2, "V": -3, "B": 0, "Z": 0, "X": -1, "*": -4},
+"I": {"A": -1, "R": -3, "N": -3, "D": -3, "C": -1, "Q": -3, "E": -3, "G": -4, "H": -3, "I": 4, "L": 2, "K": -3, "M": 1, "F": 0, "P": -3, "S": -2, "T": -1, "W": -3, "Y": -1, "V": 3, "B": -3, "Z": -3, "X": -1, "*": -4},
+"L": {"A": -1, "R": -2, "N": -3, "D": -4, "C": -1, "Q": -2, "E": -3, "G": -4, "H": -3, "I": 2, "L": 4, "K": -2, "M": 2, "F": 0, "P": -3, "S": -2, "T": -1, "W": -2, "Y": -1, "V": 1, "B": -4, "Z": -3, "X": -1, "*": -4},
+"K": {"A": -1, "R": 2, "N": 0, "D": -1, "C": -3, "Q": 1, "E": 1, "G": -2, "H": -1, "I": -3, "L": -2, "K": 5, "M": -1, "F": -3, "P": -1, "S": 0, "T": -1, "W": -3, "Y": -2, "V": -2, "B": 0, "Z": 1, "X": -1, "*": -4},
+"M": {"A": -1, "R": -1, "N": -2, "D": -3, "C": -1, "Q": 0, "E": -2, "G": -3, "H": -2, "I": 1, "L": 2, "K": -1, "M": 5, "F": 0, "P": -2, "S": -1, "T": -1, "W": -1, "Y": -1, "V": 1, "B": -3, "Z": -1, "X": -1, "*": -4},
+"F": {"A": -2, "R": -3, "N": -3, "D": -3, "C": -2, "Q": -3, "E": -3, "G": -3, "H": -1, "I": 0, "L": 0, "K": -3, "M": 0, "F": 6, "P": -4, "S": -2, "T": -2, "W": 1, "Y": 3, "V": -1, "B": -3, "Z": -3, "X": -1, "*": -4},
+"P": {"A": -1, "R": -2, "N": -2, "D": -1, "C": -3, "Q": -1, "E": -1, "G": -2, "H": -2, "I": -3, "L": -3, "K": -1, "M": -2, "F": -4, "P": 7, "S": -1, "T": -1, "W": -4, "Y": -3, "V": -2, "B": -2, "Z": -1, "X": -2, "*": -4},
+"S": {"A": 1, "R": -1, "N": 1, "D": 0, "C": -1, "Q": 0, "E": 0, "G": 0, "H": -1, "I": -2, "L": -2, "K": 0, "M": -1, "F": -2, "P": -1, "S": 4, "T": 1, "W": -3, "Y": -2, "V": -2, "B": 0, "Z": 0, "X": 0, "*": -4},
+"T": {"A": 0, "R": -1, "N": 0, "D": -1, "C": -1, "Q": -1, "E": -1, "G": -2, "H": -2, "I": -1, "L": -1, "K": -1, "M": -1, "F": -2, "P": -1, "S": 1, "T": 5, "W": -2, "Y": -2, "V": 0, "B": -1, "Z": -1, "X": 0, "*": -4},
+"W": {"A": -3, "R": -3, "N": -4, "D": -4, "C": -2, "Q": -2, "E": -3, "G": -2, "H": -2, "I": -3, "L": -2, "K": -3, "M": -1, "F": 1, "P": -4, "S": -3, "T": -2, "W": 11, "Y": 2, "V": -3, "B": -4, "Z": -3, "X": -2, "*": -4},
+"Y": {"A": -2, "R": -2, "N": -2, "D": -3, "C": -2, "Q": -1, "E": -2, "G": -3, "H": 2, "I": -1, "L": -1, "K": -2, "M": -1, "F": 3, "P": -3, "S": -2, "T": -2, "W": 2, "Y": 7, "V": -1, "B": -3, "Z": -2, "X": -1, "*": -4},
+"V": {"A": 0, "R": -3, "N": -3, "D": -3, "C": -1, "Q": -2, "E": -2, "G": -3, "H": -3, "I": 3, "L": 1, "K": -2, "M": 1, "F": -1, "P": -2, "S": -2, "T": 0, "W": -3, "Y": -1, "V": 4, "B": -3, "Z": -2, "X": -1, "*": -4},
+"B": {"A": -2, "R": -1, "N": 3, "D": 4, "C": -3, "Q": 0, "E": 1, "G": -1, "H": 0, "I": -3, "L": -4, "K": 0, "M": -3, "F": -3, "P": -2, "S": 0, "T": -1, "W": -4, "Y": -3, "V": -3, "B": 4, "Z": 0, "X": -1, "*": -4},
+"Z": {"A": -1, "R": 0, "N": 0, "D": 1, "C": -3, "Q": 3, "E": 4, "G": -2, "H": 0, "I": -3, "L": -3, "K": 1, "M": -1, "F": -3, "P": -1, "S": 0, "T": -1, "W": -3, "Y": -2, "V": -2, "B": 0, "Z": 4, "X": -1, "*": -4},
+"X": {"A": 0, "R": -1, "N": -1, "D": -1, "C": -2, "Q": -1, "E": -1, "G": -1, "H": -1, "I": -1, "L": -1, "K": -1, "M": -1, "F": -1, "P": -2, "S": 0, "T": 0, "W": -2, "Y": -1, "V": -1, "B": -1, "Z": -1, "X": -1, "*": -4},
+"*": {"A": -4, "R": -4, "N": -4, "D": -4, "C": -4, "Q": -4, "E": -4, "G": -4, "H": -4, "I": -4, "L": -4, "K": -4, "M": -4, "F": -4, "P": -4, "S": -4, "T": -4, "W": -4, "Y": -4, "V": -4, "B": -4, "Z": -4, "X": -4, "*": 1}
+}
+
+gaps = (-8, -4, -2, -1)
\ No newline at end of file
diff -r 621fe8e2c1f7 -r 3161cdaf2ff9 blocks3d/Blocks3D.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/blocks3d/Blocks3D.py Fri Sep 17 21:52:33 2010 +0400
@@ -0,0 +1,511 @@
+# -*- coding: cp1251 -*-
+
+
+##########################
+# Reliable blocks finding
+##########################
+
+
+import json
+
+
+import Blocks3D_config
+import GeometricalCore_config
+from Blocks3D_class import Blocks3D
+B3D = Blocks3D()
+
+
+
+import sys
+
+
+
+# determine html.htm path
+if hasattr(Blocks3D_config, 'html_file'):
+ html_file = Blocks3D_config.html_file
+
+else:
+
+ if sys.argv[0].replace('/', '') != sys.argv[0]:
+ delimiter = '/'
+ else:
+ delimiter = "\\"
+
+ path_parts = sys.argv[0].split(delimiter)
+ path_parts[-1] = 'html.htm'
+ html_file = delimiter.join(path_parts)
+
+
+
+
+
+
+
+
+
+import optparse
+import os
+
+
+from clon import clon # copy list
+
+
+
+
+# get options
+
+parser = optparse.OptionParser()
+
+
+parser.set_defaults(**vars(GeometricalCore_config))
+parser.set_defaults(**vars(Blocks3D_config))
+
+
+parser.add_option('-i', help='Input alignment file', dest='alignment_file')
+parser.add_option('-c', help='PDB names conformity file', dest='conformity_file')
+
+
+##parser.add_option('--out', help='Output file name (*)', dest='output_file')
+##parser.add_option('-f', help='Output file format (msf, fasta, list)', dest='output_format')
+
+#parser.add_option('-l', help='Output list file', dest='output_list_file')
+#parser.add_option('-f', help='Output fasta file', dest='output_fasta_file')
+#parser.add_option('-g', help='Output msf file', dest='output_msf_file')
+#parser.add_option('-p', help='Output pdb file (+spt script)', dest='output_pdb_file')
+
+parser.add_option('-H', help='Output html file', dest='output_html_file')
+
+
+
+parser.add_option('-d', help='Distance spreading [' + str(GeometricalCore_config.delta) + ']', dest='delta')
+
+parser.add_option('-m', help='Min block width [' + str(Blocks3D_config.min_width) + ']', dest='min_width')
+
+
+parser.add_option('-t', help='Bron-Kerbosh (couple cores) timeout [' + str(GeometricalCore_config.timeout) + '] (-1 - unlimited)', dest='timeout')
+
+
+parser.add_option('-T', help='Bron-Kerbosh (blocks) timeout [' + str(Blocks3D_config.timeout_2) + '] (-1 - unlimited)', dest='timeout_2')
+
+
+#parser.add_option('-n', help='Alternative core new atoms (%) [' + str(int(GeometricalCore_config.alternative_core_new_atoms * 100)) + ']', dest='new_atoms')
+
+#parser.add_option('-a', help='Cores count [' + str(GeometricalCore_config.alternative_cores_count) + '] (0 - all)', dest='cores_count')
+
+
+#parser.add_option('-x', help='Superposition core identifier (0 - main core)', dest='Super_core')
+
+
+
+parser.add_option('-u', help='PDB url [' + GeometricalCore_config.pdb_url + ']', dest='pdb_url')
+parser.add_option('-s', action='store_true', help='Do not save uploaded PDB')
+
+
+
+options, args = parser.parse_args()
+vars().update(vars(options))
+
+
+
+
+
+
+
+
+
+all_right = 1
+
+
+
+# check all options
+
+
+try:
+
+ delta = float(delta)
+
+ min_width = int(min_width)
+
+except:
+ all_right = 0
+ print "Error: bad option"
+
+
+
+if s:
+ save = 0
+else:
+ save = 1
+
+
+
+if timeout:
+ try:
+ timeout = int(timeout)
+ except:
+ all_right = 0
+ print "Error: bad timeout"
+
+
+
+if timeout_2:
+ try:
+ timeout_2 = int(timeout_2)
+ except:
+ all_right = 0
+ print "Error: bad timeout"
+
+
+
+#if not Super_core:
+# Super_core = 0
+
+#Super_core = int(Super_core)
+
+
+
+
+
+
+
+
+try:
+ if not os.path.exists(alignment_file):
+ all_right = 0
+ print "Error: can not find input file"
+except:
+ all_right = 0
+ print "Error: can not find input file"
+
+
+if not (output_html_file):
+ all_right = 0
+ print "Error: no output file"
+
+
+
+
+
+
+
+
+if conformity_file:
+ try:
+ if not os.path.exists(conformity_file):
+ all_right = 0
+ print "Error: can not find conformity file"
+ except:
+ all_right = all_right
+
+
+
+
+
+
+
+
+
+
+if not all_right:
+
+ print ' '
+
+ print 'Programm for find blocks of true alignment'
+
+ print ' '
+
+ parser.print_help()
+
+# print ' '
+# print '* - required options'
+
+# print ' '
+# print 'Protein identifiers should not contain ":" symbol'
+
+ exit()
+
+
+
+
+# determinate temp fasta file
+
+#n = 1
+
+#while 1:
+# GC_temp = 'GC_temp' + str(n) + '.tmp'
+# if not os.path.exists(GC_temp):
+# break
+# n += 1
+
+GC_temp = 'GC_temp'
+
+
+
+
+
+
+
+
+
+
+##is_fasta = 0
+##fasta_check = open(alignment_file).readlines()
+##
+##for fasta_line in fasta_check:
+## if len(fasta_line) == 0:
+## continue
+## if fasta_line[0] == '>':
+## is_fasta = 1
+##
+##
+##if is_fasta:
+##
+## open(GC_temp, 'w').write(''.join(fasta_check))
+##
+##
+##else:
+
+
+
+
+
+# try to determ is it fasta
+
+text = ''.join(open(alignment_file).readlines())
+
+#if text.count("\n>") >= 2:
+if text.count("\n>") >= 1:
+ # fasta
+
+ # write to temp file input fasta alignment
+ open(GC_temp, 'w').write(text)
+
+else:
+
+ # not fasta
+
+ # convert input file to fasta
+
+ try:
+ os.system('seqret ' + alignment_file + ' ' + GC_temp)
+ except:
+ print 'Error: can not convert input alignment file to fasta using emboss command seqret'
+ exit()
+
+
+
+
+
+
+if not os.path.exists(GC_temp):
+ print 'Error: can not convert input alignment file to fasta'
+ exit()
+
+
+
+
+
+
+
+
+
+
+# read fasta
+
+fasta = open(GC_temp).readlines()
+
+
+fasta_dict = {} # dict. index - fasta identifier. value - sequence without line breaks
+
+#fasta_order = [] # list of IDs, in order as in input file
+
+current_id = '' # current fasta identifier
+
+for fasta_string in fasta:
+
+ fasta_string = fasta_string.strip()
+
+ if not len(fasta_string):
+ continue
+
+ if fasta_string[0] == '>':
+ current_id = fasta_string[1:].split()[0]
+ #fasta_order.append(current_id)
+ fasta_dict[current_id] = ''
+ else:
+ if not current_id:
+ print 'Bad Fasta file: line "' + fasta_string + '"'
+ exit()
+ fasta_dict[current_id] += fasta_string.replace(' ', '')
+
+
+
+
+
+# read conformity file
+
+
+conformity_dict = {} # Key - fasta_id. Value - list [pdb_code, pdb_chain]
+
+
+if conformity_file:
+ conformity = open(conformity_file).readlines()
+
+ for conformity_string in conformity:
+
+ if len(conformity_string) < 8:
+ continue
+
+ conformity_list = conformity_string.split()
+
+ if len(conformity_list) != 2:
+ print 'Error: can not read line "' + conformity_string + '" in conformity file'
+ exit()
+
+ fasta_id = conformity_list[0]
+
+## if not fasta_dict.has_key(fasta_id):
+## print 'Error: unknown fasta identifier "' + fasta_id + '" in conformity file'
+## exit()
+
+
+ conformity_pdb = conformity_list[1]
+
+# if len(conformity_pdb) != 2:
+# print 'Error: can not read PDB code and chain "' + conformity_list[1] + '" in conformity file'
+# exit()
+
+# if len(conformity_pdb[0]) != 4 or len(conformity_pdb[1]) != 1:
+# print 'Error: can not read PDB code and chain "' + conformity_list[1] + '" in conformity file'
+# exit()
+
+
+ conformity_dict[fasta_id] = conformity_pdb
+
+
+
+
+# get PDB names and chains
+
+block = [] # block to give it to GeometricalCore_class
+
+# ID_user[ID] = ID, entered by user
+ID_user = {}
+
+
+for fasta_id, sequence in fasta_dict.items():
+
+ if conformity_dict.has_key(fasta_id):
+ fasta_id = conformity_dict[fasta_id]
+
+
+ pdb = B3D.from_ID(fasta_id)
+
+
+
+ if not pdb:
+ print 'Error: sequence identifier "' + fasta_id + '" in not valid'
+# exit()
+ continue
+
+ pdb_code, pdb_chain, model = pdb
+
+ block.append([pdb_code, pdb_chain, sequence, model])
+
+ # save ID, entered by user
+ ID = B3D.to_ID(pdb_code, pdb_chain, model)
+ ID_user[ID] = fasta_id
+
+
+if len(block) < 2:
+ print 'Error: there are not enough sequences (less than 2)'
+ exit()
+
+
+
+
+
+
+
+##############################################
+# run GeometricalCore_class to make core
+##############################################
+
+
+
+B3D.min_width = min_width
+B3D.timeout_2 = timeout_2
+
+B3D.delta = delta
+B3D.save = save
+B3D.min_size = min_width
+B3D.alternative_core_new_atoms = alternative_core_new_atoms
+B3D.alternative_cores_count = alternative_cores_count
+B3D.timeout = timeout
+B3D.pdb_url = pdb_url
+
+
+# blocks is object with result
+blocks = B3D.find_blocks(block)
+
+# remake IDs as user enter
+blocks_1 = []
+
+
+for block in blocks:
+
+ IDs_1 = []
+
+ for ID in block['IDs']:
+
+ IDs_1.append(ID_user[ID])
+
+ block['IDs'] = IDs_1
+
+ blocks_1.append(block)
+
+
+
+
+
+if output_html_file:
+ # produce HTML
+
+ t = ''
+
+
+ t += "blocks = json('" + json.dumps(blocks_1) + "');"
+ t += "fasta_dict = json('" + json.dumps(fasta_dict) + "');"
+
+# t += "try{blocks_init();}catch(e){}"
+
+
+
+ html = ''.join(open(html_file).readlines())
+
+ # insert out code instead of "self_js_text"
+ html = html.replace('self_js_text', t)
+
+
+ open(output_html_file, 'w').write(html)
+
+
+
+
+
+
+
+
+
+
+
+
+os.remove(GC_temp)
+
+print 'Task is complete'
+
+
+
+
+
+
diff -r 621fe8e2c1f7 -r 3161cdaf2ff9 blocks3d/Blocks3D_class.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/blocks3d/Blocks3D_class.py Fri Sep 17 21:52:33 2010 +0400
@@ -0,0 +1,751 @@
+# -*- coding: cp1251 -*-
+
+################################
+# Find blocks or true alignment
+################################
+
+
+"""
+
+"""
+
+
+
+#import json #temp
+
+
+
+import GeometricalCore_class # for find cores
+
+import Blocks3D_config # default class options
+
+GC = GeometricalCore_class.GeometricalCore
+
+from Kliki import Kliki
+
+
+from clon import clon # copy list
+
+
+class Blocks3D(GC):
+
+ """
+ Self data:
+
+
+
+ User parameters:
+
+
+ """
+
+
+
+
+
+ def __init__(self):
+
+ """
+ Create new copy of class
+ """
+
+ GC.__init__(self)
+
+ vars(self).update(vars(Blocks3D_config))
+
+
+
+
+
+
+ def find_blocks(self, alignment):
+ """
+ Find all blocks
+
+ Arguments:
+ alignment - list.
+ It's element - list like ["1jcc", "A", "SSNAKIDQLSSDAQ", None]
+ SSNAKIDQLSSDAQ - part of alignment block sequence
+ Last parameter - model or None
+
+
+ Result:
+ returns list of blocks
+
+ block is dict:
+ start: integer
+ end: integer
+ IDs: list of IDs
+ """
+
+# # list of IDs
+ IDs = []
+
+ for pdb_code, pdb_chain, seq_part, model in alignment:
+
+ ID = self.to_ID(pdb_code, pdb_chain, model)
+ IDs.append(ID)
+
+ self.IDs = IDs
+
+
+ # build couple cores:
+
+ # CORES =
+ # core is list of positions
+# CORES = []
+
+
+
+ # couple_core_parts[ID_1][ID_2] =
+ # part = {'core': core_number, 'start': start_posotion, 'end': end_position}
+ couple_core_parts = {}
+
+
+
+
+ for protein_1 in alignment:
+ pdb_code_1, pdb_chain_1, seq_part_1, model_1 = protein_1
+ ID_1 = self.to_ID(pdb_code_1, pdb_chain_1, model_1)
+
+ couple_core_parts[ID_1] = {}
+
+ for protein_2 in alignment:
+ pdb_code_2, pdb_chain_2, seq_part_2, model_2 = protein_2
+ ID_2 = self.to_ID(pdb_code_2, pdb_chain_2, model_2)
+
+ if ID_1 == ID_2:
+ break
+
+
+ cores = self.check_block([protein_1, protein_2])
+
+# print ' '
+
+# print cores
+
+
+ couple_core_parts[ID_1][ID_2] = []
+
+ all_cores = [] # list of positions of all cores
+
+ for core in cores:
+
+ parts = self.splice_to_continued(core, (ID_1, ID_2))
+
+ for part in parts:
+
+ if len(part) >= self.min_width:
+
+ all_cores.extend(clon(part))
+
+ all_cores = list(set(all_cores)) # unical elements
+
+ all_cores.sort()
+
+
+ parts = self.splice_to_continued(all_cores, (ID_1, ID_2))
+
+ for part in parts:
+
+ if len(part) < self.min_width:
+ continue
+
+ couple_core_parts[ID_1][ID_2].append(clon({
+ 'start': part[0], 'end': part[-1]}))
+
+ couple_core_parts[ID_2][ID_1] = couple_core_parts[ID_1][ID_2]
+
+# CORES.append(clon(core))
+
+
+
+# exit()
+
+ # list of elements of blocks graph
+ # element is (ID, pos)
+ graph_elements = []
+
+ # reverse dict to graph_elements
+ graph_elements_1 = {}
+
+
+ # graph[i][j] == 1, if these elements are connected, or i == j
+ # i and j are indexes from list "graph_elements"
+ graph = {}
+
+
+ # same as graph, but include lists of cores n
+# graph_cores = {}
+
+
+
+ # is_boundary[ID][pos] == 1, if pos is boundary of some part in ID
+ is_boundary = {}
+
+
+
+ for ID_1 in IDs:
+
+
+ # find boundaries
+ is_boundary[ID_1] = {}
+ for ID_2 in IDs:
+ if ID_2 == ID_1:
+ continue
+ for part in couple_core_parts[ID_1][ID_2]:
+ is_boundary[ID_1][part['start']] = 1
+ is_boundary[ID_1][part['end']] = 1
+
+
+
+
+ for ID_2 in IDs:
+
+ if ID_1 == ID_2:
+ break
+
+
+
+
+
+ for part in couple_core_parts[ID_1][ID_2]:
+
+ start = part['start']
+ end = part['end']
+
+ # elements of graph like (ID, pos)
+ elements = []
+
+ for pos in xrange(start, end + 1):
+
+ if not is_boundary[ID_1].has_key(pos) and not is_boundary[ID_2].has_key(pos):
+ continue
+
+ for ID in (ID_1, ID_2):
+ if not graph_elements_1.has_key((ID, pos)):
+ L = len(graph_elements)
+ graph_elements_1[(ID, pos)] = L
+ graph[L] = {}
+# graph_cores[L] = {}
+
+ graph_elements.append((ID, pos))
+
+
+ elements.append(graph_elements_1[(ID, pos)])
+
+
+ for element_1 in elements:
+ for element_2 in elements:
+ graph[element_1][element_2] = 1
+
+# # add information about cores
+# if not graph_cores[element_1].has_key(element_2):
+# graph_cores[element_1][element_2] = []
+# graph_cores[element_1][element_2].append(part['core'])
+
+
+
+ L = len(graph_elements)
+
+ for element_1 in xrange(0, L):
+ for element_2 in xrange(0, L):
+ if not graph[element_1].has_key(element_2):
+ graph[element_1][element_2] = 0
+
+
+
+ kliki_1 = Kliki(graph, min_size=0, timeout=self.timeout_2).kliki
+
+
+#
+#
+# # graf illustration
+# for i in graph.keys():
+# t = ''
+# for j in graph[i].keys():
+# if graph[i][j]:
+# t += '1'
+# else:
+# t += ' '
+# print t
+#
+#
+
+
+ alignment_len = len(alignment[0][2])
+
+
+
+ # occupied alignment elements
+ occupied = {}
+
+ for ID in IDs:
+
+ occupied[ID] = [0] * alignment_len
+
+ # 00000000
+ occupied_current0 = clon(occupied)
+
+
+
+
+
+
+
+# print graph
+
+# print kliki_1
+
+
+ rectangles = []
+
+ for klika in kliki_1:
+
+ if self.rectangles_type == 'out':
+
+ # transitivity
+
+ IDs_dict = {}
+ start = alignment_len
+ end = 0
+
+ for element in klika:
+
+ ID, pos = graph_elements[element]
+
+ IDs_dict[ID] = 1
+
+ start = min(start, pos)
+ end = max(end, pos)
+
+ IDs = IDs_dict.keys()
+
+
+ rectangles.append({'IDs': IDs, 'start': start, 'end': end})
+
+ else:
+
+ ID_start = {}
+ ID_end = {}
+
+ for element in klika:
+
+ ID, pos = graph_elements[element]
+
+
+ if not ID_start.has_key(ID):
+ ID_start[ID] = pos
+ ID_end[ID] = pos
+ else:
+ ID_start[ID] = min(ID_start[ID], pos)
+ ID_end[ID] = max(ID_end[ID], pos)
+
+
+ # empty table
+ occupied_current = clon(occupied_current0)
+
+
+
+ for ID, start in ID_start.items():
+ end = ID_end[ID]
+
+ for pos in xrange(start, end + 1):
+ occupied_current[ID][pos] = 1
+
+
+ rectangles.extend(self.splice_to_rect(occupied_current))
+
+
+
+ # sort by height and then by width
+
+ rectangles.sort(self.rectangles_compare)
+
+
+
+
+
+
+
+
+
+ rectangles_2 = []
+
+
+ for rectangle in rectangles:
+
+ # empty table
+ occupied_current = clon(occupied_current0)
+
+ for ID in rectangle['IDs']:
+
+ for pos in xrange(rectangle['start'], rectangle['end'] + 1):
+
+ if not occupied[ID][pos]:
+
+ occupied_current[ID][pos] = 1
+
+ rectangles_current = self.splice_to_rect(occupied_current)
+
+
+
+ rectangles_2.extend(rectangles_current)
+
+ for rectangle in rectangles_current:
+
+# if len(rectangle['IDs']) ==2 and rectangle['IDs'][1] == '1bw5_A_4':
+# print occupied_current, rectangles
+
+
+ for ID in rectangle['IDs']:
+ for pos in xrange(rectangle['start'], rectangle['end'] + 1):
+ occupied[ID][pos] = 1
+
+
+
+ rectangles = clon(rectangles_2)
+
+
+
+
+
+ # delete blocks, including 1 sequence
+
+ rectangles = filter(self.rectangle_filter, rectangles)
+
+
+ return rectangles
+
+
+
+#
+# # transitivity
+# def splice_to_outrect(self, occupied_current, occupied):
+# """
+# Splice multitude of alignment elements to rectangles
+#
+# Returns:
+# new occupied_current (out rectangle) \ occupied
+#
+# """
+#
+# width = len(occupied_current.values()[0])
+#
+# start = width # the most right position
+# end = 0 # the most left position
+#
+# IDs_dict = {}
+#
+# for ID, line in occupied_current.items():
+#
+# for pos, condition in enumerate(line):
+#
+# if condition:
+#
+# IDs_dict[ID] = 1
+# start = min(start, pos)
+# end = max(end, pos)
+#
+# IDs = IDs_dict.keys()
+#
+#
+#
+# occupied_current_1 = {}
+#
+#
+#
+# for ID in IDs:
+#
+# occupied_current_1[ID] = [0] * width
+#
+# for pos in xrange(start, end + 1):
+#
+# if not occupied[ID][pos]:
+#
+# occupied_current_1[ID][pos] = 1
+#
+# return occupied_current_1
+#
+#
+
+
+ def rectangles_compare(self, x, y):
+
+ height_x = len(x['IDs'])
+ height_y = len(y['IDs'])
+
+ if height_x > height_y:
+ return -1
+ if height_x < height_y:
+ return 1
+
+ # same heights
+
+ width_x = x['end'] - x['start'] + 1
+ width_y = y['end'] - y['start'] + 1
+
+ if width_x > width_y:
+ return -1
+ if width_x < width_y:
+ return 1
+
+ return 0
+
+
+
+
+ def rectangle_filter(self, rectangle):
+
+ height = len(rectangle['IDs'])
+
+ width = rectangle['end'] - rectangle['start'] + 1
+
+ if height >= 2 and width >= self.min_width:
+ return True
+ else:
+ return False
+
+
+
+
+ def splice_to_rect(self, occupied_current):
+ """
+ Splice multitude of alignment elements to rectangles
+
+ Returns list of rectangles:
+ rectangle is dict:
+ 'start'
+ 'end'
+ 'IDs' - list
+
+ """
+
+# occupied_current_1 = splice_to_outrect(occupied_current, occupied)
+
+ occupied_current_1 = clon(occupied_current)
+
+ width = len(occupied_current_1.values()[0])
+
+
+ rectangles = []
+
+ rectangles_count = 0
+
+
+ while 1:
+
+ excluded_IDs = {}
+
+ while 1:
+
+ IDs_occupied = {} # is ID occupied
+
+ height = {} # this position height
+
+ for pos in xrange(0, width):
+
+ height[pos] = 0
+
+ for ID, e in occupied_current_1.items():
+
+ if excluded_IDs.has_key(ID):
+ continue
+
+ if e[pos]:
+ height[pos] += 1
+
+ IDs_occupied[ID] = 1
+
+
+ max_height = len(IDs_occupied.keys())
+
+
+ if max_height <= 1:
+ break
+
+
+
+ max_height_positions = []
+
+ for pos in xrange(0, width):
+ if height[pos] == max_height:
+ max_height_positions.append(pos)
+
+
+ parts = self.splice_to_continued(max_height_positions, IDs_occupied.keys())
+
+
+ ok = 0
+
+ for part in parts:
+
+ if len(part) >= self.min_width:
+
+ # It is block!
+
+ IDs = IDs_occupied.keys()
+ start = part[0]
+ end = part[-1]
+
+
+ rectangles.append(clon({'IDs': IDs, 'start': start, 'end': end, 'cores':[]}))
+
+
+ # exclude elements
+
+ for ID in IDs:
+ for pos in xrange(start, end + 1):
+ occupied_current_1[ID][pos] = 0
+
+
+
+ ok = 1
+
+ if ok:
+ continue
+
+
+
+
+ # find the shortest sequence
+
+
+ max_width_dict = {}
+
+ for ID, e in occupied_current_1.items():
+
+ if excluded_IDs.has_key(ID):
+ continue
+
+ positions = []
+
+ for pos in xrange(0, width):
+
+ if height[pos] <= 1:
+ # "bad" position
+ continue
+
+ if e[pos]:
+ positions.append(pos)
+
+ if len(positions) == 0:
+ continue
+
+ parts = self.splice_to_continued(positions, [ID])
+
+ max_part_len = 0
+
+ for part in parts:
+ max_part_len = max(len(part), max_part_len)
+
+ max_width_dict[ID] = max_part_len
+
+
+ if len(max_width_dict.values()):
+ min_width = min(max_width_dict.values())
+ else:
+ break
+
+ # exclude these sequences
+
+ for ID, e in occupied_current_1.items():
+
+ if max_width_dict.has_key(ID):
+ #if max_width_dict[ID] == min_width:
+ if max_width_dict[ID] <= min_width:
+
+ excluded_IDs[ID] = 1
+
+# for pos in xrange(0, width):
+# occupied_current_1[ID][pos] = 0
+
+
+# print rectangles_count
+
+ if len(rectangles) == rectangles_count:
+ break
+
+ rectangles_count = len(rectangles)
+
+# print rectangles_count
+
+
+ return rectangles
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ def splice_to_continued(self, LIST, IDs):
+ """
+ LIST is a list of positions of alignment
+
+ returns list of continued lists, constituted source LIST
+ """
+
+ LIST.sort()
+
+
+ # list of continuing parts of this core
+ parts = [[]]
+
+ for pos in LIST:
+
+ if len(parts[-1]):
+
+ if pos - parts[-1][-1] == 1:
+
+ parts[-1].append(pos)
+
+ else:
+
+ # check omited sequence
+
+ gappes = 1 # all omited sequence is gaps
+
+ for x in xrange(parts[-1][-1] + 1, pos):
+
+ for ID in IDs:
+ if self.structure1[ID][x]:
+ gappes = 0
+ break
+
+ if gappes == 0:
+ break
+
+ if not gappes:
+
+ # There are not only gapes
+ parts.append([pos])
+
+ else:
+ # first element
+
+ parts[-1].append(pos)
+
+
+ return clon(parts)
+
+
+
diff -r 621fe8e2c1f7 -r 3161cdaf2ff9 blocks3d/Blocks3D_config.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/blocks3d/Blocks3D_config.py Fri Sep 17 21:52:33 2010 +0400
@@ -0,0 +1,20 @@
+# -*- coding: cp1251 -*-
+
+#################
+# CLASS VARS
+#################
+
+import sys
+
+
+min_width = 3
+
+timeout_2 = 10
+
+
+# in this file should be HTM text. string "self_js_text" will be replaced to variable code
+# html_file = "../../html.htm"
+
+
+rectangles_type = 'out'
+
diff -r 621fe8e2c1f7 -r 3161cdaf2ff9 blocks3d/GeometricalCore_class.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/blocks3d/GeometricalCore_class.py Fri Sep 17 21:52:33 2010 +0400
@@ -0,0 +1,1008 @@
+# -*- coding: cp1251 -*-
+
+##############################################
+# Geometrical core finding - alignment check
+##############################################
+
+
+"""
+Example:
+
+ import GeometricalCore_class
+
+ l = GeometricalCore_class.GeometricalCore()
+
+
+ print l.check_block([
+ ['1jcc', 'A', 'NAKIDQLSSDAQTANAKADQASNDANAARSDAQAAKDDAARANQRLDNM', None],
+ ['1jcd', 'A', 'NAKADQASSDAQTANAKADQASNDANAARSDAQAAKDDAARANQRADNA', None],
+ ])
+
+ print l.check_block([
+ ['1jcc', 'A', 'NAKIDQLSSDAQTANAKADQASNDANAARSDAQAAKDDAARANQRLDNM', None],
+ ['1jcd', 'A', 'NAKADQASSDAQTANAKADQASNDANAARSDAQAAKDDAARANQRADNA', None],
+ ])
+
+
+Run method check_block() for each alignment block
+
+Structures will be uploaded automatically.
+Programm takes them from folder /pdb (/pdb/1jcc.ent), if they are there
+
+In this example we control biological truth of alignment
+ NAKIDQLSSDAQTANAKADQASNDANAARSDAQAAKDDAARANQRLDNM
+ NAKADQASSDAQTANAKADQASNDANAARSDAQAAKDDAARANQRADNA
+
+We controled with delta 1 and 2 angstrom
+Delta is max allowed alterity between max and min distance between atoms
+
+We got list of core alignment positions (first is 0)
+
+"""
+
+
+
+
+
+
+import os # to control file existence
+
+import urllib2 # to upload PDB from Internet
+
+import re # regulas expression
+
+
+from Kliki import Kliki # algorithm to find core(s) from graph
+
+import AAdict # dict to convert 3-N code to 1-N
+import AlignmentSeq # sequense alignment class
+
+
+import GeometricalCore_config # default class options
+
+
+
+
+AAdict = AAdict.AAdict
+
+
+class GeometricalCore:
+
+ """
+ Self data:
+
+ self.structure
+ 3d Coordinates of CA atoms of each structure
+
+ Formation:
+ self.structure[structure name][atom identifier] = list [x,y,z]
+ where:
+ structure name - string like "1jcc:A"
+ atom identifier - number of residue i PDB file, first is 0
+ x,y,x - Coordinates of CA atoms in PDB
+
+
+ self.seq
+ sequences of each structures
+
+ Formation:
+ self.seq[structure name] = string like "SSNAKIDQLSSDAQ"
+ where: structure name - string like "1jcc:A"
+
+ self.structure1 - same as self.structure, but atom identifier is number in block
+
+ self.d - distances
+ self.d[ID][i][j] = distance between i and j atoms in structure ID
+
+
+
+
+
+ User parameters:
+
+ self.max_absent - max part of positions without PDB info in one structure
+
+ self.save - should programm save PDB to folder pbd/ (0 - do not save, 1 - save)
+
+ self.min_size - min size of each core
+
+ self.alternative_core_new_atoms - part of new atoms in alternative core
+
+ self.alternative_cores_count - max number of cores (including main core)
+
+ """
+
+
+
+
+
+ def __init__(self):
+
+ """
+ Create new copy of class
+
+ Creates self vars self.structure and self.seq
+ """
+
+ vars(self).update(vars(GeometricalCore_config))
+
+
+ self.structure = {}
+ self.structure1 = {}
+ self.d = {}
+
+
+ self.seq = {}
+ self.pdb_text = {} # there will be PDB texts in this dict. key - string like "1jcc"
+
+
+
+
+
+
+
+
+
+ def change_block_boundary(self):
+ """
+ If you use at first one boundaries (in positions) of block in some PDB file,
+ and then decide to change them, run this method before running check_block method
+ """
+
+ self.structure1 = {}
+ self.d = {}
+
+
+
+#
+#
+# def change_parameters(self, delta=None, save=None, min_size=None,
+# alternative_core_new_atoms=None,
+# alternative_cores_count=None, timeout=None):
+# """
+# Changes self parameters
+#
+# description of parameters - see class description
+# """
+#
+# if delta != None:
+# self.delta = delta
+#
+#
+# if save != None:
+# self.save = save
+#
+# if min_size != None:
+# self.min_size = min_size
+#
+# if alternative_core_new_atoms != None:
+# self.alternative_core_new_atoms = alternative_core_new_atoms
+#
+#
+# if alternative_cores_count != None:
+# self.alternative_cores_count = alternative_cores_count
+#
+# if timeout != None:
+# self.timeout = timeout
+#
+#
+#
+
+
+
+
+ def to_ID(self, pdb_code, pdb_chain, model):
+
+ """
+ Makes standart ID for structure from pdb_code, chain and model
+ """
+
+ ID = pdb_code + '_'
+
+ if pdb_chain:
+ ID = ID + pdb_chain.upper().strip()
+
+ if model:
+ ID = ID + '_' + model
+
+ return ID
+
+
+
+
+
+
+ def from_ID(self, ID):
+
+ """
+ Parse standart ID to pdb_code, chain and model
+ """
+
+
+ if not hasattr(self, 're1'):
+
+
+ # makes compiled regular expressions
+
+ # for pdb-codes
+ self.re1 = re.compile(r"(^|[^a-z0-9])([0-9][0-9a-z]{3})([^a-z0-9]([0-9a-z ]?)([^a-z0-9]([0-9]{1,3}))?)?($|[^a-z0-9])")
+
+ # for files
+ self.re2 = re.compile(r"(^)([^^]+\.(ent|pdb))([^a-zA-Z0-9]([0-9A-Za-z ]?)([^a-zA-Z0-9]([0-9]{1,3}))?)?$")
+
+
+ self.from_ID_dict = {}
+
+
+
+
+ if self.from_ID_dict.has_key(ID):
+ return self.from_ID_dict[ID]
+
+
+ if ID.lower().find('.ent') != -1 or ID.lower().find('.pdb') != -1:
+ # it is file
+ parseO = self.re2.search(ID) # files
+ else:
+ parseO = self.re1.search(ID.lower()) # pdb codes
+
+
+ if not parseO:
+ return None
+
+ parse = parseO.groups()
+
+
+ if len(parse) < 2:
+ return None
+
+
+ code = parse[1]
+
+# if not file:
+# code = code.lower()
+
+ chain = ''
+ model = None
+
+ if len(parse) >= 4:
+ chain = parse[3]
+
+ if chain:
+ chain = chain.upper()
+
+ if len(parse) >= 6:
+ if parse[5]:
+ model = parse[5]
+
+
+
+ self.from_ID_dict[ID] = (code, chain, model) # save parsing results
+
+ return code, chain, model
+
+
+
+
+
+
+ def check_block(self, block):
+ """
+ Outside opened method (from main programm)
+
+
+ Arguments:
+ block - list.
+ It's element - list like ["1jcc", "A", "SSNAKIDQLSSDAQ", None]
+ SSNAKIDQLSSDAQ - part of alignment block sequence
+ Last parameter - model or None
+
+
+ Result:
+ returns list of core atom identifiers (first is 0)
+
+ Example: [0,1,2,3,4,6]
+ """
+
+
+
+
+ # check lendth of input sequences
+ L0 = len(block[0][2])
+
+ for pdb_code, pdb_chain, seq_part, model in block:
+ if len(seq_part) != L0:
+ #print seq_part, block[0][2]
+ print 'Sequences must have equal lengths'
+ print 'Task was aborted!'
+ return
+
+
+
+
+
+
+
+ pdb_list = [] # list of uploading PDB names
+
+ for pdb_code, pdb_chain, seq_part, model in block:
+
+ ID = self.to_ID(pdb_code, pdb_chain, model)
+
+ if not self.seq.has_key(ID) or not self.structure.has_key(ID):
+
+# pdb_code = pdb_code.lower()
+
+ if pdb_chain:
+ pdb_chain = pdb_chain.upper()
+
+ pdb_list.append((pdb_code, pdb_chain, model))
+
+
+
+ if len(pdb_list) != 0:
+ self.load_pdb(pdb_list) # If it is required, get PDBs
+
+
+
+ for pdb_code, pdb_chain, seq_part, model in block:
+
+ ID = self.to_ID(pdb_code, pdb_chain, model)
+
+
+
+
+
+ if not self.seq.has_key(ID) or not self.structure.has_key(ID): # no structure :(
+ print 'Undefined structuce ' + ID
+ print 'Task was aborted!'
+ return
+
+ if not self.seq[ID] or not self.structure[ID]: # no structure :(
+ print 'Undefined structuce ' + ID
+ print 'Task was aborted!'
+ return
+
+
+
+
+
+
+# absent = {} # [position identifier] = 1, if some structure has not this atom
+
+# structure = {} # [structure name][position in block] = list [x,y,z]
+
+ IDs = []
+
+ for pdb_code, pdb_chain, seq_part, model in block:
+
+ ID = self.to_ID(pdb_code, pdb_chain, model)
+
+ IDs.append(ID)
+
+ if self.structure1.has_key(ID):
+ continue
+
+
+ # alignment part of sequence with full sequence
+ connections = self.find_sequence_piece(self.seq[ID], seq_part)
+
+
+ # add atoms coordinates
+
+ self.structure1[ID] = []
+
+
+
+ for i in xrange(0, len(connections)):
+ if connections[i] == '-': # there is not required position in PDB
+ self.structure1[ID].append(None)
+# absent[i] = 1
+ else:
+ self.structure1[ID].append(self.structure[ID][connections[i]])
+
+#
+#
+# # how many positions absent in some structures
+# if len(absent) / float(len(block[0][2])) > self.max_absent:
+# print 'There are too many positions without PDB structure,', len(absent), 'of', len(block[0][2])
+#
+#
+
+
+ # now we know coordinates of each atom of each structure
+
+
+
+ # calculate atom distances
+ self.make_d()
+
+
+ # make alignment graph
+ graf, cost = self.make_graf(IDs)
+
+## self.cost = cost
+
+
+ # find cores
+ cores = Kliki(graf, cost, min_size=self.min_size, timeout=self.timeout).kliki
+
+
+ # sort cores and return real alternative cores (with high difference)
+ cores = self.find_alternative_cores(cores)
+
+
+#
+# # save CA atom coordinates
+# self.structure1 = structure
+#
+
+ return cores
+
+
+
+
+
+
+
+
+ def load_pdb(self, pdb_list):
+
+ """
+ This method is runned to get PDB files and reading them structures
+
+ Argument:
+ pdb_list - list of lists [pdb_code, chain]
+
+ Result:
+ Adds structure data to self vars self.structure and self.seq
+ """
+
+
+
+
+
+ codes = [] # list of PDB codes
+
+ # get texts of each PDB
+
+ for pdb_code, pdb_chain, model in pdb_list:
+ if not codes.count(pdb_code):
+ codes.append(pdb_code)
+
+
+ for pdb_code in codes:
+
+
+ # check PDB file existance in folder ./pdb/
+
+ fname = 'pdb/' + pdb_code
+
+ if pdb_code.lower().find('.ent') == -1 and pdb_code.lower().find('.pdb') == -1:
+ # pdb code
+ fname += '.ent'
+
+
+ if os.path.exists(fname):
+ self.pdb_text[pdb_code] = open(fname).readlines()
+ else:
+ # try to upload from Internet
+ try:
+
+ url = self.pdb_url.replace('XXXX', pdb_code)
+
+ self.pdb_text[pdb_code] = urllib2.urlopen(url).readlines()
+
+
+ except:
+ self.pdb_text[pdb_code] = ''
+
+
+ if self.save:
+ # save information
+
+ try:
+
+
+ # check folder "/pdb" existance
+
+ if not os.path.exists('pdb'):
+
+ # make folder
+ os.mkdir('pdb');
+
+
+ pdbfile_to_save = open('pdb/' + pdb_code + '.ent', 'w')
+ pdbfile_to_save.write(''.join(self.pdb_text[pdb_code]))
+ pdbfile_to_save.close()
+
+ print 'PDB structure saved to file pdb/' + pdb_code + '.ent'
+
+ except:
+
+ print 'Can not write file pdb/' + pdb_code + '.ent'
+
+
+ if not self.pdb_text[pdb_code]:
+ #print self.pdb_url.replace('XXXX', pdb_code)
+ print 'Can not get text of PDB', pdb_code
+ return
+
+
+ # We have all PDB texts
+
+
+ # read all texts and get CA atoms coordinates
+
+ for pdb_code, pdb_chain, model in pdb_list:
+
+ ID = self.to_ID(pdb_code, pdb_chain, model)
+
+ S = self.read_pdb(pdb_code, pdb_chain, self.pdb_text[pdb_code], model)
+ self.structure[ID], self.seq[ID] = S
+
+
+ if not self.seq[ID]:
+ print 'Can not find sequence for "' + ID + '"'
+ return
+
+
+
+
+
+
+ def read_pdb(self, pdb_code, pdb_chain, pdb_text, model):
+ """
+ Reads pdb_text
+
+ Returns (structure, sequence)
+ structure (key - string like "1jcc:A")
+ This element is dict with [x,y,z] coordinates of each aa
+ sequence
+ """
+
+
+
+ structure = [] # dict with coordinates list
+ seq = '' # sequense (string)
+
+
+ Model_already = 0 # is it our model now
+
+ if not model:
+ Model_already = 1
+
+
+
+
+
+ for currentline in pdb_text:
+
+
+ if not Model_already:
+ if currentline[0:5] == 'MODEL':
+ if currentline[10:14].strip() == model:
+ Model_already = 1
+ continue
+
+ continue
+
+
+
+ if currentline[0:6] == 'ENDMDL':
+ break
+
+
+ if len(currentline) < 54:
+ continue
+
+
+
+ if currentline[0:4] != "ATOM":
+ continue
+
+
+ atomType = currentline[12:16].strip()
+
+ if atomType != "CA":
+ continue
+
+
+ thisChain = currentline[21].strip()
+
+ if thisChain != pdb_chain:
+ continue
+
+
+ alterCode = currentline[16] # Alter code
+
+ if alterCode != ' ' and alterCode != 'A':
+ continue
+
+
+ thisAminoAcid = currentline[17:20].strip()
+
+
+ thisX = float(currentline[30:38].strip())
+ thisY = float(currentline[38:46].strip())
+ thisZ = float(currentline[46:54].strip())
+
+
+ # add atom coornates
+ structure.append((thisX,thisY,thisZ))
+
+
+ # prolong sequense
+ if (AAdict.has_key(thisAminoAcid)):
+ seq = seq + AAdict[thisAminoAcid][0]
+ else:
+ seq = seq + 'x'
+
+ return (structure, seq)
+
+
+
+
+
+
+###
+###
+###
+### def add_pdb(self, pdb_code, pdb_chain, pdb_text, model):
+###
+### """
+### Method read PDB and get coordinates of CA atoms
+###
+### Arguments:
+### pdb_code - PDB name, for example "1jcc"
+### pdb_chain - chain, for example "A"
+### pdb_text - PDB file strings
+###
+###
+### Result:
+### New element will be added in dict self.structure (key - string like "1jcc:A")
+### This element is dict with [x,y,z] coordinates of each aa
+###
+### """
+###
+### ID = self.to_ID(pdb_code, pdb_chain, model)
+###
+### self.structure[ID], self.seq[ID] = read_pdb(pdb_code, pdb_chain, pdb_text, model)
+###
+###
+###
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ def find_sequence_piece (self, seq_all, seq_part):
+ """
+ Method for search subsequence in sequnce
+
+ Arguments:
+ seq_all - full sequence (from PDB)
+ seq_part - subsequence (from alignment block), can contain gapes
+
+ Result:
+ retuns list with conformity list
+ key - subsequence position (in seq_part)
+ value - full sequence position (in seq_all)
+
+ First is 0
+
+ If no position from PDB meets subsequence position,
+ value is '-', programm makes warning
+
+ """
+ seq_alignment = AlignmentSeq.AlignmentSeq([seq_part, seq_all]).new_sequences
+
+## print seq_alignment[0]
+## print seq_alignment[1]
+
+
+ # At first, calculate conformity without gapes
+
+ connections0 = [] # key - seq_part position, value - position in seq_part without gapes
+ part_usage = 0 # how many aa from seqpart were used
+
+ for i in xrange(0, len(seq_part)):
+ s = seq_part[i]
+ if s == '-':
+ connections0.append('-')
+ else:
+ connections0.append(part_usage)
+ part_usage += 1
+
+
+
+
+
+
+
+
+
+
+ connections1 = []
+
+ all_usage = 0 # how many aa from full sequence were used
+
+ for i in xrange(0, len(seq_alignment[0])):
+ AA_part = seq_alignment[0][i]
+ AA_all = seq_alignment[1][i]
+
+ if AA_all != '-':
+ all_usage += 1
+
+ if AA_part == '-':
+ continue
+
+ if AA_all == '-':
+ connections1.append('-')
+# print 'Can not find', AA_part, len(connections1), 'of', seq_part, 'in', seq_all
+ continue
+
+
+ connections1.append(all_usage - 1)
+
+
+
+ connections = []
+
+
+ for i in connections0:
+ if i == '-':
+ connections.append('-')
+ else:
+ connections.append(connections1[i])
+
+ return connections
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ def make_d(self):
+
+ """
+ Calculates distances
+
+ adds new elements to self.d
+ """
+
+
+ # Atom count
+ aton_count = len(self.structure1.values()[0])
+
+ for ID, structure in self.structure1.items():
+
+ if self.d.has_key(ID):
+ continue # already done
+
+ self.d[ID] = []
+
+
+ # create distance matrix
+ for atom1 in xrange(0, aton_count):
+ self.d[ID].append([])
+ for atom2 in xrange(0, aton_count):
+ self.d[ID][atom1].append(None)
+
+
+ # done distance matrix
+
+ for atom1 in xrange(0, aton_count):
+ for atom2 in xrange(0, aton_count):
+
+ if atom2 == atom1:
+ break
+
+ if structure[atom1] and structure[atom2]:
+
+ dist = 0
+
+ for xyz in xrange(0, 3):
+
+ dist += (structure[atom1][xyz] - structure[atom2][xyz]) ** 2
+
+ dist = dist ** 0.5
+
+ self.d[ID][atom1][atom2] = dist
+ self.d[ID][atom2][atom1] = dist
+
+
+
+
+
+
+
+
+
+
+ def make_graf(self, IDs):
+
+ """
+ Make alignment core graph
+
+ Arguments:
+ IDs - list of IDs to study
+
+
+ Result:
+ returns [alignment core graph, cost graf]
+
+
+ alignment core graph example:
+ graf[0][1] = 1 0 and 1 positions are connected
+ graf[0][1] = 0 0 and 1 positions are not connected
+ """
+
+ # Atom count
+ aton_count = len(self.structure1.values()[0])
+
+
+ graf = {}
+
+ cost = {} # distance spreading
+
+
+
+
+
+ for atom1 in xrange(0, aton_count):
+
+
+ graf[atom1] = {}
+
+ cost[atom1] = {}
+
+ for atom2 in xrange(0, aton_count):
+
+
+ if atom1 == atom2:
+ graf[atom1][atom2] = 1
+ break
+
+
+ distances = []
+
+ for ID in IDs:
+ distances.append(self.d[ID][atom1][atom2])
+
+
+ if distances.count(None):
+ graf[atom1][atom2] = 0
+ graf[atom2][atom1] = 0
+
+ else:
+
+ spreading = max(distances) - min(distances)
+
+ if spreading > self.delta:
+
+ graf[atom1][atom2] = 0
+ graf[atom2][atom1] = 0
+
+ else:
+ graf[atom1][atom2] = 1
+ graf[atom2][atom1] = 1
+
+ cost[atom1][atom2] = -spreading
+ cost[atom2][atom1] = -spreading
+
+
+
+ return [graf, cost]
+
+
+
+
+
+
+
+ def find_alternative_cores(self, cores):
+ """
+ gather different cores and returns it
+
+ Arguments:
+ cores - list of lists of core atoms
+
+ Result:
+ returns list with real different cores
+ """
+
+ new_cores = [] # list with added cores
+
+ for core in cores:
+
+ if self.alternative_cores_count:
+ if len(new_cores) >= self.alternative_cores_count:
+ break # there are enough cores :)
+
+
+
+
+ ok = 1
+
+ if self.alternative_core_new_atoms:
+
+ # compare this core with all added cores
+
+ for one_core in new_cores:
+ new_atoms = 0
+
+ for atom in core:
+ if one_core.count(atom) == 0:
+ new_atoms += 1
+
+ if new_atoms / float(len(core)) < self.alternative_core_new_atoms:
+ ok = 0
+ break
+
+
+ # if this core is good
+ if ok == 1:
+ new_cores.append(core)
+
+
+
+ return new_cores
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff -r 621fe8e2c1f7 -r 3161cdaf2ff9 blocks3d/GeometricalCore_config.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/blocks3d/GeometricalCore_config.py Fri Sep 17 21:52:33 2010 +0400
@@ -0,0 +1,52 @@
+# -*- coding: cp1251 -*-
+
+#################
+# CLASS VARS
+#################
+
+
+# дельта - максимальный разброс расстояний в ангстремах
+delta = 2.0
+
+
+
+# сохранять загруженные из Интеренета файлы в папке pdb/
+save = 1
+
+
+
+# min size of returning cores
+min_size = 20
+
+
+
+# min part or new atoms in new alternative core
+alternative_core_new_atoms = 0.5
+
+
+# max number of cores (including main core)
+alternative_cores_count = 5
+
+
+
+# максимальная позволенная доля позиция блока, не найденных хотя бы в одном из файлов PDB
+# !!! can be changed only in this file !!!
+max_absent = 0.15
+
+
+# pdb download url (XXXX is pdb code place)
+pdb_url = 'http://www.pdb.org/pdb/files/XXXX.pdb'
+
+# time in sec. for BRON-KERBOSH algorithm
+timeout = 10
+
+
+#####################
+# PROGRAMM VARS
+#####################
+
+
+# output file format (msf, fasta, list)
+# output_format = 'msf'
+
+
diff -r 621fe8e2c1f7 -r 3161cdaf2ff9 blocks3d/Kliki.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/blocks3d/Kliki.py Fri Sep 17 21:52:33 2010 +0400
@@ -0,0 +1,567 @@
+# -*- coding: cp1251 -*-
+
+#########################################################################
+# Алгоритм Брона-Кербоша: поиск максимального подграфа/подграфов
+#########################################################################
+
+
+
+
+"""
+возвращает клики в порядке уменьшения числа элементов в них
+
+Usage:
+
+from Kliki import Kliki
+l = Kliki(graf)
+l.kliki # тут будут клики
+"""
+
+
+import time
+from clon import clon
+
+
+
+class Kliki:
+
+
+
+ """
+ graf[вершина1][вершина2] = 1 - есть связь, 0 - нет связи
+
+ kliki - список клик, клика - список номеров элементов, входящих в полный подграф
+
+ compsub - полный подграф для данного шага
+ """
+
+
+
+
+
+
+
+
+ def __init__ (self, graf, cost = None, limit_count=0, min_size=0, timeout=10):
+
+ """
+ главная функция класса
+
+ graf - словарь словарей.
+ Если graf[1][2] == 1, то 1 соединен с 2
+ Если graf[1][2] == 0, то 1 не соединен с 2
+
+ graf[N][N] = 1 для всех N
+
+ cost - устроен аналогично graf (необязательный)
+ хранит цены связей между элементами.
+ чем больше цена, тем выше ценится эта связь
+ используется для fast_algorithm и для сортировки клик
+
+
+ limit_count - максимальное число клик, которые хотят
+ Если задать 0, то возвратятся все клики
+
+ min_size - min size of returning klika
+
+ timeout - time in sec. for BRON-KERBOSH algorithm
+
+ """
+
+
+
+ self.graf = graf
+ self.cost = cost
+
+
+ self.kliki = []
+
+ self.timeout = timeout
+
+
+
+ connections = {} # index - atom, value - count of connections
+
+ for atom in self.graf.keys():
+ connections[atom] = self.graf[atom].values().count(1)
+
+
+
+
+
+ # delete atoms which have not enough number of connections
+ deleted = 1
+
+ while deleted:
+
+ deleted = 0
+
+ for atom, c in connections.items():
+
+ if c < min_size:
+
+ del connections[atom]
+
+ for atom1, connect in graf[atom].items():
+ if connect == 1 and connections.has_key(atom1):
+ connections[atom1] -= 1
+ deleted = 1
+
+
+
+
+
+ bank_l = {}
+
+ for atom, c in connections.items():
+
+ if not bank_l.has_key(c):
+ bank_l[c] = []
+
+ bank_l[c].append(atom)
+
+
+ keys = []
+
+ if len(bank_l.keys()):
+ for c in xrange(min(bank_l.keys()), max(bank_l.keys())+1):
+ if bank_l.has_key(c):
+ keys.extend(bank_l[c])
+
+
+
+
+ # RUN BRON-KERBOSH
+
+ if self.timeout != 0:
+
+ self.bron_kerbosh(keys[:])
+
+ if len(self.kliki) == 0:
+ self.fast_algorithm(keys[:]) # run fast algorithm
+
+
+
+
+
+ # упорядочим полученные клики по убыванию числа элементов в них
+
+
+
+
+
+## max_l=0 # максимальный размер
+## min_l=len(self.kliki[0]) # минимальный размер
+
+ bank_l = {}
+
+ for klika in self.kliki:
+ klika.sort()
+ l = len(klika) # длина текущей клики
+
+ if l >= min_size:
+## max_l = max(max_l,len(klika))
+## min_l = min(min_l,len(klika))
+
+ if not bank_l.has_key(l):
+ bank_l[l] = []
+
+ bank_l[l].append(klika)
+
+
+
+ kliki=[]
+
+ #print self.cost
+
+ if len(bank_l.keys()):
+
+ r = range(min(bank_l.keys()), max(bank_l.keys())+1)
+ r.reverse()
+
+ for l in r:
+ if (bank_l.has_key(l)):
+
+ k = bank_l[l] # все клики длины l
+
+
+ if self.cost:
+
+ ## print l
+
+ # отсортируем их по убыванию общей цены cost
+
+
+
+ costs = []
+
+ for klika in k:
+
+ c = 0
+
+ for i in klika:
+
+ if not self.cost.has_key(i):
+ continue
+
+ for j in klika:
+
+ if j == i:
+ break
+
+
+ if not self.cost[i].has_key(j):
+ continue
+
+ c += self.cost[i][j]
+
+ costs.append(c)
+
+ costs1 = costs[:]
+
+ costs1.sort(reverse=1)
+
+ k1 = []
+
+ for c in costs1:
+
+ n = costs.index(c)
+
+ k1.append(k[n][:])
+
+ del k[n]
+ del costs[n]
+
+ k = k1
+
+ kliki.extend(k)
+
+## kliki.reverse()
+
+ if limit_count:
+ if len(kliki) > limit_count: # наложим ограничение на число клик
+ kliki = kliki[:limit_count]
+
+
+ self.kliki = kliki[:]
+
+
+
+
+
+
+
+
+
+
+ def bron_kerbosh (self, keys):
+
+ """
+ алгоритм Брона-Кербоша поиска максимального полного подграфа
+ http://ru.wikipedia.org/wiki/Алгоритм_Брона_-_Кербоша
+
+ compsub - список атомов ядра
+ candidates - список нерассмотренных кандидатов в ядро
+ used - список рассмотренных кандидатов в ядро
+ """
+
+ depth = 0 # глубина "рекурсии"
+ list_candidates = [keys] # список значений candidates всех "рекурсий"
+ list_used = [[]] #список значений used всех "рекурсий"
+
+ compsub = [] # единый compsub
+
+
+ print 'Bron and Kerbosh algorithm started'
+
+ start_time = time.time()
+
+ # ПОКА...
+ while 1:
+
+ if depth == -1:
+ break # ВСЕ! Все рекурсии (итерации) пройдены
+
+
+
+
+
+ # создадим candidates и used из списка
+
+ #print depth
+
+ candidates = list_candidates[depth][:]
+ used = list_used[depth][:]
+
+
+
+
+ # ПОКА candidates НЕ пусто
+ if len(candidates)==0:
+ depth -= 1
+
+ if compsub:
+ compsub.pop()
+ continue
+
+
+
+
+
+
+ # И used НЕ содержит вершины, СОЕДИНЕННОЙ СО ВСЕМИ вершинами из candidates
+ # (все из used НЕ соединены хотя бы с 1 из candidates)
+
+ used_candidates = 0
+
+ for used1 in used:
+ for candidates1 in candidates:
+ if self.graf[used1][candidates1] == 0:
+ break
+ else:
+ used_candidates = 1
+
+ if used_candidates:
+ depth -= 1
+
+ if compsub:
+ compsub.pop()
+ continue
+
+
+
+
+
+
+
+ # Выбираем вершину v из candidates и добавляем ее в compsub
+ v = candidates[0]
+ compsub.append(v)
+
+
+
+
+
+ # Формируем new_candidates и new_used, удаляя из candidates и used вершины, НЕ соединенные с v
+ # (то есть, оставляя только соединенные с v)
+ new_candidates = []
+ for candidates1 in candidates:
+ if self.graf[candidates1][v] == 1 and candidates1 != v:
+ new_candidates.append(candidates1)
+
+
+ new_used = []
+ for used1 in used:
+ if self.graf[used1][v] == 1 and used1 != v:
+ new_used.append(used1)
+
+
+
+
+ # Удаляем v из candidates и помещаем в used
+ del list_candidates[depth][0]
+ list_used[depth].append(v)
+
+
+ # ЕСЛИ new_candidates и new_used пусты
+ if len(new_candidates) == 0 and len(new_used) == 0:
+ # compsub - клика
+ self.kliki.append(compsub[:])
+
+ else:
+ # ИНАЧЕ рекурсивно вызываем bron_kerbosh(new_candidates, new_used)
+
+ depth += 1
+
+
+ # TIMEOUT check start
+ if self.timeout != -1:
+
+ if time.time() - start_time > self.timeout:
+
+ self.kliki = []
+ return
+ # TIMEOUT check end
+
+
+
+
+ if depth >= len(list_candidates):
+ list_candidates.append([])
+ list_used.append([])
+
+
+ list_candidates[depth] = new_candidates[:]
+ list_used[depth] = new_used[:]
+
+ continue
+
+
+ # Удаляем v из compsub
+ if compsub:
+ compsub.pop()
+
+
+
+
+
+
+
+
+
+
+ def fast_algorithm (self, keys):
+
+ """
+ Fast algorithm
+ """
+
+
+ self.kliki = []
+
+ print 'Fast algorithm started'
+
+
+
+ while 1:
+ # try find new klika
+
+
+ # exclude previous klika atoms
+ excluded = {}
+
+ for klika in self.kliki:
+
+ for i in klika:
+
+ excluded[i] = 1
+
+ keys1 = []
+
+ for i in keys:
+
+ if not excluded.has_key(i):
+ keys1.append(i)
+
+ if len(keys1) == 0:
+ break
+
+ while 1:
+
+ # exclude some atoms
+
+
+ connections = {} # index - atom, value - connections value
+
+ for i in keys1:
+
+ connections[i] = 0
+
+ for j in keys1:
+
+ if i != j and self.graf[i][j]:
+ connections[i] += 1
+
+
+ if max(connections.values()) == min(connections.values()):
+ # all atoms are equal
+ break
+
+
+ exclude_connect = min(connections.values()) # excluded atoms connections
+
+
+ if self.cost:
+
+
+ cost_sum = {} # index - atom, value - cost sum
+
+ for i in keys1:
+
+ cost_sum[i] = 0
+
+ if connections[i] == exclude_connect:
+
+ for j in keys1:
+
+ if i != j and self.graf[i][j]:
+
+ cost_sum[i] += self.cost[i][j]
+
+ exclude_cost = min(cost_sum.values()) # excluded atoms cost sum
+
+
+
+ keys2 = []
+
+ for i in keys1:
+
+ if connections[i] == exclude_connect:
+
+ if cost_sum[i] == exclude_cost:
+
+ continue
+
+ keys2.append(i)
+
+ keys1 = clon(keys2)
+
+ else:
+
+ keys2 = []
+
+ for i in keys1:
+
+ if connections[i] == exclude_connect:
+
+ continue
+
+ keys2.append(i)
+
+ keys1 = clon(keys2)
+
+
+
+ # try add other atoms
+
+
+ while 1:
+
+
+ for i in keys:
+
+ if i in keys1:
+ continue
+
+
+ for j in keys1:
+
+
+ if not self.graf[i][j]:
+ break
+
+ else:
+ # add atom i
+ keys1.append(i)
+
+
+ break
+
+
+ else:
+ # no new atoms
+ break
+
+
+
+ # keys1 is klika
+
+ self.kliki.append(keys1[:])
+
+
+
+
+
+
+
+
diff -r 621fe8e2c1f7 -r 3161cdaf2ff9 blocks3d/clon.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/blocks3d/clon.py Fri Sep 17 21:52:33 2010 +0400
@@ -0,0 +1,38 @@
+# -*- coding: cp1251 -*-
+
+####################################
+# Create new clon of list or dict
+####################################
+
+
+def clon (obj):
+ t = type(obj)
+
+
+ if t == list or t == tuple:
+
+ r = []
+
+ for i in obj:
+ r.append(clon(i))
+
+ if t == tuple:
+ r = tuple(r)
+
+ return r
+
+
+ if t == dict:
+
+ r = {}
+
+ for key, value in obj.items():
+ r[key] = clon(value)
+
+
+ return r
+
+ return obj
+
+
+
diff -r 621fe8e2c1f7 -r 3161cdaf2ff9 blocks3d/html.htm
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/blocks3d/html.htm Fri Sep 17 21:52:33 2010 +0400
@@ -0,0 +1,1590 @@
+
+
+
+
+
+
+Blocks
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

+

Reliable blocks finding


+

+
Enable Javascript!

+

+

+

+

+

+

+

+

+
+
+
+
+
+
+
+
diff -r 621fe8e2c1f7 -r 3161cdaf2ff9 blocks3d/www/array.js
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/blocks3d/www/array.js Fri Sep 17 21:52:33 2010 +0400
@@ -0,0 +1,190 @@
+
+//////////////////////////
+// С?Р?Р?Р?РеС?Р?Р?РњС'С? Р?РњС?С?РеР? :)
+//////////////////////////
+
+
+function array_clon(obj)
+{
+ if (typeof(obj) == 'object')
+ {
+
+ if (typeof(obj.length) === 'undefined')
+ {
+ var obj1 = {}; // С:С?С?
+ }
+ else
+ {
+ var obj1 = []; // Р?РњС?С?РеР?
+ }
+
+
+ for (var i in obj)
+ {
+ obj1[i] = array_clon(obj[i]);
+ }
+
+ return obj1;
+ }
+ else
+ {
+ return obj;
+ }
+}
+
+
+
+
+
+/////////////////////////////////////
+// Р?РћС?С'С? С?Р'РчР?РчР?С' Р?РњС?С?РеР?Рњ Р+РчРћ Р?С?РеР+Р?Р?
+/////////////////////////////////////
+
+function ae(obj, indexes)
+{
+ if (typeof(indexes) != 'object')
+ {
+ indexes = [indexes];
+ }
+
+ var index;
+ var r = obj;
+
+ var i;
+
+ for (i = 0; i < indexes.length; i++)
+ {
+ try
+ {
+ index = indexes[i];
+ r = r[index];
+ }
+ catch(e)
+ {
+ return 0;
+ }
+
+ }
+
+ if (!r)
+ {
+ return 0;
+ }
+
+ return r;
+}
+
+
+
+
+
+
+
+
+
+///////////////////
+// Р?Р?РеС?Р? Р? Р?РњС?С?РеР?Рч
+///////////////////
+// Р?Р?Рч, СјС'Р?
+function indexOf (input, elt /*, from*/)
+{
+
+ var r;
+
+ try
+ {
+ return input.indexOf(elt /*, from*/);
+ }
+ catch(e)
+ {
+ var len = input.length >>> 0;
+
+ var from = Number(arguments[1]) || 0;
+ from = (from < 0)
+ ? Math.ceil(from)
+ : Math.floor(from);
+ if (from < 0)
+ from += len;
+
+ for (; from < len; from++)
+ {
+ if (from in input &&
+ input[from] === elt)
+ return from;
+ }
+ return -1;
+ }
+}
+
+//
+//
+// if (!Array.prototype.indexOf)
+// {
+// Array.prototype.indexOf = function(elt /*, from*/)
+// {
+// var len = this.length >>> 0;
+//
+// var from = Number(arguments[1]) || 0;
+// from = (from < 0)
+// ? Math.ceil(from)
+// : Math.floor(from);
+// if (from < 0)
+// from += len;
+//
+// for (; from < len; from++)
+// {
+// if (from in this &&
+// this[from] === elt)
+// return from;
+// }
+// return -1;
+// };
+// }
+//
+//
+
+
+
+
+
+
+function sortNumber(a, b)
+{
+ return a - b;
+}
+
+
+// Р?Р?РћР?С?РњС%РњРчС' С?Р?РеС?Р?Р? Р?Р'С?СјРчР? С?Р'Р?Р?РњС?С?
+function array_keys(arr)
+{
+ var keys = [];
+
+ var key;
+
+ for (key in arr)
+ {
+ keys.push(key);
+ }
+
+ return keys;
+}
+
+
+
+
+// Р?Р?РћР?С?РњС%РњРчС' С?Р?РеС?Р?Р? РћР?РњСјРчР?РеР? С?Р'Р?Р?РњС?С?
+function array_values(arr)
+{
+ var values = [];
+
+ var key;
+
+ for (key in arr)
+ {
+ values.push(arr[key]);
+ }
+
+ return values;
+}
+
+
diff -r 621fe8e2c1f7 -r 3161cdaf2ff9 blocks3d/www/blocks.js
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/blocks3d/www/blocks.js Fri Sep 17 21:52:33 2010 +0400
@@ -0,0 +1,511 @@
+
+/*
+список блоков
+блок - это словарь:
+ start: integer
+ end: integer
+ IDs: list of IDs
+ //cores: number of all continued part of cores, taking part in klika
+*/
+
+var blocks = {};
+
+// fasta_dict[ID] = текст последовательности
+var fasta_dict = {};
+
+
+/////////////////////////////////
+// пользовательские параметры
+/////////////////////////////////
+
+var h1_height = 50; // высота ячейки с заголовком
+var mainpanel_height = 100; // высота полосы управления
+var legend_interval = 10; // через сколько позиций делать подпись
+
+
+var letter_width = 9; // ширина буковок
+var letter_height = 17; // высота буковок
+var scroller_height_width = 16; // ширина = высота полос прокрутки
+
+var boundary = 70; // запас до границы экрана
+
+
+
+
+
+//////////////////////////////////////////////
+// последующие переменные генерируются сами
+//////////////////////////////////////////////
+
+
+var selected_block_i; // какой блок был щелкнут
+var ID_order = []; // порядок следования ID на экране
+
+var ID_order_now = []; // ID_order, примененный при текущем посторении
+
+var max_ID_length; // максимальная длина названия
+var seq_length; // длина последовательности
+var IDs_count; // сколько у нас всего последовательнотей
+
+// alignment_strings[ID] = строчка с последовательностью ак для

+var alignment_strings = {};
+
+
+//useful_positions[ID][position] = номер блока,
+//если этот элемент входит в состав хотябы одного блока.
+var useful_positions = {};
+
+
+var blocks_inited = 0;
+
+
+
+// стартует весь процесс
+function blocks_init()
+{
+ if (blocks_inited)
+ {
+ return;
+ }
+
+ blocks_inited = 1;
+
+
+ var ID, block;
+ var i, j, k;
+ var t = '';
+
+ var seq;
+
+ // вычислим max_ID_length
+
+
+ max_ID_length = 0;
+
+ for (ID in fasta_dict)
+ {
+ max_ID_length = Math.max(max_ID_length, ID.length);
+ }
+
+
+ // длина последовательности
+
+ for (ID in fasta_dict)
+ {
+ seq_length = fasta_dict[ID].length;
+ break;
+ }
+
+
+ // сколько у нас всего последовательнотей
+ IDs_count = array_keys(fasta_dict).length;
+
+
+
+
+ ///////////////////////////////////////
+ // придумаем цвет для каждого блока
+ ///////////////////////////////////////
+
+ for (i = 0; i < blocks.length; i++)
+ {
+ blocks[i].color = crc32_color(json(blocks[i]));
+ }
+
+
+
+
+
+
+
+
+
+
+ ////////////////////////////////////////////////////////////
+ // Отметим позиции, которые нам может потребоваться красить
+ ////////////////////////////////////////////////////////////
+
+ useful_positions = {};
+
+ for (ID in fasta_dict)
+ {
+ useful_positions[ID] = [];
+ }
+
+ for (i = 0; i < blocks.length; i++)
+ {
+ block = blocks[i];
+
+ for (k = 0; k < block.IDs.length; k++)
+ {
+ ID = block.IDs[k];
+
+ for (j = block.start; j <= block.end; j++)
+ {
+ useful_positions[ID][j] = i;
+ }
+ }
+
+ }
+
+
+
+
+
+ // вычислим строчки для
, чтобы каждый раз не считать

+
+ alignment_strings = {};
+
+
+ var block_i;
+
+ for (ID in fasta_dict)
+ {
+ t = '';
+
+ seq = fasta_dict[ID];
+
+ for (j = 0; j < seq_length; j++)
+ {
+ block_i = useful_positions[ID][j];
+
+ if (block_i || block_i === 0)
+ {
+ // этот элемент входит в состав блока
+
+ t += ' + //t += ' id="a_' + ID + '_' + j + '" ';
+ t += ' style="background:' + blocks[block_i].color + '; cursor:pointer;" ' ;
+ t += ' onclick=letter_click("' + ID + '",' + j + ') ' ;
+ t += '>';
+ }
+
+ t += seq.charAt(j);
+
+ if (block_i || block_i === 0)
+ {
+ t += '
';
+ }
+
+ }
+
+ alignment_strings[ID] = t;
+
+
+ }
+
+
+
+
+ ////////////////////////////
+ // займемся форматированием
+ ////////////////////////////
+
+ set_table_width_height();
+
+
+
+ ///////////////////////////////////////
+ // заполним шкалу с номерами позиций
+ ///////////////////////////////////////
+
+ t = '';
+
+ var c = Math.floor(seq_length / legend_interval); // число подписей
+ var number; // текущее число
+
+ for (i = 1; i <= c; i++)
+ {
+ number = i * legend_interval;
+ number = '' + number; // перевод в строку
+
+ for (j = 0; j < legend_interval - number.length; j++)
+ {
+ t += ' ';
+ }
+
+ t += number;
+
+ }
+
+ t = '
' + t + '
';
+
+ $('legend').innerHTML = t;
+
+
+
+
+
+
+
+
+ ////////////////////////
+ // теперь все запустим
+ ////////////////////////
+
+
+ ID_order = array_keys(fasta_dict);
+
+ blocks_show();
+
+}
+
+
+
+
+
+
+// вычисляет высоту и ширину элемнтов таблицы
+function set_table_width_height()
+{
+ /*
+ В
 всегда вставляется переход на следующую строчку в самом начале и в самом конце

+ */
+
+
+
+
+ $('mainpanel').style.height = mainpanel_height + 'px';
+ $('h1_header').style.height = h1_height + 'px';
+
+
+ $('legend').style.height = (letter_height * 2) + 'px';
+
+
+ var screen_width = get_ww();
+ var screen_height = get_wh();
+
+ // ширина панельки с названиями: (длина названия + 3 символа (" : ")) * ширина символа (9)
+ var IDs_panel_width = (max_ID_length + 3) * letter_width;
+ $('IDs').style.width = IDs_panel_width + 'px';
+
+
+
+
+ // возьмем все, что осталось
+ var width_1 = screen_width - IDs_panel_width - boundary;
+
+ // сколько он сам занимает по максимуму
+ var width_2 = letter_width * seq_length;
+
+ var width = Math.min(width_1, width_2);
+
+
+ // возьмем все, что осталось
+ var height_1 = screen_height - h1_height - mainpanel_height - letter_height * 2 - boundary;
+
+ // сколько он сам занимает по максимуму
+ var height_2 = letter_height * (IDs_count + 2);
+
+ var height = Math.min(height_1, height_2);
+
+
+
+
+
+
+ $('legend').style.width = width + 'px';
+
+ if (height != height_2)
+ {
+ // добавим размер полос прокрутки
+ width += scroller_height_width;
+ }
+
+ $('alignment').style.width = width + 'px';
+
+
+
+
+
+
+
+ $('IDs').style.height = height + 'px';
+
+ if (width != width_2)
+ {
+ // добавим размер полос прокрутки
+ height += scroller_height_width;
+ }
+
+ $('alignment').style.height = height + 'px';
+
+
+}
+
+
+
+
+
+
+
+
+
+
+
+
+// срабатывает про прокрутке окошка с выравниванием
+function alignment_onscroll()
+{
+
+ $('legend').scrollLeft = $('alignment').scrollLeft;
+
+ $('IDs').scrollTop = $('alignment').scrollTop;
+
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+// выводит на экран pre с выравниванием, если это требуется
+function blocks_make_pre()
+{
+ if (json(ID_order) == json(ID_order_now))
+ {
+ return; // ничего не поменялось
+ }
+
+ var ID, block;
+ var i, j;
+ var t = '';
+
+
+
+ /////////////////
+ // Alignment
+ /////////////////
+
+ t = '';
+
+ t += "
";

+
+ for (i = 0; i < ID_order.length; i++)
+ {
+ ID = ID_order[i];
+
+ t += alignment_strings[ID];
+
+ if (i != ID_order.length - 1)
+ {
+ t += "\n";
+ }
+ }
+
+ t += "
\n";
+
+ $('alignment').innerHTML = t;
+
+
+
+
+ //////////////////////
+ // Панель названий
+ //////////////////////
+
+
+ t = '';
+
+ t += "
";

+
+ for (i = 0; i < ID_order.length; i++)
+ {
+ ID = ID_order[i];
+
+ // добавим пробелов
+ for (j = 0; j < max_ID_length - ID.length; j++)
+ {
+ t += ' ';
+ }
+
+ // название
+ t += ID + ' : ';
+
+ t += "\n";
+ }
+
+ t += "
\n";
+
+ $('IDs').innerHTML = t;
+
+
+ ID_order_now = array_clon(ID_order);
+}
+
+
+
+
+
+// клик по букве - перестави этот блок повыше
+function letter_click(ID, pos)
+{
+ selected_block_i = useful_positions[ID][pos];
+
+ // добавим последовательности, входящие в блок
+ ID_order = array_clon(blocks[selected_block_i].IDs);
+
+ // а теперь все остальные
+ for (ID in fasta_dict)
+ {
+ if (indexOf(ID_order, ID) == -1)
+ {
+ ID_order.push(ID);
+ }
+ }
+
+ blocks_show();
+}
+
+
+
+
+
+
+function blocks_show()
+{
+ var t = '';
+
+ if (selected_block_i || selected_block_i === 0)
+ {
+ t += 'Block ' + selected_block_i + '. ';
+
+ //t += 'Include cores: ' + blocks[selected_block_i].cores.join(', ');
+
+
+ }
+
+
+
+ mp_set(t);
+
+ blocks_make_pre();
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff -r 621fe8e2c1f7 -r 3161cdaf2ff9 blocks3d/www/crc32.js
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/blocks3d/www/crc32.js Fri Sep 17 21:52:33 2010 +0400
@@ -0,0 +1,25 @@
+function crc32 ( str ) {
+ // http://kevin.vanzonneveld.net
+ // + original by: Webtoolkit.info (http://www.webtoolkit.info/)
+ // + improved by: T0bsn
+ // - depends on: utf8_encode
+ // * example 1: crc32('Kevin van Zonneveld');
+ // * returns 1: 1249991249
+
+ //str = this.utf8_encode(str);
+
+ var table = "00000000 77073096 EE0E612C 990951BA 076DC419 706AF48F E963A535 9E6495A3 0EDB8832 79DCB8A4 E0D5E91E 97D2D988 09B64C2B 7EB17CBD E7B82D07 90BF1D91 1DB71064 6AB020F2 F3B97148 84BE41DE 1ADAD47D 6DDDE4EB F4D4B551 83D385C7 136C9856 646BA8C0 FD62F97A 8A65C9EC 14015C4F 63066CD9 FA0F3D63 8D080DF5 3B6E20C8 4C69105E D56041E4 A2677172 3C03E4D1 4B04D447 D20D85FD A50AB56B 35B5A8FA 42B2986C DBBBC9D6 ACBCF940 32D86CE3 45DF5C75 DCD60DCF ABD13D59 26D930AC 51DE003A C8D75180 BFD06116 21B4F4B5 56B3C423 CFBA9599 B8BDA50F 2802B89E 5F058808 C60CD9B2 B10BE924 2F6F7C87 58684C11 C1611DAB B6662D3D 76DC4190 01DB7106 98D220BC EFD5102A 71B18589 06B6B51F 9FBFE4A5 E8B8D433 7807C9A2 0F00F934 9609A88E E10E9818 7F6A0DBB 086D3D2D 91646C97 E6635C01 6B6B51F4 1C6C6162 856530D8 F262004E 6C0695ED 1B01A57B 8208F4C1 F50FC457 65B0D9C6 12B7E950 8BBEB8EA FCB9887C 62DD1DDF 15DA2D49 8CD37CF3 FBD44C65 4DB26158 3AB551CE A3BC0074 D4BB30E2 4ADFA541 3DD895D7 A4D1C46D D3D6F4FB 4369E96A 346ED9FC AD678846 DA60B8D0 44042D73 33031DE5 AA0A4C5F DD0D7CC9 5005713C 270241AA BE0B1010 C90C2086 5768B525 206F85B3 B966D409 CE61E49F 5EDEF90E 29D9C998 B0D09822 C7D7A8B4 59B33D17 2EB40D81 B7BD5C3B C0BA6CAD EDB88320 9ABFB3B6 03B6E20C 74B1D29A EAD54739 9DD277AF 04DB2615 73DC1683 E3630B12 94643B84 0D6D6A3E 7A6A5AA8 E40ECF0B 9309FF9D 0A00AE27 7D079EB1 F00F9344 8708A3D2 1E01F268 6906C2FE F762575D 806567CB 196C3671 6E6B06E7 FED41B76 89D32BE0 10DA7A5A 67DD4ACC F9B9DF6F 8EBEEFF9 17B7BE43 60B08ED5 D6D6A3E8 A1D1937E 38D8C2C4 4FDFF252 D1BB67F1 A6BC5767 3FB506DD 48B2364B D80D2BDA AF0A1B4C 36034AF6 41047A60 DF60EFC3 A867DF55 316E8EEF 4669BE79 CB61B38C BC66831A 256FD2A0 5268E236 CC0C7795 BB0B4703 220216B9 5505262F C5BA3BBE B2BD0B28 2BB45A92 5CB36A04 C2D7FFA7 B5D0CF31 2CD99E8B 5BDEAE1D 9B64C2B0 EC63F226 756AA39C 026D930A 9C0906A9 EB0E363F 72076785 05005713 95BF4A82 E2B87A14 7BB12BAE 0CB61B38 92D28E9B E5D5BE0D 7CDCEFB7 0BDBDF21 86D3D2D4 F1D4E242 68DDB3F8 1FDA836E 81BE16CD F6B9265B 6FB077E1 18B74777 88085AE6 FF0F6A70 66063BCA 11010B5C 8F659EFF F862AE69 616BFFD3 166CCF45 A00AE278 D70DD2EE 4E048354 3903B3C2 A7672661 D06016F7 4969474D 3E6E77DB AED16A4A D9D65ADC 40DF0B66 37D83BF0 A9BCAE53 DEBB9EC5 47B2CF7F 30B5FFE9 BDBDF21C CABAC28A 53B39330 24B4A3A6 BAD03605 CDD70693 54DE5729 23D967BF B3667A2E C4614AB8 5D681B02 2A6F2B94 B40BBE37 C30C8EA1 5A05DF1B 2D02EF8D";
+
+ var crc = 0;
+ var x = 0;
+ var y = 0;
+
+ crc = crc ^ (-1);
+ for (var i = 0, iTop = str.length; i < iTop; i++) {
+ y = ( crc ^ str.charCodeAt( i ) ) & 0xFF;
+ x = "0x" + table.substr( y * 9, 8 );
+ crc = ( crc >>> 8 ) ^ x;
+ }
+
+ return crc ^ (-1);
+}
\ No newline at end of file
diff -r 621fe8e2c1f7 -r 3161cdaf2ff9 blocks3d/www/crc32_color.js
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/blocks3d/www/crc32_color.js Fri Sep 17 21:52:33 2010 +0400
@@ -0,0 +1,32 @@
+
+
+// Р?С'Р?РњРчС' СЉР?РчС' Р? РћРњР?РеС?РеР?Р?С?С'Ре Р?С' something (С?С'Р? Р?Р?Р'РР?Рњ Р+С'С'С? С?С'С?Р?Р?Рњ)
+function crc32_color(something)
+{
+ var crc = crc32(something);
+ var rgb = []; // [r, g, b] (Р+РчС?С?С'С?С? Р?Р?С?Р'РчР?Р?РеРч 3 Р+РњР?С'Рч Р?Р?Р?Р?РеС?Ре)
+
+ rgb[0] = crc & 0xFF;
+ rgb[1] = (crc >> 8) & 0xFF;
+ rgb[2] = (crc >> 16) & 0xFF;
+
+ var j;
+
+ // Р?Р?Р?С?Р?РчС'Р'РеР? СЉР?РчС'Рњ
+ for (j = 0; j < 3; j++)
+ {
+ rgb[j] |= 128;
+ }
+
+ for (j = 0; j < 3; j++)
+ {
+ rgb[j] = dechex(rgb[j]);
+
+ if (rgb[j].length == 1)
+ {
+ rgb[j] = '0' + rgb[j];
+ }
+ }
+
+ return '#' + rgb.join('');
+}
\ No newline at end of file
diff -r 621fe8e2c1f7 -r 3161cdaf2ff9 blocks3d/www/css.css
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/blocks3d/www/css.css Fri Sep 17 21:52:33 2010 +0400
@@ -0,0 +1,84 @@
+
+body
+{
+ font: 14px 'Arial', Tahoma, Arial;
+ cursor: default;
+}
+A
+{
+ font: 14px 'Arial', Tahoma, Arial;
+ color: blue;
+ text-decoration: none;
+ cursor: pointer;
+}
+A:hover
+{
+ color: black;
+ font-family: 'Arial' , Tahoma, Arial;
+ text-decoration: underline;
+}
+
+h1
+{
+ font: bold 19px 'Arial' , Tahoma, Arial;
+ color: #004080;
+}
+
+h2
+{
+ font: bold 17px 'Arial' , Tahoma, Arial;
+ color: #784080;
+}
+
+h3
+{
+ font: bold 15px 'Arial' , Tahoma, Arial;
+ color: #000000;
+}
+
+TD
+{
+ font: 14px 'Arial', Tahoma, Arial;
+}
+
+
+table
+{
+ border-color: black;
+ border-Collapse: collapse;
+ border-width: 1px;
+}
+
+
+
+img
+{
+ border:none;
+}
+
+
+
+
+
+
+
+#mainpanel
+{
+ overflow: auto;
+}
+
+#h1_header
+{
+ overflow: hidden;
+}
+
+
+#legend, #IDs
+{
+ overflow: hidden;
+}
+
+#alignment
+{
+ overflow: auto;
+}
diff -r 621fe8e2c1f7 -r 3161cdaf2ff9 blocks3d/www/dechex.js
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/blocks3d/www/dechex.js Fri Sep 17 21:52:33 2010 +0400
@@ -0,0 +1,17 @@
+function dechex (number) {
+ // http://kevin.vanzonneveld.net
+ // + original by: Philippe Baumann
+ // + bugfixed by: Onno Marsman
+ // + improved by: http://stackoverflow.com/questions/57803/how-to-convert-decimal-to-hex-in-javascript
+ // + input by: pilus
+ // * example 1: dechex(10);
+ // * returns 1: 'a'
+ // * example 2: dechex(47);
+ // * returns 2: '2f'
+ // * example 3: dechex(-1415723993);
+ // * returns 3: 'ab9dc427'
+ if (number < 0) {
+ number = 0xFFFFFFFF + number + 1;
+ }
+ return parseInt(number, 10).toString(16);
+}
\ No newline at end of file
diff -r 621fe8e2c1f7 -r 3161cdaf2ff9 blocks3d/www/down.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/blocks3d/www/down.php Fri Sep 17 21:52:33 2010 +0400
@@ -0,0 +1,2 @@
+
+
diff -r 621fe8e2c1f7 -r 3161cdaf2ff9 blocks3d/www/html.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/blocks3d/www/html.php Fri Sep 17 21:52:33 2010 +0400
@@ -0,0 +1,34 @@
+ +
+[inc]top.php
+
+?>
+
+
+
+
+ +
+[inc]down.php
+
+?>
diff -r 621fe8e2c1f7 -r 3161cdaf2ff9 blocks3d/www/json2.js
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/blocks3d/www/json2.js Fri Sep 17 21:52:33 2010 +0400
@@ -0,0 +1,496 @@
+/*
+ http://www.JSON.org/json2.js
+ 2009-06-29
+
+ Public Domain.
+
+ NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
+
+ See http://www.JSON.org/js.html
+
+ This file creates a global JSON object containing two methods: stringify
+ and parse.
+
+ JSON.stringify(value, replacer, space)
+ value any JavaScript value, usually an object or array.
+
+ replacer an optional parameter that determines how object
+ values are stringified for objects. It can be a
+ function or an array of strings.
+
+ space an optional parameter that specifies the indentation
+ of nested structures. If it is omitted, the text will
+ be packed without extra whitespace. If it is a number,
+ it will specify the number of spaces to indent at each
+ level. If it is a string (such as '\t' or ' '),
+ it contains the characters used to indent at each level.
+
+ This method produces a JSON text from a JavaScript value.
+
+ When an object value is found, if the object contains a toJSON
+ method, its toJSON method will be called and the result will be
+ stringified. A toJSON method does not serialize: it returns the
+ value represented by the name/value pair that should be serialized,
+ or undefined if nothing should be serialized. The toJSON method
+ will be passed the key associated with the value, and this will be
+ bound to the object holding the key.
+
+ For example, this would serialize Dates as ISO strings.
+
+ Date.prototype.toJSON = function (key) {
+ function f(n) {
+ // Format integers to have at least two digits.
+ return n < 10 ? '0' + n : n;
+ }
+
+ return this.getUTCFullYear() + '-' +
+ f(this.getUTCMonth() + 1) + '-' +
+ f(this.getUTCDate()) + 'T' +
+ f(this.getUTCHours()) + ':' +
+ f(this.getUTCMinutes()) + ':' +
+ f(this.getUTCSeconds()) + 'Z';
+ };
+
+ You can provide an optional replacer method. It will be passed the
+ key and value of each member, with this bound to the containing
+ object. The value that is returned from your method will be
+ serialized. If your method returns undefined, then the member will
+ be excluded from the serialization.
+
+ If the replacer parameter is an array of strings, then it will be
+ used to select the members to be serialized. It filters the results
+ such that only members with keys listed in the replacer array are
+ stringified.
+
+ Values that do not have JSON representations, such as undefined or
+ functions, will not be serialized. Such values in objects will be
+ dropped; in arrays they will be replaced with null. You can use
+ a replacer function to replace those with JSON values.
+ JSON.stringify(undefined) returns undefined.
+
+ The optional space parameter produces a stringification of the
+ value that is filled with line breaks and indentation to make it
+ easier to read.
+
+ If the space parameter is a non-empty string, then that string will
+ be used for indentation. If the space parameter is a number, then
+ the indentation will be that many spaces.
+
+ Example:
+
+ text = JSON.stringify(['e', {pluribus: 'unum'}]);
+ // text is '["e",{"pluribus":"unum"}]'
+
+
+ text = JSON.stringify(['e', {pluribus: 'unum'}], null, '\t');
+ // text is '[\n\t"e",\n\t{\n\t\t"pluribus": "unum"\n\t}\n]'
+
+ text = JSON.stringify([new Date()], function (key, value) {
+ return this[key] instanceof Date ?
+ 'Date(' + this[key] + ')' : value;
+ });
+ // text is '["Date(---current time---)"]'
+
+
+ JSON.parse(text, reviver)
+ This method parses a JSON text to produce an object or array.
+ It can throw a SyntaxError exception.
+
+ The optional reviver parameter is a function that can filter and
+ transform the results. It receives each of the keys and values,
+ and its return value is used instead of the original value.
+ If it returns what it received, then the structure is not modified.
+ If it returns undefined then the member is deleted.
+
+ Example:
+
+ // Parse the text. Values that look like ISO date strings will
+ // be converted to Date objects.
+
+ myData = JSON.parse(text, function (key, value) {
+ var a;
+ if (typeof value === 'string') {
+ a =
+/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)Z$/.exec(value);
+ if (a) {
+ return new Date(Date.UTC(+a[1], +a[2] - 1, +a[3], +a[4],
+ +a[5], +a[6]));
+ }
+ }
+ return value;
+ });
+
+ myData = JSON.parse('["Date(09/09/2001)"]', function (key, value) {
+ var d;
+ if (typeof value === 'string' &&
+ value.slice(0, 5) === 'Date(' &&
+ value.slice(-1) === ')') {
+ d = new Date(value.slice(5, -1));
+ if (d) {
+ return d;
+ }
+ }
+ return value;
+ });
+
+
+ This is a reference implementation. You are free to copy, modify, or
+ redistribute.
+
+ This code should be minified before deployment.
+ See http://javascript.crockford.com/jsmin.html
+
+ USE YOUR OWN COPY. IT IS EXTREMELY UNWISE TO LOAD CODE FROM SERVERS YOU DO
+ NOT CONTROL.
+*/
+
+/*jslint evil: true */
+
+/*members "", "\b", "\t", "\n", "\f", "\r", "\"", JSON, "\\", apply,
+ call, charCodeAt, getUTCDate, getUTCFullYear, getUTCHours,
+ getUTCMinutes, getUTCMonth, getUTCSeconds, hasOwnProperty, join,
+ lastIndex, length, parse, prototype, push, replace, slice, stringify,
+ test, toJSON, toString, valueOf
+*/
+
+// Create a JSON object only if one does not already exist. We create the
+// methods in a closure to avoid creating global variables.
+
+var JSON = JSON || {};
+
+(function () {
+
+ function f(n) {
+ // Format integers to have at least two digits.
+ return n < 10 ? '0' + n : n;
+ }
+
+ if (typeof Date.prototype.toJSON !== 'function') {
+
+ Date.prototype.toJSON = function (key) {
+
+ return isFinite(this.valueOf()) ?
+ this.getUTCFullYear() + '-' +
+ f(this.getUTCMonth() + 1) + '-' +
+ f(this.getUTCDate()) + 'T' +
+ f(this.getUTCHours()) + ':' +
+ f(this.getUTCMinutes()) + ':' +
+ f(this.getUTCSeconds()) + 'Z' : null;
+ };
+
+ String.prototype.toJSON =
+ Number.prototype.toJSON =
+ Boolean.prototype.toJSON = function (key) {
+ return this.valueOf();
+ };
+ }
+
+ var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
+ escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
+ gap,
+ indent,
+ meta = { // table of character substitutions
+ '\b': '\\b',
+ '\t': '\\t',
+ '\n': '\\n',
+ '\f': '\\f',
+ '\r': '\\r',
+ '"' : '\\"',
+ '\\': '\\\\'
+ },
+ rep;
+
+
+ function quote(string) {
+
+// If the string contains no control characters, no quote characters, and no
+// backslash characters, then we can safely slap some quotes around it.
+// Otherwise we must also replace the offending characters with safe escape
+// sequences.
+
+ escapable.lastIndex = 0;
+ return escapable.test(string) ?
+ '"' + string.replace(escapable, function (a) {
+ var c = meta[a];
+ return typeof c === 'string' ? c :
+ '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
+ }) + '"' :
+ '"' + string + '"';
+ }
+
+
+ function str(key, holder) {
+
+// Produce a string from holder[key].
+
+ var i, // The loop counter.
+ k, // The member key.
+ v, // The member value.
+ length,
+ mind = gap,
+ partial,
+ value = holder[key];
+
+// If the value has a toJSON method, call it to obtain a replacement value.
+
+ if (value && typeof value === 'object' &&
+ typeof value.toJSON === 'function') {
+ value = value.toJSON(key);
+ }
+
+// If we were called with a replacer function, then call the replacer to
+// obtain a replacement value.
+
+ if (typeof rep === 'function') {
+ value = rep.call(holder, key, value);
+ }
+
+// What happens next depends on the value's type.
+
+ switch (typeof value) {
+ case 'string':
+ return quote(value);
+
+ case 'number':
+
+// JSON numbers must be finite. Encode non-finite numbers as null.
+
+ return isFinite(value) ? String(value) : 'null';
+
+ case 'boolean':
+ case 'null':
+
+// If the value is a boolean or null, convert it to a string. Note:
+// typeof null does not produce 'null'. The case is included here in
+// the remote chance that this gets fixed someday.
+
+ return String(value);
+
+// If the type is 'object', we might be dealing with an object or an array or
+// null.
+
+ case 'object':
+
+// Due to a specification blunder in ECMAScript, typeof null is 'object',
+// so watch out for that case.
+
+ if (!value) {
+ return 'null';
+ }
+
+// Make an array to hold the partial results of stringifying this object value.
+
+ gap += indent;
+ partial = [];
+
+// Is the value an array?
+
+ if (Object.prototype.toString.apply(value) === '[object Array]') {
+
+// The value is an array. Stringify every element. Use null as a placeholder
+// for non-JSON values.
+
+ length = value.length;
+ for (i = 0; i < length; i += 1) {
+ partial[i] = str(i, value) || 'null';
+ }
+
+// Join all of the elements together, separated with commas, and wrap them in
+// brackets.
+
+ v = partial.length === 0 ? '[]' :
+ gap ? '[\n' + gap +
+ partial.join(',\n' + gap) + '\n' +
+ mind + ']' :
+ '[' + partial.join(',') + ']';
+ gap = mind;
+ return v;
+ }
+
+// If the replacer is an array, use it to select the members to be stringified.
+
+ if (rep && typeof rep === 'object') {
+ length = rep.length;
+ for (i = 0; i < length; i += 1) {
+ k = rep[i];
+ if (typeof k === 'string') {
+ v = str(k, value);
+ if (v) {
+ partial.push(quote(k) + (gap ? ': ' : ':') + v);
+ }
+ }
+ }
+ } else {
+
+// Otherwise, iterate through all of the keys in the object.
+
+ for (k in value) {
+ if (Object.hasOwnProperty.call(value, k)) {
+ v = str(k, value);
+ if (v) {
+ partial.push(quote(k) + (gap ? ': ' : ':') + v);
+ }
+ }
+ }
+ }
+
+// Join all of the member texts together, separated with commas,
+// and wrap them in braces.
+
+ v = partial.length === 0 ? '{}' :
+ gap ? '{\n' + gap + partial.join(',\n' + gap) + '\n' +
+ mind + '}' : '{' + partial.join(',') + '}';
+ gap = mind;
+ return v;
+ }
+ }
+
+// If the JSON object does not yet have a stringify method, give it one.
+
+ if (typeof JSON.stringify !== 'function') {
+ JSON.stringify = function (value, replacer, space) {
+
+// The stringify method takes a value and an optional replacer, and an optional
+// space parameter, and returns a JSON text. The replacer can be a function
+// that can replace values, or an array of strings that will select the keys.
+// A default replacer method can be provided. Use of the space parameter can
+// produce text that is more easily readable.
+
+ var i;
+ gap = '';
+ indent = '';
+
+// If the space parameter is a number, make an indent string containing that
+// many spaces.
+
+ if (typeof space === 'number') {
+ for (i = 0; i < space; i += 1) {
+ indent += ' ';
+ }
+
+// If the space parameter is a string, it will be used as the indent string.
+
+ } else if (typeof space === 'string') {
+ indent = space;
+ }
+
+// If there is a replacer, it must be a function or an array.
+// Otherwise, throw an error.
+
+ rep = replacer;
+ if (replacer && typeof replacer !== 'function' &&
+ (typeof replacer !== 'object' ||
+ typeof replacer.length !== 'number')) {
+ throw new Error('JSON.stringify');
+ }
+
+// Make a fake root object containing our value under the key of ''.
+// Return the result of stringifying the value.
+
+ return str('', {'': value});
+ };
+ }
+
+
+// If the JSON object does not yet have a parse method, give it one.
+
+ if (typeof JSON.parse !== 'function') {
+ JSON.parse = function (text, reviver) {
+
+// The parse method takes a text and an optional reviver function, and returns
+// a JavaScript value if the text is a valid JSON text.
+
+ var j;
+
+ function walk(holder, key) {
+
+// The walk method is used to recursively walk the resulting structure so
+// that modifications can be made.
+
+ var k, v, value = holder[key];
+ if (value && typeof value === 'object') {
+ for (k in value) {
+ if (Object.hasOwnProperty.call(value, k)) {
+ v = walk(value, k);
+ if (v !== undefined) {
+ value[k] = v;
+ } else {
+ delete value[k];
+ }
+ }
+ }
+ }
+ return reviver.call(holder, key, value);
+ }
+
+
+// Parsing happens in four stages. In the first stage, we replace certain
+// Unicode characters with escape sequences. JavaScript handles many characters
+// incorrectly, either silently deleting them, or treating them as line endings.
+
+ cx.lastIndex = 0;
+ if (cx.test(text)) {
+ text = text.replace(cx, function (a) {
+ return '\\u' +
+ ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
+ });
+ }
+
+// In the second stage, we run the text against regular expressions that look
+// for non-JSON patterns. We are especially concerned with '()' and 'new'
+// because they can cause invocation, and '=' because it can cause mutation.
+// But just to be safe, we want to reject all unexpected forms.
+
+// We split the second stage into 4 regexp operations in order to work around
+// crippling inefficiencies in IE's and Safari's regexp engines. First we
+// replace the JSON backslash pairs with '@' (a non-JSON character). Second, we
+// replace all simple value tokens with ']' characters. Third, we delete all
+// open brackets that follow a colon or comma or that begin the text. Finally,
+// we look to see that the remaining characters are only whitespace or ']' or
+// ',' or ':' or '{' or '}'. If that is so, then the text is safe for eval.
+
+ if (/^[\],:{}\s]*$/.
+test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@').
+replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']').
+replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {
+
+// In the third stage we use the eval function to compile the text into a
+// JavaScript structure. The '{' operator is subject to a syntactic ambiguity
+// in JavaScript: it can begin a block or an object literal. We wrap the text
+// in parens to eliminate the ambiguity.
+
+ j = eval('(' + text + ')');
+
+// In the optional fourth stage, we recursively walk the new structure, passing
+// each name/value pair to a reviver function for possible transformation.
+
+ return typeof reviver === 'function' ?
+ walk({'': j}, '') : j;
+ }
+
+// If the text is not JSON parseable, then a SyntaxError is thrown.
+
+ throw new SyntaxError('JSON.parse');
+ };
+ }
+}());
+
+
+
+
+// JSON
+function json(obj7)
+{
+ if (typeof(obj7) == 'string')
+ {
+ // С?РњС?Р?Р?Р?РеС?С?РчР?
+
+ return JSON.parse(obj7);
+ }
+ else
+ {
+ // Р?Р?Р?РеС?С?РчР?
+ return JSON.stringify(obj7);
+ }
+}
+
diff -r 621fe8e2c1f7 -r 3161cdaf2ff9 blocks3d/www/mainpanel.js
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/blocks3d/www/mainpanel.js Fri Sep 17 21:52:33 2010 +0400
@@ -0,0 +1,52 @@
+
+/////////////////////////////////////////
+// Функции упрощают общение с mainpanel
+/////////////////////////////////////////
+
+
+
+
+
+/////////////////////////////////
+// добавить текст в mainpanel
+/////////////////////////////////
+
+function mp_add(str)
+{
+ $('mainpanel').innerHTML += str;
+}
+
+
+
+
+////////////////////////////////////
+// устанавливает текст в mainpanel
+////////////////////////////////////
+
+function mp_set(str)
+{
+ $('mainpanel').innerHTML = str;
+}
+
+
+
+
+////////////////////////////////////
+// пишет текст в status line
+////////////////////////////////////
+
+function sl_set(str)
+{
+ $('statusline').innerHTML = str;
+}
+
+
+
+///////////////////////////////////////
+// Возвращает document.getElementById
+///////////////////////////////////////
+
+function $(str)
+{
+ return document.getElementById(str);
+}
\ No newline at end of file
diff -r 621fe8e2c1f7 -r 3161cdaf2ff9 blocks3d/www/screen.js
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/blocks3d/www/screen.js Fri Sep 17 21:52:33 2010 +0400
@@ -0,0 +1,45 @@
+
+///////////////////////
+// узнать развер окна
+///////////////////////
+
+function get_ww()
+{
+ var frameWidth = 800;
+
+ if (self.innerWidth)
+ {
+ frameWidth = self.innerWidth;
+ }
+ else if (document.documentElement && document.documentElement.clientWidth)
+ {
+ frameWidth = document.documentElement.clientWidth;
+ }
+ else if (document.body)
+ {
+ frameWidth = document.body.clientWidth;
+ }
+
+ return frameWidth;
+}
+
+
+function get_wh()
+{
+ var frameHeight = 640;
+
+ if (self.innerHeight)
+ {
+ frameHeight = self.innerHeight;
+ }
+ else if (document.documentElement && document.documentElement.clientHeight)
+ {
+ frameHeight = document.documentElement.clientHeight;
+ }
+ else if (document.body)
+ {
+ frameHeight = document.body.clientHeight;
+ }
+
+ return frameHeight;
+}
\ No newline at end of file
diff -r 621fe8e2c1f7 -r 3161cdaf2ff9 blocks3d/www/top.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/blocks3d/www/top.php Fri Sep 17 21:52:33 2010 +0400
@@ -0,0 +1,64 @@
+
+
+
+
+
+
+Blocks
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

+

Reliable blocks finding


+

+
Enable Javascript!

+

+

+

+

+

+

+

+