allpy
changeset 824:41f7241c2aeb
Updated markup creation (and removal) in all scripts in the repository. There may still be some uses outside the repository, so watch out! [closes #95]
author | Daniil Alexeyevsky <dendik@kodomo.fbb.msu.ru> |
---|---|
date | Fri, 15 Jul 2011 17:13:01 +0400 |
parents | 0192c5c09ce8 |
children | 4f896db3531d |
files | allpy/homology.py allpy/structure.py sequence_based_blocks_search/blocks_finder.py utils/extract_pfam.py utils/rasmol_homology.py |
diffstat | 5 files changed, 14 insertions(+), 22 deletions(-) [+] |
line diff
1.1 --- a/allpy/homology.py Fri Jul 15 17:02:09 2011 +0400 1.2 +++ b/allpy/homology.py Fri Jul 15 17:13:01 2011 +0400 1.3 @@ -444,12 +444,12 @@ 1.4 exit() 1.5 1.6 # MARKUPING 1.7 - markups.AlignmentNumberMarkup(alignment) 1.8 + alignment.add_markup('number') 1.9 1.10 for sequence in alignment.sequences: 1.11 - markups.SequenceNumberMarkup(sequence) 1.12 + sequence.add_markup('number') 1.13 if case and format != "markup": 1.14 - markups.SequenceCaseMarkup(sequence) 1.15 + sequence.add_markup('case') 1.16 1.17 1.18 #letters = ''.join(v[0] for v in seq.markups['case'].as_list())
2.1 --- a/allpy/structure.py Fri Jul 15 17:02:09 2011 +0400 2.2 +++ b/allpy/structure.py Fri Jul 15 17:13:01 2011 +0400 2.3 @@ -24,7 +24,6 @@ 2.4 import config 2.5 from graph import Graph 2.6 from homology import MonomerHomology 2.7 -from markups import SequenceNumberMarkup 2.8 2.9 2.10 # for pdb-codes 2.11 @@ -406,11 +405,10 @@ 2.12 def blocks_to_homology(self, file, blocks): 2.13 """ Apply transitive closure of homology and save as homology classes 2.14 2.15 - Apply SequenceNumberMarkup to every sequence if it has not been applied 2.16 + Add number markup to every sequence if it has not been added 2.17 """ 2.18 for s in self.sequences: 2.19 - if not hasattr(s, SequenceNumberMarkup.name): 2.20 - SequenceNumberMarkup(s) 2.21 + s.add_markup('number') 2.22 class_id = 1 2.23 column2blocks = {} 2.24 for column in self.columns:
3.1 --- a/sequence_based_blocks_search/blocks_finder.py Fri Jul 15 17:02:09 2011 +0400 3.2 +++ b/sequence_based_blocks_search/blocks_finder.py Fri Jul 15 17:13:01 2011 +0400 3.3 @@ -3,7 +3,6 @@ 3.4 import sys 3.5 sys.path.append("../") 3.6 from allpy import protein 3.7 -from allpy.markups import * 3.8 from allpy.homology import * 3.9 import copy 3.10 import math 3.11 @@ -342,8 +341,7 @@ 3.12 with links created by create_links function""" 3.13 #creating markup 3.14 for sequence in alignment.sequences: 3.15 - sim=SequenceIndexMarkup(sequence) 3.16 - sim.refresh() 3.17 + sequence.add_markup('index') 3.18 #inferring classes_of_equivalence = homologous monomers = connected_components from links 3.19 output = MonomerHomology() 3.20 class_number = 0 3.21 @@ -382,9 +380,8 @@ 3.22 sys.exit() 3.23 #creating markups 3.24 for sequence in alignment.sequences: 3.25 - sim=SequenceIndexMarkup(sequence) 3.26 - sim.refresh() 3.27 - aim = AlignmentIndexMarkup(alignment) 3.28 + sequence.add_markup('index') 3.29 + aim = alignment.add_markup('index') 3.30 #inferring classes_of_equivalence = homologous monomers = connected_components from links 3.31 class_number = 0 3.32 for column in alignment.columns:
4.1 --- a/utils/extract_pfam.py Fri Jul 15 17:02:09 2011 +0400 4.2 +++ b/utils/extract_pfam.py Fri Jul 15 17:13:01 2011 +0400 4.3 @@ -103,7 +103,7 @@ 4.4 print seq.name, seq.description 4.5 print code.pdb_id 4.6 raise AssertionError() 4.7 - markups.SequencePdbResiMarkup(seq).from_pdb() 4.8 + seq.add_markup('pdb_resi').from_pdb() 4.9 4.10 def remove_trailing_monomers(seq, columns): 4.11 for column in columns: 4.12 @@ -123,17 +123,14 @@ 4.13 # XXX [ This is extremely nasty hack ] XXX 4.14 # We replace monomer's class with Gap, so that it is written as . 4.15 # We remove the monomer from the sequence, BUT NOT FROM ALIGNMENT! 4.16 - # And we add some junk to monomers (SequenceIndexMarkup), 4.17 - # which we keep laying around there, but remove from markups, so 4.18 - # that is does not go to file 4.19 # In the end it works like we want, but 4.20 # XXX [ KIDS, DON'T TRY TO DO THIS AT HOME! ] XXX 4.21 - markups.SequenceIndexMarkup(seq) 4.22 + seq.add_markup('index') 4.23 for monomer in reversed(seq): 4.24 if not hasattr(monomer, 'pdb_residue'): 4.25 monomer.__class__ = Gap 4.26 del seq[monomer.index] 4.27 - del seq.markups['index'] 4.28 + seq.remove_markup('index') 4.29 4.30 def clean_aln(aln): 4.31 aln.sequences = [ 4.32 @@ -160,7 +157,7 @@ 4.33 out_seq = None 4.34 pdb_codes = parse_pdb_codes(seq) 4.35 out_seq = append_seq(out_aln, seq, pdb_codes) 4.36 - markups.SequenceCaseMarkup(out_seq) 4.37 + out_seq.add_markup('case') 4.38 add_pdb_structure(out_seq, pdb_codes[0]) 4.39 except AssertionError: 4.40 if out_seq is not None:
5.1 --- a/utils/rasmol_homology.py Fri Jul 15 17:02:09 2011 +0400 5.2 +++ b/utils/rasmol_homology.py Fri Jul 15 17:13:01 2011 +0400 5.3 @@ -42,12 +42,12 @@ 5.4 download_pdb = structure.CachedDownloadPdb(cache_dir=options.pdb_cache) 5.5 5.6 alignment = Alignment().append_file(open(options.markup), format='markup') 5.7 -markups.AlignmentNumberMarkup(alignment) 5.8 +alignment.add_markup('number') 5.9 5.10 def pdb_loader(sequence): 5.11 sequence.__class__ = Sequence 5.12 sequence.markups['pdb_resi'].add_pdb(download_pdb=download_pdb) 5.13 - markups.SequenceNumberMarkup(sequence) 5.14 + sequence.add_markup('number') 5.15 5.16 hmg = homology.MonomerHomology() 5.17 hmg.read(options.homology, columns=True)