203ed6d1fda8de579c2bf311e5890dca05c14985,cnvlib/target.py,,shorten_labels,#Any#,185
Before Change
curr_gene_coords = []
for row in interval_rows:
next_coords = row[:-1]
next_names = set(row[-1].rstrip().split(","))
assert len(next_names)
overlap = curr_names.intersection(next_names)
if overlap:
// Continuing the same gene; update shared accessions
curr_names = filter_names(overlap)
curr_gene_coords.append(next_coords)
else:
// End of the old gene -- emit coords + shared name(s)
for coords in curr_gene_coords:
out_row = emit(coords, curr_names)
yield out_row
longest_name_len = max(longest_name_len, len(out_row[-1]))
// Start of a new gene
curr_gene_coords = [next_coords]
curr_names = next_names
// Final emission
for coords in curr_gene_coords:
out_row = emit(coords, curr_names)
yield out_row
longest_name_len = max(longest_name_len, len(out_row[-1]))
logging.info("Longest name length: %d", longest_name_len)
def filter_names(names, exclude=("mRNA",)):
After Change
else:
// End of the old gene -- emit shared name(s)
for _i in range(curr_gene_count):
out_name = shortest_name(curr_names)
yield out_name
longest_name_len = max(longest_name_len, len(out_name))
// Start of a new gene
curr_gene_count = 1
curr_names = next_names
// Final emission
for _i in range(curr_gene_count):
out_name = shortest_name(curr_names)
yield out_name
longest_name_len = max(longest_name_len, len(out_name))
logging.info("Longest name length: %d", longest_name_len)
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 10
Instances
Project Name: etal/cnvkit
Commit Name: 203ed6d1fda8de579c2bf311e5890dca05c14985
Time: 2016-12-10
Author: eric.talevich@gmail.com
File Name: cnvlib/target.py
Class Name:
Method Name: shorten_labels
Project Name: RaRe-Technologies/gensim
Commit Name: 2e07c2d2743bc80fe0a2b9c8ec5a8460b2f5d6dd
Time: 2010-03-12
Author: radimrehurek@seznam.cz
File Name: src/gensim/corpora/bleicorpus.py
Class Name: BleiCorpus
Method Name: saveCorpus
Project Name: RaRe-Technologies/gensim
Commit Name: 2299d6fb7437903bf421884c0191c38d59d06f7b
Time: 2010-03-12
Author: piskvorky@92d0401f-a546-4972-9173-107b360ed7e5
File Name: src/gensim/corpora/bleicorpus.py
Class Name: BleiCorpus
Method Name: saveCorpus