Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Open files for CSV reading with universal line mode to handle cross p…

…latform line endings. Thanks to Joshua Elkington
  • Loading branch information...
commit 66bb3cbb7eaf5e67b921a7ea9304b26b3669c9a0 1 parent ea83adf
@chapmanb authored
View
2  distblast/scripts/blast_all_by_all.py
@@ -36,7 +36,7 @@ def main(base_config_file, org_config_file, id_file):
def write_out_matrices(ids, data_out):
base = os.path.splitext(data_out)[0].replace("-data", "")
mat_file = "%s-scores.mat" % base
- with open(data_out) as in_handle:
+ with open(data_out, 'rU') as in_handle:
score_matrix, ident_matrix = get_matrices(in_handle, ids)
io.savemat(mat_file, {"human_scores" : score_matrix,
"human_identities" : ident_matrix,
View
2  distblast/scripts/filter_by_transcript.py
@@ -30,7 +30,7 @@ def filter_file(to_filter, names_to_include):
new_ext = "longtxs"
base, ext = os.path.splitext(to_filter)
out_file = "%s-%s%s" % (base, new_ext, ext)
- with open(to_filter) as in_handle:
+ with open(to_filter, 'rU') as in_handle:
with open(out_file, "w") as out_handle:
reader = csv.reader(in_handle, dialect="excel-tab")
writer = csv.writer(out_handle, dialect="excel-tab")
View
4 distblast/scripts/homolog_seq_retrieval.py
@@ -23,7 +23,7 @@ def main(base_file, org_file, result_file):
os.makedirs(out_dir)
id_list = read_gene_list(org_config['gene_list'])
id_list = _build_alt_tx_res(id_list)
- with open(result_file) as in_handle:
+ with open(result_file, 'rU') as in_handle:
reader = csv.reader(in_handle, dialect='excel-tab')
org_list = reader.next()[1:]
id_indexes = prepare_indexes(org_config['search_file'],
@@ -109,7 +109,7 @@ def read_gene_list(in_file):
"""
genes = []
with open(in_file) as in_handle:
- reader = csv.reader(in_handle)
+ reader = csv.reader(in_handle, 'rU')
reader.next() # header
for parts in reader:
tid = parts[-1]
View
2  distblast/scripts/retrieve_org_dbs.py
@@ -61,7 +61,7 @@ def main(config_file):
out_handle.write("%s\t%s\n" % (org, fname))
def read_org_list(in_file):
- with open(in_file) as in_handle:
+ with open(in_file, 'rU') as in_handle:
reader = csv.reader(in_handle)
orgs = [r[-1] for r in reader]
return orgs
Please sign in to comment.
Something went wrong with that request. Please try again.