#!/usr/bin/env python import sys import os #python magic to add the current directory to the pythonpath sys.path.append(os.getcwd()) # Set up django environment if not os.environ.has_key('DJANGO_SETTINGS_MODULE'): os.environ['DJANGO_SETTINGS_MODULE'] = 'settings' # construct a Search object with Search_residues (pgd_search/models), and a # writer, and pass both to dumpsearch (pgd_search/dump/DataDump.py). tests.py # might be useful. worth noting that the index on search_residue is # i-notation. so -1 0 +1 etc. so that searches remain valid regardless of max # segment length threshold = 90 max = 1.0 min = 0.0 from pgd_search.models import * from pgd_core.models import * from pgd_search.dump import DataDump from StringIO import StringIO # create Search search = Search(segmentLength=0) search.resolution_min = min search.resolution_max = max #search.threshold = threshold search.save() search_residue = Search_residue() search_residue.index = 0 #-4, -3, -2, -1, 0, 1, 2, ... search.residues.add(search_residue) search_residue.search = search #search_residue.ome_include = True #search_residue.ome = "90-155" writer = StringIO() DataDump.dumpSearch(search, writer) writer_string = writer.getvalue() print writer_string