bugged stringlengths 4 228k | fixed stringlengths 0 96.3M | __index_level_0__ int64 0 481k |
|---|---|---|
def read_aims_output(filename, index = -1): """ Import FHI-aims output files with all data available, i.e. relaxations, MD information, force information etc etc etc. """ from ase import Atoms, Atom from ase.calculators.singlepoint import SinglePointCalculator molecular_dynamics = False fd = open(filename, 'r') cell =... | def read_aims_output(filename, index = -1): """ Import FHI-aims output files with all data available, i.e. relaxations, MD information, force information etc etc etc. """ from ase import Atoms, Atom from ase.calculators.singlepoint import SinglePointCalculator molecular_dynamics = False fd = open(filename, 'r') cell =... | 448,100 |
def run_test(get_atoms, get_calculator, name, fmax=0.05, steps=100, plot=True): plotter = Plotter(name, fmax) csvwriter = CSVWriter(name) for optimizer in optimizers: note = '' logname = name + '-' + optimizer atoms = get_atoms() atoms.set_calculator(get_calculator()) opt = get_optimizer(optimizer) relax = opt(atoms,... | def run_test(get_atoms, get_calculator, name, fmax=0.05, steps=100, plot=True): plotter = Plotter(name, fmax) csvwriter = CSVWriter(name) for optimizer in optimizers: note = '' logname = name + '-' + optimizer atoms = get_atoms() atoms.set_calculator(get_calculator()) opt = get_optimizer(optimizer) relax = opt(atoms,... | 448,101 |
def clean(self, data, initial=None): """Checks that the file is valid video and converts it to FLV format""" f = super(VideoUploadToFLVField, self).clean(data, initial) if f is None: return None elif not data and initial: return initial | def clean(self, data, initial=None): """Checks that the file is valid video and converts it to FLV format""" f = super(VideoUploadToFLVField, self).clean(data, initial) if f is None: return None elif not data and initial: return initial | 448,102 |
def clean(self, data, initial=None): """Checks that the file is valid video and converts it to FLV format""" f = super(VideoUploadToFLVField, self).clean(data, initial) if f is None: return None elif not data and initial: return initial | def clean(self, data, initial=None): """Checks that the file is valid video and converts it to FLV format""" f = super(VideoUploadToFLVField, self).clean(data, initial) if f is None: return None elif not data and initial: return initial | 448,103 |
def word(request, viewname, keyword, n, flavour='dictionary'): """View of a single keyword that may have more than one sign""" n = int(n) if request.GET.has_key('feedbackmessage'): feedbackmessage = request.GET['feedbackmessage'] else: feedbackmessage = False word = get_object_or_404(Keyword, text=keyword) # returns... | defif not os.path.exists(os.path.join(settings.MEDIA_ROOT, videourl)): videourl = None word(request,if not os.path.exists(os.path.join(settings.MEDIA_ROOT, videourl)): videourl = None viewname,if not os.path.exists(os.path.join(settings.MEDIA_ROOT, videourl)): videourl = None keyword,if not os.path.exists(os.path... | 448,104 |
def convert_video(sourcefile, targetfile): """convert a video to h264 format""" format = probe_format(sourcefile) if format == "h264": # just do a copy of the file shutil.copy(sourcefile, targetfile) else: # convert the video b = ffmpeg(sourcefile, targetfile, options=convert_options) format = probe_format(targetfil... | def convert_video(sourcefile, targetfile): """convert a video to h264 format""" format = probe_format(sourcefile) if format == "h264": # just do a copy of the file shutil.copy(sourcefile, targetfile) else: # convert the video b = ffmpeg(sourcefile, targetfile, options=FFMPEG_OPTIONS) format = probe_format(targetfile... | 448,105 |
def encode(data, schema, ignore=()): """Given a data dictionary with key/value pairs and schema, return an encoded query string. This is similar to urllib.urlencode(), but field names will include the appropriate field type converters, e.g. an int field will be encoded as fieldname:int=123. Fields not found in the data... | def encode(data, schema, ignore=()): """Given a data dictionary with key/value pairs and schema, return an encoded query string. This is similar to urllib.urlencode(), but field names will include the appropriate field type converters, e.g. an int field will be encoded as fieldname:int=123. Fields not found in the data... | 448,106 |
def encode(data, schema, ignore=()): """Given a data dictionary with key/value pairs and schema, return an encoded query string. This is similar to urllib.urlencode(), but field names will include the appropriate field type converters, e.g. an int field will be encoded as fieldname:int=123. Fields not found in the data... | def encode(data, schema, ignore=()): """Given a data dictionary with key/value pairs and schema, return an encoded query string. This is similar to urllib.urlencode(), but field names will include the appropriate field type converters, e.g. an int field will be encoded as fieldname:int=123. Fields not found in the data... | 448,107 |
def encode(data, schema, ignore=()): """Given a data dictionary with key/value pairs and schema, return an encoded query string. This is similar to urllib.urlencode(), but field names will include the appropriate field type converters, e.g. an int field will be encoded as fieldname:int=123. Fields not found in the data... | def encode(data, schema, ignore=()): """Given a data dictionary with key/value pairs and schema, return an encoded query string. This is similar to urllib.urlencode(), but field names will include the appropriate field type converters, e.g. an int field will be encoded as fieldname:int=123. Fields not found in the data... | 448,108 |
def externalEntityRefHandler(self, context, base, systemId, publicId): """The purpose of this function is to load the DTD locally, instead of downloading it from the URL specified in the XML. Using the local DTD results in much faster parsing. If the DTD is not found locally, we try to download it. In practice, this ma... | def externalEntityRefHandler(self, context, base, systemId, publicId): """The purpose of this function is to load the DTD locally, instead of downloading it from the URL specified in the XML. Using the local DTD results in much faster parsing. If the DTD is not found locally, we try to download it. In practice, this ma... | 448,109 |
def train_bw(states, alphabet, training_data, pseudo_initial=None, pseudo_transition=None, pseudo_emission=None, update_fn=None, ): """train_bw(states, alphabet, training_data[, pseudo_initial] [, pseudo_transition][, pseudo_emission][, update_fn]) -> MarkovModel Train a MarkovModel using the Baum-Welch algorithm. st... | def train_bw(states, alphabet, training_data, pseudo_initial=None, pseudo_transition=None, pseudo_emission=None, update_fn=None, ): """train_bw(states, alphabet, training_data[, pseudo_initial] [, pseudo_transition][, pseudo_emission][, update_fn]) -> MarkovModel Train a MarkovModel using the Baum-Welch algorithm. st... | 448,110 |
def train_bw(states, alphabet, training_data, pseudo_initial=None, pseudo_transition=None, pseudo_emission=None, update_fn=None, ): """train_bw(states, alphabet, training_data[, pseudo_initial] [, pseudo_transition][, pseudo_emission][, update_fn]) -> MarkovModel Train a MarkovModel using the Baum-Welch algorithm. st... | def train_bw(states, alphabet, training_data, pseudo_initial=None, pseudo_transition=None, pseudo_emission=None, update_fn=None, ): """train_bw(states, alphabet, training_data[, pseudo_initial] [, pseudo_transition][, pseudo_emission][, update_fn]) -> MarkovModel Train a MarkovModel using the Baum-Welch algorithm. st... | 448,111 |
def train_bw(states, alphabet, training_data, pseudo_initial=None, pseudo_transition=None, pseudo_emission=None, update_fn=None, ): """train_bw(states, alphabet, training_data[, pseudo_initial] [, pseudo_transition][, pseudo_emission][, update_fn]) -> MarkovModel Train a MarkovModel using the Baum-Welch algorithm. st... | def train_bw(states, alphabet, training_data, pseudo_initial=None, pseudo_transition=None, pseudo_emission=None, update_fn=None, ): """train_bw(states, alphabet, training_data[, pseudo_initial] [, pseudo_transition][, pseudo_emission][, update_fn]) -> MarkovModel Train a MarkovModel using the Baum-Welch algorithm. st... | 448,112 |
def train_visible(states, alphabet, training_data, pseudo_initial=None, pseudo_transition=None, pseudo_emission=None): """train_visible(states, alphabet, training_data[, pseudo_initial] [, pseudo_transition][, pseudo_emission]) -> MarkovModel Train a visible MarkovModel using maximum likelihoood estimates for each of ... | def train_visible(states, alphabet, training_data, pseudo_initial=None, pseudo_transition=None, pseudo_emission=None): """train_visible(states, alphabet, training_data[, pseudo_initial] [, pseudo_transition][, pseudo_emission]) -> MarkovModel Train a visible MarkovModel using maximum likelihoood estimates for each of ... | 448,113 |
def train_visible(states, alphabet, training_data, pseudo_initial=None, pseudo_transition=None, pseudo_emission=None): """train_visible(states, alphabet, training_data[, pseudo_initial] [, pseudo_transition][, pseudo_emission]) -> MarkovModel Train a visible MarkovModel using maximum likelihoood estimates for each of ... | def train_visible(states, alphabet, training_data, pseudo_initial=None, pseudo_transition=None, pseudo_emission=None): """train_visible(states, alphabet, training_data[, pseudo_initial] [, pseudo_transition][, pseudo_emission]) -> MarkovModel Train a visible MarkovModel using maximum likelihoood estimates for each of ... | 448,114 |
def train_visible(states, alphabet, training_data, pseudo_initial=None, pseudo_transition=None, pseudo_emission=None): """train_visible(states, alphabet, training_data[, pseudo_initial] [, pseudo_transition][, pseudo_emission]) -> MarkovModel Train a visible MarkovModel using maximum likelihoood estimates for each of ... | def train_visible(states, alphabet, training_data, pseudo_initial=None, pseudo_transition=None, pseudo_emission=None): """train_visible(states, alphabet, training_data[, pseudo_initial] [, pseudo_transition][, pseudo_emission]) -> MarkovModel Train a visible MarkovModel using maximum likelihoood estimates for each of ... | 448,115 |
def emboss_translate(sequence, table=None, frame=None): """Call transeq, returns protein sequence as string.""" #TODO - Support transeq in Bio.Emboss.Applications? #(doesn't seem worthwhile as Biopython can do translations) if not sequence: raise ValueError(sequence) #Setup, cline = exes["transeq"] if len(sequence) ... | def emboss_translate(sequence, table=None, frame=None): """Call transeq, returns protein sequence as string.""" #TODO - Support transeq in Bio.Emboss.Applications? #(doesn't seem worthwhile as Biopython can do translations) if not sequence: raise ValueError(sequence) #Setup, cline = exes["transeq"] if len(sequence) ... | 448,116 |
def _get_data_division(self, record): try: division = record.annotations["data_file_division"] except KeyError: division = "UNK" if division in ["PRI", "ROD", "MAM", "VRT", "INV", "PLN", "BCT", "VRL", "PHG", "SYN", "UNA", "EST", "PAT", "STS", "GSS", "HTG", "HTC", "ENV", "CON"]: #Good, already GenBank style # PRI - p... | def _get_data_division(self, record): try: division = record.annotations["data_file_division"] except KeyError: division = "UNK" if division in ["PRI", "ROD", "MAM", "VRT", "INV", "PLN", "BCT", "VRL", "PHG", "SYN", "UNA", "EST", "PAT", "STS", "GSS", "HTG", "HTC", "ENV", "CON"]: #Good, already GenBank style # PRI - p... | 448,117 |
def _get_data_division(self, record): try: division = record.annotations["data_file_division"] except KeyError: division = "UNK" if division in ["PRI", "ROD", "MAM", "VRT", "INV", "PLN", "BCT", "VRL", "PHG", "SYN", "UNA", "EST", "PAT", "STS", "GSS", "HTG", "HTC", "ENV", "CON"]: #Good, already GenBank style # PRI - p... | def _get_data_division(self, record): try: division = record.annotations["data_file_division"] except KeyError: division = "UNK" if division in ["PRI", "ROD", "MAM", "VRT", "INV", "PLN", "BCT", "VRL", "PHG", "SYN", "UNA", "EST", "PAT", "STS", "GSS", "HTG", "HTC", "ENV", "CON"]: #Good, already GenBank style # PRI - p... | 448,118 |
def _write_the_first_lines(self, record): """Write the ID and AC lines.""" if "." in record.id and record.id.rsplit(".", 1)[1].isdigit(): version = "SV " + record.id.rsplit(".", 1)[1] accession = self._get_annotation_str(record, "accession", record.id.rsplit(".", 1)[0], just_first=True) else : version = "" accession = ... | def _write_the_first_lines(self, record): """Write the ID and AC lines.""" if "." in record.id and record.id.rsplit(".", 1)[1].isdigit(): version = "SV " + record.id.rsplit(".", 1)[1] accession = self._get_annotation_str(record, "accession", record.id.rsplit(".", 1)[0], just_first=True) else : version = "" accession = ... | 448,119 |
def qblast(program, database, sequence, auto_format=None,composition_based_statistics=None, db_genetic_code=None,endpoints=None,entrez_query='(none)', expect=10.0,filter=None,gapcosts=None,genetic_code=None, hitlist_size=50,i_thresh=None,layout=None,lcase_mask=None, matrix_name=None,nucl_penalty=None,nucl_reward=None, ... | def qblast(program, database, sequence, auto_format=None,composition_based_statistics=None, db_genetic_code=None,endpoints=None,entrez_query='(none)', expect=10.0,filter=None,gapcosts=None,genetic_code=None, hitlist_size=50,i_thresh=None,layout=None,lcase_mask=None, matrix_name=None,nucl_penalty=None,nucl_reward=None, ... | 448,120 |
def check_simple_write_read(records, indent=" "): #print indent+"Checking we can write and then read back these records" for format in test_write_read_alignment_formats: if format not in possible_unknown_seq_formats \ and isinstance(records[0].seq, UnknownSeq) \ and len(records[0].seq) > 100: #Skipping for speed. Some... | def check_simple_write_read(records, indent=" "): #print indent+"Checking we can write and then read back these records" for format in test_write_read_alignment_formats: if format not in possible_unknown_seq_formats \ and isinstance(records[0].seq, UnknownSeq) \ and len(records[0].seq) > 100: #Skipping for speed. Some... | 448,121 |
def check_simple_write_read(records, indent=" "): #print indent+"Checking we can write and then read back these records" for format in test_write_read_alignment_formats: if format not in possible_unknown_seq_formats \ and isinstance(records[0].seq, UnknownSeq) \ and len(records[0].seq) > 100: #Skipping for speed. Some... | def check_simple_write_read(records, indent=" "): #print indent+"Checking we can write and then read back these records" for format in test_write_read_alignment_formats: if format not in possible_unknown_seq_formats \ and isinstance(records[0].seq, UnknownSeq) \ and len(records[0].seq) > 100: #Skipping for speed. Some... | 448,122 |
def check_simple_write_read(records, indent=" "): #print indent+"Checking we can write and then read back these records" for format in test_write_read_alignment_formats: if format not in possible_unknown_seq_formats \ and isinstance(records[0].seq, UnknownSeq) \ and len(records[0].seq) > 100: #Skipping for speed. Some... | def check_simple_write_read(records, indent=" "): #print indent+"Checking we can write and then read back these records" for format in test_write_read_alignment_formats: if format not in possible_unknown_seq_formats \ and isinstance(records[0].seq, UnknownSeq) \ and len(records[0].seq) > 100: #Skipping for speed. Some... | 448,123 |
def check_simple_write_read(records, indent=" "): #print indent+"Checking we can write and then read back these records" for format in test_write_read_alignment_formats: if format not in possible_unknown_seq_formats \ and isinstance(records[0].seq, UnknownSeq) \ and len(records[0].seq) > 100: #Skipping for speed. Some... | def check_simple_write_read(records, indent=" "): #print indent+"Checking we can write and then read back these records" for format in test_write_read_alignment_formats: if format not in possible_unknown_seq_formats \ and isinstance(records[0].seq, UnknownSeq) \ and len(records[0].seq) > 100: #Skipping for speed. Some... | 448,124 |
def check_simple_write_read(records, indent=" "): #print indent+"Checking we can write and then read back these records" for format in test_write_read_alignment_formats: if format not in possible_unknown_seq_formats \ and isinstance(records[0].seq, UnknownSeq) \ and len(records[0].seq) > 100: #Skipping for speed. Some... | def check_simple_write_read(records, indent=" "): #print indent+"Checking we can write and then read back these records" for format in test_write_read_alignment_formats: if format not in possible_unknown_seq_formats \ and isinstance(records[0].seq, UnknownSeq) \ and len(records[0].seq) > 100: #Skipping for speed. Some... | 448,125 |
def check_simple_write_read(records, indent=" "): #print indent+"Checking we can write and then read back these records" for format in test_write_read_alignment_formats: if format not in possible_unknown_seq_formats \ and isinstance(records[0].seq, UnknownSeq) \ and len(records[0].seq) > 100: #Skipping for speed. Some... | def check_simple_write_read(records, indent=" "): #print indent+"Checking we can write and then read back these records" for format in test_write_read_alignment_formats: if format not in possible_unknown_seq_formats \ and isinstance(records[0].seq, UnknownSeq) \ and len(records[0].seq) > 100: #Skipping for speed. Some... | 448,126 |
def check_simple_write_read(records, indent=" "): #print indent+"Checking we can write and then read back these records" for format in test_write_read_alignment_formats: if format not in possible_unknown_seq_formats \ and isinstance(records[0].seq, UnknownSeq) \ and len(records[0].seq) > 100: #Skipping for speed. Some... | def check_simple_write_read(records, indent=" "): #print indent+"Checking we can write and then read back these records" for format in test_write_read_alignment_formats: if format not in possible_unknown_seq_formats \ and isinstance(records[0].seq, UnknownSeq) \ and len(records[0].seq) > 100: #Skipping for speed. Some... | 448,127 |
def check_simple_write_read(records, indent=" "): #print indent+"Checking we can write and then read back these records" for format in test_write_read_alignment_formats: if format not in possible_unknown_seq_formats \ and isinstance(records[0].seq, UnknownSeq) \ and len(records[0].seq) > 100: #Skipping for speed. Some... | def check_simple_write_read(records, indent=" "): #print indent+"Checking we can write and then read back these records" for format in test_write_read_alignment_formats: if format not in possible_unknown_seq_formats \ and isinstance(records[0].seq, UnknownSeq) \ and len(records[0].seq) > 100: #Skipping for speed. Some... | 448,128 |
def simple_check(self, filename, format, alphabet): if format in SeqIO._BinaryFormats: mode = "rb" else : mode = "r" id_list = [rec.id for rec in \ SeqIO.parse(open(filename, mode), format, alphabet)] rec_dict = SeqIO.index(filename, format, alphabet) self.assertEqual(set(id_list), set(rec_dict.keys())) #This is redund... | def simple_check(self, filename, format, alphabet): if format in SeqIO._BinaryFormats: mode = "rb" else : mode = "r" id_list = [rec.id for rec in \ SeqIO.parse(open(filename, mode), format, alphabet)] rec_dict = SeqIO.index(filename, format, alphabet) self.assertEqual(set(id_list), set(rec_dict.keys())) #This is redund... | 448,129 |
def simple_check(self, filename, format, alphabet): if format in SeqIO._BinaryFormats: mode = "rb" else : mode = "r" id_list = [rec.id for rec in \ SeqIO.parse(open(filename, mode), format, alphabet)] rec_dict = SeqIO.index(filename, format, alphabet) self.assertEqual(set(id_list), set(rec_dict.keys())) #This is redund... | def simple_check(self, filename, format, alphabet): if format in SeqIO._BinaryFormats: mode = "rb" else : mode = "r" id_list = [rec.id for rec in \ SeqIO.parse(open(filename, mode), format, alphabet)] rec_dict = SeqIO.index(filename, format, alphabet) self.assertEqual(set(id_list), set(rec_dict.keys())) #This is redund... | 448,130 |
def test_convert_to_phylip32(self): """Convert FASTA to PHYLIP 3.2 format.""" self.conversion(11, "phy", "phylip") | def test_convert_to_phylip32(self): """Convert FASTA to PHYLIP 3.2 format.""" self.conversion(11, "phy", "phylip") | 448,131 |
def parse_features(self, skip=False): """Return list of tuples for the features (if present) | def parse_features(self, skip=False): """Return list of tuples for the features (if present) | 448,132 |
def _set_confidence(self, value): if isinstance(value, float) or isinstance(value, int): value = Confidence(value) elif not isinstance(value, Confidence): raise ValueError("value must be a number or Confidence instance") if len(self.confidences) == 0: self.confidences.append(value) elif len(self.confidences) == 1: self... | def _set_confidence(self, value): if isinstance(value, float) or isinstance(value, int): value = Confidence(value) elif not isinstance(value, Confidence): raise ValueError("value must be a number or Confidence instance") if len(self.confidences) == 0: self.confidences.append(value) elif len(self.confidences) == 1: self... | 448,133 |
def _set_confidence(self, value): if isinstance(value, float) or isinstance(value, int): value = Confidence(value) elif not isinstance(value, Confidence): raise ValueError("value must be a number or Confidence instance") if len(self.confidences) == 0: self.confidences.append(value) elif len(self.confidences) == 1: self... | def _set_confidence(self, value): if isinstance(value, float) or isinstance(value, int): value = Confidence(value) elif not isinstance(value, Confidence): raise ValueError("value must be a number or Confidence instance") if len(self.confidences) == 0: self.confidences.append(value) elif len(self.confidences) == 1: self... | 448,134 |
def secondary_structure_fraction (self): if not self.amino_acids_percent: self.get_amino_acids_percent() Helix = self.amino_acids_percent['V'] + self.amino_acids_percent['I'] + self.amino_acids_percent['Y'] + self.amino_acids_percent['F'] + self.amino_acids_percent['W'] + self.amino_acids_percent['L'] Turn = self.amino... | def secondary_structure_fraction (self): if not self.amino_acids_percent: self.get_amino_acids_percent() Helix = self.amino_acids_percent['V'] + self.amino_acids_percent['I'] + self.amino_acids_percent['Y'] + self.amino_acids_percent['F'] + self.amino_acids_percent['W'] + self.amino_acids_percent['L'] Turn = self.amino... | 448,135 |
def root_with_outgroup(self, *outgroup_targets): """Reroot this tree with the outgroup clade containing outgroup_targets. | def root_with_outgroup(self, *outgroup_targets): """Reroot this tree with the outgroup clade containing outgroup_targets. | 448,136 |
def __add__(self, other): """Add another sequence or string to this sequence. | def __add__(self, other): """Add another sequence or string to this sequence. | 448,137 |
def write_read(filename, in_format, out_format): if in_format in BINARY_FORMATS: mode = "rb" handle = BytesIO() else : mode = "r" handle = StringIO() records = list(SeqIO.parse(open(filename, mode),in_format)) #Write it out... SeqIO.write(records, handle, out_format) handle.seek(0) #Now load it back and check it agrees... | def write_read(filename, in_format, out_format): if in_format in BINARY_FORMATS: mode = "rb" handle = BytesIO() else : handle = StringIO() records = list(SeqIO.parse(open(filename, mode),in_format)) #Write it out... SeqIO.write(records, handle, out_format) handle.seek(0) #Now load it back and check it agrees, records2 ... | 448,138 |
def write_read(filename, in_format, out_format): if in_format in BINARY_FORMATS: mode = "rb" handle = BytesIO() else : mode = "r" handle = StringIO() records = list(SeqIO.parse(open(filename, mode),in_format)) #Write it out... SeqIO.write(records, handle, out_format) handle.seek(0) #Now load it back and check it agrees... | def write_read(filename, in_format, out_format): if in_format in BINARY_FORMATS: mode = "rb" handle = BytesIO() else : mode = "r" handle = StringIO() records = list(SeqIO.parse(open(filename, mode),in_format)) #Write it out... SeqIO.write(records, handle, out_format) handle.seek(0) #Now load it back and check it agrees... | 448,139 |
def write(alignments, handle, format): """Write complete set of alignments to a file. Arguments: - sequences - A list (or iterator) of Alignment objects - handle - File handle object to write to - format - lower case string describing the file format to write. You should close the handle after calling this func... | def write(alignments, handle, format): """Write complete set of alignments to a file. Arguments: - sequences - A list (or iterator) of Alignment objects - handle - File handle object to write to - format - lower case string describing the file format to write. You should close the handle after calling this func... | 448,140 |
def write(alignments, handle, format): """Write complete set of alignments to a file. Arguments: - sequences - A list (or iterator) of Alignment objects - handle - File handle object to write to - format - lower case string describing the file format to write. You should close the handle after calling this func... | def write(alignments, handle, format): """Write complete set of alignments to a file. Arguments: - sequences - A list (or iterator) of Alignment objects - handle - File handle object to write to - format - lower case string describing the file format to write. You should close the handle after calling this func... | 448,141 |
def write(alignments, handle, format): """Write complete set of alignments to a file. Arguments: - sequences - A list (or iterator) of Alignment objects - handle - File handle object to write to - format - lower case string describing the file format to write. You should close the handle after calling this func... | def write(alignments, handle, format): """Write complete set of alignments to a file. Arguments: - sequences - A list (or iterator) of Alignment objects - handle - File handle object to write to - format - lower case string describing the file format to write. You should close the handle after calling this func... | 448,142 |
def _force_alphabet(alignment_iterator, alphabet): """Iterate over alignments, over-riding the alphabet (PRIVATE).""" #Assume the alphabet argument has been pre-validated given_base_class = _get_base_alphabet(alphabet).__class__ for align in alignment_iterator: if not isinstance(_get_base_alphabet(align._alphabet), giv... | def _force_alphabet(alignment_iterator, alphabet): """Iterate over alignments, over-riding the alphabet (PRIVATE).""" #Assume the alphabet argument has been pre-validated given_base_class = _get_base_alphabet(alphabet).__class__ for align in alignment_iterator: if not isinstance(_get_base_alphabet(align._alphabet), giv... | 448,143 |
def parse(handle, format, seq_count=None, alphabet=None): """Turns a sequence file into an iterator returning Alignment objects. Arguments: - handle - handle to the file. - format - string describing the file format. - alphabet - optional Alphabet object, useful when the sequence type cannot be automatically in... | def parse(handle, format, seq_count=None, alphabet=None): """Turns a sequence file into an iterator returning Alignment objects. Arguments: - handle - handle to the file. - format - string describing the file format. - alphabet - optional Alphabet object, useful when the sequence type cannot be automatically in... | 448,144 |
def parse(handle, format, seq_count=None, alphabet=None): """Turns a sequence file into an iterator returning Alignment objects. Arguments: - handle - handle to the file. - format - string describing the file format. - alphabet - optional Alphabet object, useful when the sequence type cannot be automatically in... | def parse(handle, format, seq_count=None, alphabet=None): """Turns a sequence file into an iterator returning Alignment objects. Arguments: - handle - handle to the file. - format - string describing the file format. - alphabet - optional Alphabet object, useful when the sequence type cannot be automatically in... | 448,145 |
def convert(in_file, in_format, out_file, out_format, alphabet=None): """Convert between two alignment files, returns number of alignments. - in_file - an input handle or filename - in_format - input file format, lower case string - output - an output handle or filename - out_file - output file format, lower case stri... | def convert(in_file, in_format, out_file, out_format, alphabet=None): """Convert between two alignment files, returns number of alignments. - in_file - an input handle or filename - in_format - input file format, lower case string - output - an output handle or filename - out_file - output file format, lower case stri... | 448,146 |
def _test(): """Run the Bio.AlignIO module's doctests. This will try and locate the unit tests directory, and run the doctests from there in order that the relative paths used in the examples work. """ import doctest import os if os.path.isdir(os.path.join("..","..","Tests")): print "Runing doctests..." cur_dir = os.p... | def _test(): """Run the Bio.AlignIO module's doctests. This will try and locate the unit tests directory, and run the doctests from there in order that the relative paths used in the examples work. """ import doctest import os if os.path.isdir(os.path.join("..", "..", "Tests")): print "Runing doctests..." cur_dir = os... | 448,147 |
def _test(): """Run the Bio.AlignIO module's doctests. This will try and locate the unit tests directory, and run the doctests from there in order that the relative paths used in the examples work. """ import doctest import os if os.path.isdir(os.path.join("..","..","Tests")): print "Runing doctests..." cur_dir = os.p... | def _test(): """Run the Bio.AlignIO module's doctests. This will try and locate the unit tests directory, and run the doctests from there in order that the relative paths used in the examples work. """ import doctest import os if os.path.isdir(os.path.join("..","..","Tests")): print "Runing doctests..." cur_dir = os.p... | 448,148 |
def __init__(self, records, alphabet=None): """Initialize a new MultipleSeqAlignment object. | def __init__(self, records, alphabet=None): """Initialize a new MultipleSeqAlignment object. | 448,149 |
def __init__(self, records, alphabet=None): """Initialize a new MultipleSeqAlignment object. | def __init__(self, records, alphabet=None): """Initialize a new MultipleSeqAlignment object. | 448,150 |
def extend(self, records) : """Add more SeqRecord objects to the alignment as rows. | def extend(self, records): """Add more SeqRecord objects to the alignment as rows. | 448,151 |
def extend(self, records) : """Add more SeqRecord objects to the alignment as rows. | def extend(self, records) : """Add more SeqRecord objects to the alignment as rows. | 448,152 |
def append(self, record) : """Add one more SeqRecord object to the alignment as a new row. | def append(self, record): """Add one more SeqRecord object to the alignment as a new row. | 448,153 |
def check(self, exe_name, wrapper) : global exe_names exe = exe_names[exe_name] cline = wrapper(exe, h=True) | def check(self, exe_name, wrapper) : global exe_names exe = exe_names[exe_name] cline = wrapper(exe, h=True) | 448,154 |
def __init__(self, cmd="iep", **kwargs): self.parameters = [ _Option(["-sequence","sequence"], "Protein sequence(s) filename", filename=True, is_require=True), _Option(["-amino","amino"], "Amino acid"), _Option(["-lysinemodified","lysinemodified"], ""), #TODO _Option(["-disulphides","disulphides"], ""), #TODO _Option([... | def __init__(self, cmd="iep", **kwargs): self.parameters = [ _Option(["-sequence","sequence"], "Protein sequence(s) filename", filename=True, is_required=True), _Option(["-amino","amino"], "Amino acid"), _Option(["-lysinemodified","lysinemodified"], ""), #TODO _Option(["-disulphides","disulphides"], ""), #TODO _Option(... | 448,155 |
def __init__(self, cmd="mafft", **kwargs): BLOSUM_MATRICES = ["30","45","62","80"] self.parameters = \ [ #**** Algorithm **** #Automatically selects an appropriate strategy from L-INS-i, FFT-NS- #i and FFT-NS-2, according to data size. Default: off (always FFT-NS-2) _Switch(["--auto", "auto"], ["input"], "Automatically... | def __init__(self, cmd="mafft", **kwargs): BLOSUM_MATRICES = ["30","45","62","80"] self.parameters = \ [ #**** Algorithm **** #Automatically selects an appropriate strategy from L-INS-i, FFT-NS- #i and FFT-NS-2, according to data size. Default: off (always FFT-NS-2) _Switch(["--auto", "auto"], ["input"], "Automatically... | 448,156 |
def reverse_complement(self, id=False, name=False, description=False, features=True, annotations=False, letter_annotations=True, dbxrefs=False): """Returns new SeqRecord with reverse complement sequence. | def reverse_complement(self, id=False, name=False, description=False, features=True, annotations=False, letter_annotations=True, dbxrefs=False): """Returns new SeqRecord with reverse complement sequence. | 448,157 |
def reverse_complement(self, id=False, name=False, description=False, features=True, annotations=False, letter_annotations=True, dbxrefs=False): """Returns new SeqRecord with reverse complement sequence. | def reverse_complement(self, id=False, name=False, description=False, features=True, annotations=False, letter_annotations=True, dbxrefs=False): """Returns new SeqRecord with reverse complement sequence. | 448,158 |
def reverse_complement(self, id=False, name=False, description=False, features=True, annotations=False, letter_annotations=True, dbxrefs=False): """Returns new SeqRecord with reverse complement sequence. | def reverse_complement(self, id=False, name=False, description=False, features=True, annotations=False, letter_annotations=True, dbxrefs=False): """Returns new SeqRecord with reverse complement sequence. | 448,159 |
def reverse_complement(self, id=False, name=False, description=False, features=True, annotations=False, letter_annotations=True, dbxrefs=False): """Returns new SeqRecord with reverse complement sequence. | def reverse_complement(self, id=False, name=False, description=False, features=True, annotations=False, letter_annotations=True, dbxrefs=False): """Returns new SeqRecord with reverse complement sequence. | 448,160 |
def reverse_complement(self, id=False, name=False, description=False, features=True, annotations=False, letter_annotations=True, dbxrefs=False): """Returns new SeqRecord with reverse complement sequence. | def reverse_complement(self, id=False, name=False, description=False, features=True, annotations=False, letter_annotations=True, dbxrefs=False): """Returns new SeqRecord with reverse complement sequence. | 448,161 |
def _validate(self): if self.remote and self.in_pssm: raise ValueError("The remote option cannot be used with in_pssm") if self.query and self.in_pssm: raise ValueError("The query option cannot be used with in_pssm") _Ncbiblast2SeqCommandline._validate(self) | def _validate(self): if self.remote and self.in_pssm: raise ValueError("The remote option cannot be used with in_pssm") if self.query and self.in_pssm: raise ValueError("The query option cannot be used with in_pssm") _Ncbiblast2SeqCommandline._validate(self) | 448,162 |
def __getslice__(self, i, j): i = max(i, 0); j = max(j, 0) return Seq(self.data[i:j], self.alphabet) | def __getslice__(self, i, j): i = max(i, 0); j = max(j, 0) return Seq.Seq(self.data[i:j], self.alphabet) | 448,163 |
def _get_column_info_content(self, obs_freq, e_freq_table, log_base, random_expected): """Calculate the information content for a column. | def _get_column_info_content(self, obs_freq, e_freq_table, log_base, random_expected): """Calculate the information content for a column. | 448,164 |
def random_population(genome_alphabet, genome_size, num_organisms, fitness_calculator): """Generate a population of individuals with randomly set genomes. Arguments: o genome_alphabet -- An Alphabet object describing all of the possible letters that could potentially be in the genome of an organism. o genome_size --... | def random_population(genome_alphabet, genome_size, num_organisms, fitness_calculator): """Generate a population of individuals with randomly set genomes. Arguments: o genome_alphabet -- An Alphabet object describing all of the possible letters that could potentially be in the genome of an organism. o genome_size --... | 448,165 |
def get_child_text(parent, tag, construct=unicode): """Find a child node by tag; pass its text through a constructor. Returns None if no matching child is found. """ child = parent.find(_ns(tag)) if child is not None: return child.text and construct(child.text) or None | def get_child_text(parent, tag, construct=unicode): """Find a child node by tag; pass its text through a constructor. Returns None if no matching child is found. """ child = parent.find(_ns(tag)) if child is not None and child.text: return construct(child.text) | 448,166 |
def _split_multi_line(self, text, max_len): "Returns a list of strings.""" #TODO - Do the line spliting while preserving white space? text = text.strip() if len(text) <= max_len: return [text] | def _split_multi_line(self, text, max_len): """Returns a list of strings. Any single words which are too long get returned as a whole line (e.g. URLs) without an exception or warning. """ #TODO - Do the line spliting while preserving white space? text = text.strip() if len(text) <= max_len: return [text] | 448,167 |
def _split_multi_line(self, text, max_len): "Returns a list of strings.""" #TODO - Do the line spliting while preserving white space? text = text.strip() if len(text) <= max_len: return [text] | def _split_multi_line(self, text, max_len): "Returns a list of strings.""" #TODO - Do the line spliting while preserving white space? text = text.strip() if len(text) <= max_len: return [text] | 448,168 |
def _split_multi_line(self, text, max_len): "Returns a list of strings.""" #TODO - Do the line spliting while preserving white space? text = text.strip() if len(text) <= max_len: return [text] | def _split_multi_line(self, text, max_len): "Returns a list of strings.""" #TODO - Do the line spliting while preserving white space? text = text.strip() if len(text) <= max_len: return [text] | 448,169 |
def _split_multi_line(self, text, max_len): "Returns a list of strings.""" #TODO - Do the line spliting while preserving white space? text = text.strip() if len(text) <= max_len: return [text] | def _split_multi_line(self, text, max_len): "Returns a list of strings.""" #TODO - Do the line spliting while preserving white space? text = text.strip() if len(text) <= max_len: return [text] | 448,170 |
def _write_single_line(self, tag, text): "Used in the the 'header' of each GenBank record.""" assert len(tag) < self.HEADER_WIDTH assert len(text) <= self.MAX_WIDTH - self.HEADER_WIDTH, \ "Annotation %s too long for %s line" % (repr(text), tag) self.handle.write("%s%s\n" % (tag.ljust(self.HEADER_WIDTH), text.replace("\... | def _write_single_line(self, tag, text): "Used in the the 'header' of each GenBank record.""" assert len(tag) < self.HEADER_WIDTH if len(text) > self.MAX_WIDTH - self.HEADER_WIDTH: import warnings warnings.warn("Annotation %r too long for %s line" % (text, tag)) self.handle.write("%s%s\n" % (tag.ljust(self.HEADER_WIDTH... | 448,171 |
def check_simple_write_read(records, indent=" "): #print indent+"Checking we can write and then read back these records" for format in test_write_read_alignment_formats: if format not in possible_unknown_seq_formats \ and isinstance(records[0].seq, UnknownSeq) \ and len(records[0].seq) > 100: #Skipping for speed. Some... | def check_simple_write_read(records, indent=" "): #print indent+"Checking we can write and then read back these records" for format in test_write_read_alignment_formats: if format not in possible_unknown_seq_formats \ and isinstance(records[0].seq, UnknownSeq) \ and len(records[0].seq) > 100: #Skipping for speed. Some... | 448,172 |
def check_simple_write_read(records, indent=" "): #print indent+"Checking we can write and then read back these records" for format in test_write_read_alignment_formats: if format not in possible_unknown_seq_formats \ and isinstance(records[0].seq, UnknownSeq) \ and len(records[0].seq) > 100: #Skipping for speed. Some... | defassert record is not None, "Should raise StopIteration not return None" records3.append(record) check_simple_write_read(records,assert record is not None, "Should raise StopIteration not return None" records3.append(record) indent="assert record is not None, "Should raise StopIteration not return None" records3.ap... | 448,173 |
def _to_fasta(self): """ FASTA representation of motif """ if not self.has_instances: self.make_instances_from_counts() str = "" for i,inst in enumerate(self.instances): str = str + "> instance %d\n"%i + inst.tostring() + "\n" return str | def _to_fasta(self): """ FASTA representation of motif """ if not self.has_instances: self.make_instances_from_counts() str = "" for i,inst in enumerate(self.instances): str = str + ">instance%d\n"%i + inst.tostring() + "\n" return str | 448,174 |
def write_nexus_data(self, filename=None, matrix=None, exclude=[], delete=[],\ blocksize=None, interleave=False, interleave_by_partition=False,\ comment=None,omit_NEXUS=False,append_sets=True,mrbayes=False,\ codons_block=True): """Writes a nexus file with data and sets block to a file or handle. | def write_nexus_data(self, filename=None, matrix=None, exclude=[], delete=[],\ blocksize=None, interleave=False, interleave_by_partition=False,\ comment=None,omit_NEXUS=False,append_sets=True,mrbayes=False,\ codons_block=True): """Writes a nexus file with data and sets block to a file or handle. | 448,175 |
def location(self, content): """Parse out location information from the location string. | def cur_feature = self._cur_feature if location_line.startswith("complement("): assert location_line.endswith(")") location_line = location_line[11:-1] cur_feature.strand = -1 if _re_simple_location.match(location_line): s, e = location_line.split("..") cur_feature.location = SeqFeature.FeatureLocation(_pos(s,-1)... | 448,176 |
def location(self, content): """Parse out location information from the location string. | def location(self, content): """Parse out location information from the location string. | 448,177 |
def check_dict_methods(self, rec_dict, keys, ids): self.assertEqual(set(keys), set(rec_dict.keys())) #This is redundant, I just want to make sure len works: self.assertEqual(len(keys), len(rec_dict)) #Make sure boolean evaluation works self.assertEqual(bool(keys), bool(rec_dict)) for key,id in zip(keys, ids): self.asse... | def check_dict_methods(self, rec_dict, keys, ids): self.assertEqual(set(keys), set(rec_dict.keys())) #This is redundant, I just want to make sure len works: self.assertEqual(len(keys), len(rec_dict)) #Make sure boolean evaluation works self.assertEqual(bool(keys), bool(rec_dict)) for key,id in zip(keys, ids): self.asse... | 448,178 |
def check_dict_methods(self, rec_dict, keys, ids): self.assertEqual(set(keys), set(rec_dict.keys())) #This is redundant, I just want to make sure len works: self.assertEqual(len(keys), len(rec_dict)) #Make sure boolean evaluation works self.assertEqual(bool(keys), bool(rec_dict)) for key,id in zip(keys, ids): self.asse... | def check_dict_methods(self, rec_dict, keys, ids): self.assertEqual(set(keys), set(rec_dict.keys())) #This is redundant, I just want to make sure len works: self.assertEqual(len(keys), len(rec_dict)) #Make sure boolean evaluation works self.assertEqual(bool(keys), bool(rec_dict)) for key,id in zip(keys, ids): self.asse... | 448,179 |
def __init__(self, cmd="primersearch", **kwargs): self.parameters = \ [_Option(["-seqall","-sequences","sequences","seqall"], ["input"], None, 1, "Sequence to look for the primer pairs in."), #When this wrapper was written primersearch used -sequences #as the argument name. Since at least EMBOSS 5.0 (and #perhaps earli... | def __init__(self, cmd="primersearch", **kwargs): self.parameters = \ [_Option(["-seqall","-sequences","sequences","seqall"], ["input"], None, 1, "Sequence to look for the primer pairs in."), #When this wrapper was written primersearch used -sequences #as the argument name. Since at least EMBOSS 5.0 (and #perhaps earli... | 448,180 |
def __init__(self, cmd="primersearch", **kwargs): self.parameters = \ [_Option(["-seqall","-sequences","sequences","seqall"], ["input"], None, 1, "Sequence to look for the primer pairs in."), #When this wrapper was written primersearch used -sequences #as the argument name. Since at least EMBOSS 5.0 (and #perhaps earli... | def __init__(self, cmd="primersearch", **kwargs): self.parameters = \ [_Option(["-seqall","-sequences","sequences","seqall"], ["input"], None, 1, "Sequence to look for the primer pairs in."), #When this wrapper was written primersearch used -sequences #as the argument name. Since at least EMBOSS 5.0 (and #perhaps earli... | 448,181 |
def __init__(self, x, y=None, z=None): if y is None and z is None: # Array, list, tuple... if len(x)!=3: raise "Vector: x is not a list/tuple/array of 3 numbers" self._ar=numpy.array(x, 'd') else: # Three numbers self._ar=numpy.array((x, y, z), 'd') | def __init__(self, x, y=None, z=None): if y is None and z is None: # Array, list, tuple... if len(x)!=3: raise ValueError("Vector: x is not a " "list/tuple/array of 3 numbers") self._ar=numpy.array(x, 'd') else: # Three numbers self._ar=numpy.array((x, y, z), 'd') | 448,182 |
def init_pop(): my_pop = [] for i in range(num_loci): my_pop.append({}) return my_pop | def init_pop(): my_pop = [] for i in range(num_loci): my_pop.append({}) return my_pop | 448,183 |
def init_pop(): my_pop = [] for i in range(num_loci): my_pop.append({}) return my_pop | def init_pop(): my_pop = [] for i in range(num_loci): my_pop.append({}) return my_pop | 448,184 |
def _feed_header_lines(self, consumer, lines): EMBL_INDENT = self.HEADER_WIDTH EMBL_SPACER = " " * EMBL_INDENT consumer_dict = { 'AC' : 'accession', 'SV' : 'version', # SV line removed in June 2006, now part of ID line 'DE' : 'definition', #'RN' : 'reference_num', #'RC' : reference comment... TODO #'RP' : 'reference_b... | def _feed_header_lines(self, consumer, lines): EMBL_INDENT = self.HEADER_WIDTH EMBL_SPACER = " " * EMBL_INDENT consumer_dict = { 'AC' : 'accession', 'SV' : 'version', # SV line removed in June 2006, now part of ID line 'DE' : 'definition', #'RN' : 'reference_num', #'RC' : reference comment... TODO #'RP' : 'reference_b... | 448,185 |
def write_nexus_data(self, filename=None, matrix=None, exclude=[], delete=[],\ blocksize=None, interleave=False, interleave_by_partition=False,\ comment=None,omit_NEXUS=False,append_sets=True,mrbayes=False,\ codons_block=True): """Writes a nexus file with data and sets block to a file or handle. | def write_nexus_data(self, filename=None, matrix=None, exclude=[], delete=[],\ blocksize=None, interleave=False, interleave_by_partition=False,\ comment=None,omit_NEXUS=False,append_sets=True,mrbayes=False,\ codons_block=True): """Writes a nexus file with data and sets block to a file or handle. | 448,186 |
def _test(): """Run the Bio.Seq module's doctests.""" print "Running doctests..." import doctest doctest.testmod() print "Done" | def _test(): """Run the Bio.Align.Generic module's doctests.""" print "Running doctests..." import doctest doctest.testmod() print "Done" | 448,187 |
def test_convert(self): """Convert a tree between all supported formats.""" mem_file_1 = StringIO() mem_file_3 = StringIO() if sys.version_info == 3: from io import BytesIO mem_file_2 = BytesIO() else: mem_file_2 = StringIO() Phylo.convert(EX_NEWICK, 'newick', mem_file_1, 'nexus') mem_file_1.seek(0) Phylo.convert(mem_f... | def test_convert(self): """Convert a tree between all supported formats.""" mem_file_1 = StringIO() mem_file_3 = StringIO() if sys.version_info[0] == 3: from io import BytesIO mem_file_2 = BytesIO() else: mem_file_2 = StringIO() Phylo.convert(EX_NEWICK, 'newick', mem_file_1, 'nexus') mem_file_1.seek(0) Phylo.convert(me... | 448,188 |
def add_edge(graph, n1, n2): # NB (1/2010): the networkx API congealed recently # Ubuntu Lucid uses v0.99, newest is v1.0.1, let's support both if networkx.__version__ >= '1.0': graph.add_edge(n1, n2, weight=str(n2.branch_length or 1.0)) # Copy branch color value as hex, if available if hasattr(n2, 'color') and n2.colo... | def add_edge(graph, n1, n2): # NB (1/2010): the networkx API congealed recently # Ubuntu Lucid uses v0.99, newest is v1.0.1, let's support both if networkx.__version__ >= '1.0': graph.add_edge(n1, n2, weight=str(n2.branch_length or 1.0)) # Copy branch color value as hex, if available if hasattr(n2, 'color') and n2.colo... | 448,189 |
def read_block( self, len_expected ): | def read_block( self, len_expected ): | 448,190 |
def read_block( self, len_expected ): | def read_block( self, len_expected ): | 448,191 |
def _make_position(location_string, offset=0): """Turn a Swiss location position into a SeqFeature position object (PRIVATE). An offset of -1 is used with a start location to make it pythonic. """ if location_string=="?": return SeqFeature.UnknownPosition() #Hack so that feature from 0 to 0 becomes 0 to 0, not -1 to 0... | def _make_position(location_string, offset=0): """Turn a Swiss location position into a SeqFeature position object (PRIVATE). An offset of -1 is used with a start location to make it pythonic. """ if location_string=="?": return SeqFeature.UnknownPosition() #Hack so that feature from 0 to 0 becomes 0 to 0, not -1 to 0... | 448,192 |
def _make_seqfeature(name, from_res, to_res, description, ft_id): """Construct SeqFeature from feature data from parser (PRIVATE).""" loc = SeqFeature.FeatureLocation(_make_position(from_res,-1), _make_position(to_res, 0)) if not ft_id: ft_id = "<unknown id>" #The default in SeqFeature object return SeqFeature.SeqFeatu... | def _make_seqfeature(name, from_res, to_res, description, ft_id): """Construct SeqFeature from feature data from parser (PRIVATE).""" loc = SeqFeature.FeatureLocation(_make_position(from_res,-1), _make_position(to_res, 0)) if not ft_id: ft_id = "<unknown id>" #The default in SeqFeature object return SeqFeature.SeqFeatu... | 448,193 |
def _make_seqfeature(name, from_res, to_res, description, ft_id): """Construct SeqFeature from feature data from parser (PRIVATE).""" loc = SeqFeature.FeatureLocation(_make_position(from_res,-1), _make_position(to_res, 0)) if not ft_id: ft_id = "<unknown id>" #The default in SeqFeature object return SeqFeature.SeqFeatu... | def _make_seqfeature(name, from_res, to_res, description, ft_id): """Construct SeqFeature from feature data from parser (PRIVATE).""" loc = SeqFeature.FeatureLocation(_make_position(from_res,-1), _make_position(to_res, 0)) if not ft_id: ft_id = "<unknown id>" #The default in SeqFeature object return SeqFeature.SeqFeatu... | 448,194 |
def is_preterminal(self): """True if all direct descendents are terminal.""" if self.root.is_terminal(): return False for clade in self.clades: if not clade.is_terminal(): return False return True | def is_preterminal(self): """True if all direct descendents are terminal.""" if self.root.is_terminal(): return False for clade in self.root.clades: if not clade.is_terminal(): return False return True | 448,195 |
def test_mast_parser_3(self): """Test if Motif can parse MAST output files (third test) """ from Bio.Alphabet import IUPAC from Bio.Motif.Parsers import MAST handle = open("Motif/mast.protein.tcm.txt") record = MAST.read(handle) self.assertEqual(record.version, "3.0") self.assertEqual(record.database, "farntrans5.s") s... | def test_mast_parser_3(self): """Test if Motif can parse MAST output files (third test) """ from Bio.Alphabet import IUPAC from Bio.Motif.Parsers import MAST handle = open("Motif/mast.protein.tcm.txt") record = MAST.read(handle) self.assertEqual(record.version, "3.0") self.assertEqual(record.database, "farntrans5.s") s... | 448,196 |
def test_train_visible(self): states = ["0", "1", "2", "3"] alphabet = ["A", "C", "G", "T"] training_data = [ ("AACCCGGGTTTTTTT", "001112223333333"), ("ACCGTTTTTTT", "01123333333"), ("ACGGGTTTTTT", "01222333333"), ("ACCGTTTTTTTT", "011233333333"), ] markov_model = MarkovModel.train_visible(states, alphabet, training_da... | def test_train_visible(self): states = ["0", "1", "2", "3"] alphabet = ["A", "C", "G", "T"] training_data = [ ("AACCCGGGTTTTTTT", "001112223333333"), ("ACCGTTTTTTT", "01123333333"), ("ACGGGTTTTTT", "01222333333"), ("ACCGTTTTTTTT", "011233333333"), ] markov_model = MarkovModel.train_visible(states, alphabet, training_da... | 448,197 |
def test_baum_welch(self): states = ["CP", "IP"] alphabet = ["cola", "ice_t", "lem"] outputs = [ (2, 1, 0) ] p_initial = [1.0, 0.0000001] p_transition = [[0.7, 0.3], [0.5, 0.5]] p_emission = [[0.6, 0.1, 0.3], [0.1, 0.7, 0.2]] N, M = len(states), len(alphabet) x = MarkovModel._baum_welch(N, M, outputs, p_initial=p_initi... | def test_baum_welch(self): states = ["CP", "IP"] alphabet = ["cola", "ice_t", "lem"] outputs = [ (2, 1, 0) ] p_initial = [1.0, 0.0000001] p_transition = [[0.7, 0.3], [0.5, 0.5]] p_emission = [[0.6, 0.1, 0.3], [0.1, 0.7, 0.2]] N, M = len(states), len(alphabet) x = MarkovModel._baum_welch(N, M, outputs, p_initial=p_initi... | 448,198 |
def test_baum_welch(self): states = ["CP", "IP"] alphabet = ["cola", "ice_t", "lem"] outputs = [ (2, 1, 0) ] p_initial = [1.0, 0.0000001] p_transition = [[0.7, 0.3], [0.5, 0.5]] p_emission = [[0.6, 0.1, 0.3], [0.1, 0.7, 0.2]] N, M = len(states), len(alphabet) x = MarkovModel._baum_welch(N, M, outputs, p_initial=p_initi... | def test_baum_welch(self): states = ["CP", "IP"] alphabet = ["cola", "ice_t", "lem"] outputs = [ (2, 1, 0) ] p_initial = [1.0, 0.0000001] p_transition = [[0.7, 0.3], [0.5, 0.5]] p_emission = [[0.6, 0.1, 0.3], [0.1, 0.7, 0.2]] N, M = len(states), len(alphabet) x = MarkovModel._baum_welch(N, M, outputs, p_initial=p_initi... | 448,199 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.