def get_form(): """ @return: the body of a form """ form_objects = [ Form.Integer('length', 'sequence length', 1000, low=10, high=20000), Form.Integer('ntaxa', 'number of taxa', 20, low=4, high=20), Form.RadioGroup('tree_sampling', 'branch length distribution', [ Form.RadioItem('pachter_length', str(BranchLenSampler.Pachter()), True), Form.RadioItem('exponential_length', str(BranchLenSampler.Exponential())), Form.RadioItem('uniform_length_a', str( BranchLenSampler.UniformA())), Form.RadioItem('uniform_length_b', str( BranchLenSampler.UniformB())) ]), Form.RadioGroup('first_method', 'first estimation method', [ Form.RadioItem('first_nj', 'neighbor joining', True), Form.RadioItem('first_modnj', 'modified neighbor joining'), Form.RadioItem('first_specnj', 'spectral reconstruction') ]), Form.RadioGroup('second_method', 'second estimation method', [ Form.RadioItem('second_nj', 'neighbor joining'), Form.RadioItem('second_modnj', 'modified neighbor joining'), Form.RadioItem('second_specnj', 'spectral', True) ]) ] return form_objects
def get_form(): """ @return: the body of a form """ form_objects = [ Form.Integer('ntaxa', 'number of taxa for distance matrix sampling', 20, low=4, high=20), Form.Integer('seqlen', 'sequence length for distance matrix sampling', 200, low=100, high=10000), Form.Integer('nsamples', 'number of samples', 10, low=1, high=1000), Form.RadioGroup('tree_sampling', 'branch length distribution', [ Form.RadioItem('pachter_length', str(BranchLenSampler.Pachter()), True), Form.RadioItem('exponential_length', str(BranchLenSampler.Exponential())), Form.RadioItem('uniform_length_a', str( BranchLenSampler.UniformA())), Form.RadioItem('uniform_length_b', str( BranchLenSampler.UniformB())) ]) ] return form_objects
def get_response_content(fs): nseconds = 2 ntaxa = fs.ntaxa # define the branch length sampler if fs.pachter_length: branch_length_sampler = BranchLenSampler.Pachter() elif fs.exponential_length: branch_length_sampler = BranchLenSampler.Exponential() elif fs.uniform_length_a: branch_length_sampler = BranchLenSampler.UniformA() elif fs.uniform_length_b: branch_length_sampler = BranchLenSampler.UniformB() return process(ntaxa, nseconds, branch_length_sampler) + '\n'
def get_response_content(fs): nseconds = 2 length = fs.length ntaxa = fs.ntaxa # define the branch length sampler if fs.pachter_length: branch_length_sampler = BranchLenSampler.Pachter() elif fs.exponential_length: branch_length_sampler = BranchLenSampler.Exponential() elif fs.uniform_length_a: branch_length_sampler = BranchLenSampler.UniformA() elif fs.uniform_length_b: branch_length_sampler = BranchLenSampler.UniformB() response_text = process(ntaxa, length, nseconds, branch_length_sampler, fs.nj, fs.modified_nj, fs.all_spectral, fs.one_spectral) return response_text + '\n'
def get_response_content(fs): nseconds = 2 length = fs.length ntaxa = fs.ntaxa # define the branch length sampler if fs.pachter_length: branch_length_sampler = BranchLenSampler.Pachter() elif fs.exponential_length: branch_length_sampler = BranchLenSampler.Exponential() elif fs.uniform_length_a: branch_length_sampler = BranchLenSampler.UniformA() elif fs.uniform_length_b: branch_length_sampler = BranchLenSampler.UniformB() # define the first builder if fs.first_nj: splitter = BuildTreeTopology.split_nj updater = BuildTreeTopology.update_nj first_builder = Builder(splitter, updater, 'nj') elif fs.first_modnj: splitter = BuildTreeTopology.split_nj updater = BuildTreeTopology.update_using_laplacian first_builder = Builder(splitter, updater, 'modnj') elif fs.first_specnj: splitter = BuildTreeTopology.split_using_eigenvector_with_nj_fallback updater = BuildTreeTopology.update_using_laplacian first_builder = Builder(splitter, updater, 'specnj') # define the second builder if fs.second_nj: splitter = BuildTreeTopology.split_nj updater = BuildTreeTopology.update_nj second_builder = Builder(splitter, updater, 'nj') elif fs.second_modnj: splitter = BuildTreeTopology.split_nj updater = BuildTreeTopology.update_using_laplacian second_builder = Builder(splitter, updater, 'modnj') elif fs.second_specnj: splitter = BuildTreeTopology.split_using_eigenvector_with_nj_fallback updater = BuildTreeTopology.update_using_laplacian second_builder = Builder(splitter, updater, 'specnj') builders = [first_builder, second_builder] response_text = process(ntaxa, length, nseconds, builders, branch_length_sampler) return response_text
def get_response_content(fs): # allow only two seconds for web access nseconds = 2 # read the options ntaxa = fs.ntaxa seqlen = fs.seqlen nsamples = fs.nsamples # define the branch length sampler if fs.pachter_length: branch_length_sampler = BranchLenSampler.Pachter() elif fs.exponential_length: branch_length_sampler = BranchLenSampler.Exponential() elif fs.uniform_length_a: branch_length_sampler = BranchLenSampler.UniformA() elif fs.uniform_length_b: branch_length_sampler = BranchLenSampler.UniformB() # return the response response_text = process(ntaxa, nseconds, seqlen, nsamples, branch_length_sampler, False) return response_text + '\n'
def get_form(): """ @return: the body of a form """ form_objects = [ Form.Integer('ntaxa', 'number of taxa for distance matrix sampling', 20, low=4, high=20), Form.Integer('nlengths', 'number of sequence lengths to consider (must be odd)', 9, low=3, high=99), Form.Integer('nsamples', 'number of samples per sequence length', 5, low=1, high=99), Form.RadioGroup('tree_sampling', 'branch length distribution', [ Form.RadioItem('pachter_length', str(BranchLenSampler.Pachter()), True), Form.RadioItem('exponential_length', str(BranchLenSampler.Exponential())), Form.RadioItem('uniform_length_a', str( BranchLenSampler.UniformA())), Form.RadioItem('uniform_length_b', str( BranchLenSampler.UniformB())) ]), Form.RadioGroup( 'distance_options', 'recursive matrix construction method', [ Form.RadioItem( 'pruning_like', 'go through the Laplacian, like Felsenstein pruning', True), Form.RadioItem( 'nj_like', 'directly use distances, like neighbor joining') ]) ] return form_objects
def get_form(): """ @return: the body of a form """ form_objects = [ Form.Integer('length', 'sequence length for distance matrix sampling', 1000, low=10, high=20000), Form.Integer('ntaxa', 'number of taxa for distance matrix sampling', 20, low=4, high=20), Form.RadioGroup('tree_sampling', 'branch length distribution', [ Form.RadioItem('pachter_length', str(BranchLenSampler.Pachter()), True), Form.RadioItem('exponential_length', str(BranchLenSampler.Exponential())), Form.RadioItem('uniform_length_a', str( BranchLenSampler.UniformA())), Form.RadioItem('uniform_length_b', str( BranchLenSampler.UniformB())) ]), Form.CheckGroup('method_options', 'compare these methods', [ Form.CheckItem('nj', 'neighbor joining', True), Form.CheckItem('modified_nj', 'neighbor joining with laplacian updates', True), Form.CheckItem('all_spectral', 'spectral with laplacian updates and nj fallback', True), Form.CheckItem( 'one_spectral', 'an initial spectral split followed by neighbor joining', True) ]) ] return form_objects
def get_response_content(fs): # allow only two seconds for web access nseconds = 2 # read the options ntaxa = fs.ntaxa nlengths = fs.nlengths nsamples = fs.nsamples nj_like = fs.nj_like # do extra validation if nlengths % 2 == 0: raise HandlingError('the number of sequence lengths must be odd') # define the branch length sampler if fs.pachter_length: branch_length_sampler = BranchLenSampler.Pachter() elif fs.exponential_length: branch_length_sampler = BranchLenSampler.Exponential() elif fs.uniform_length_a: branch_length_sampler = BranchLenSampler.UniformA() elif fs.uniform_length_b: branch_length_sampler = BranchLenSampler.UniformB() # get the response response_text = process(ntaxa, nseconds, nlengths, nsamples, nj_like, branch_length_sampler, False) return response_text + '\n'
def __init__(self): self.components = [ BranchLenSampler.Pachter(), BranchLenSampler.Exponential(), BranchLenSampler.UniformA(), BranchLenSampler.UniformB()]