import: made ngsfilter file parsing more resilient and switching to
version 3.0.1b19
This commit is contained in:
@ -48,24 +48,25 @@ def ngsfilterIterator(lineiterator,
|
|||||||
all_lines.insert(0, firstline)
|
all_lines.insert(0, firstline)
|
||||||
|
|
||||||
# Insert header for column names
|
# Insert header for column names
|
||||||
column_names = [b"experiment", b"sample", b"forward_tag", b"reverse_tag", b"forward_primer", b"reverse_primer",b"additional_info"]
|
column_names = [b"experiment", b"sample", b"forward_tag", b"reverse_tag", b"forward_primer", b"reverse_primer"] #,b"additional_info"]
|
||||||
header = out_sep.join(column_names)
|
header = out_sep.join(column_names)
|
||||||
|
|
||||||
new_lines.append(header)
|
new_lines.append(header)
|
||||||
|
|
||||||
for line in all_lines:
|
for line in all_lines:
|
||||||
split_line = line.split(maxsplit=5)
|
split_line = line.split(maxsplit=5)
|
||||||
tags = split_line.pop(2)
|
if split_line:
|
||||||
tags = tags.split(b":")
|
tags = split_line.pop(2)
|
||||||
for t_idx in range(len(tags)):
|
tags = tags.split(b":")
|
||||||
if tags[t_idx]==b"-" or tags[t_idx]==b"None" or tags[t_idx]==b"":
|
for t_idx in range(len(tags)):
|
||||||
tags[t_idx] = nastring
|
if tags[t_idx]==b"-" or tags[t_idx]==b"None" or tags[t_idx]==b"":
|
||||||
if len(tags) == 1: # Forward and reverse tags are the same
|
tags[t_idx] = nastring
|
||||||
tags.append(tags[0])
|
if len(tags) == 1: # Forward and reverse tags are the same
|
||||||
split_line.insert(2, tags[0])
|
tags.append(tags[0])
|
||||||
split_line.insert(3, tags[1])
|
split_line.insert(2, tags[0])
|
||||||
new_lines.append(out_sep.join(split_line[0:7]))
|
split_line.insert(3, tags[1])
|
||||||
|
new_lines.append(out_sep.join(split_line[0:6]))
|
||||||
|
|
||||||
return tabIterator(iter(new_lines),
|
return tabIterator(iter(new_lines),
|
||||||
header = True,
|
header = True,
|
||||||
sep = out_sep,
|
sep = out_sep,
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
major = 3
|
major = 3
|
||||||
minor = 0
|
minor = 0
|
||||||
serial= '1b18'
|
serial= '1b19'
|
||||||
|
|
||||||
version ="%d.%d.%s" % (major,minor,serial)
|
version ="%d.%d.%s" % (major,minor,serial)
|
||||||
|
Reference in New Issue
Block a user