comparison tabular_to_fastq.py @ 4:2dcfbbf9071a draft

"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/galaxy_sequence_utils/tabular_to_fastq commit d4ced60a941c4c4a2fe95de9c09a10086810b387"
author iuc
date Wed, 19 Feb 2020 12:59:28 -0500
parents b8cdc0507586
children
comparison
equal deleted inserted replaced
3:68f57cc8fad0 4:2dcfbbf9071a
12 quality_col = int(sys.argv[5]) - 1 12 quality_col = int(sys.argv[5]) - 1
13 13
14 max_col = max(identifier_col, sequence_col, quality_col) 14 max_col = max(identifier_col, sequence_col, quality_col)
15 num_reads = None 15 num_reads = None
16 skipped_lines = 0 16 skipped_lines = 0
17 out = open(output_filename, 'w') 17 with open(output_filename, 'w') as out:
18 for num_reads, line in enumerate(open(input_filename)): 18 for num_reads, line in enumerate(open(input_filename)):
19 fields = line.rstrip('\n\r').split('\t') 19 fields = line.rstrip('\n\r').split('\t')
20 if len(fields) > max_col: 20 if len(fields) > max_col:
21 out.write("@%s\n%s\n+\n%s\n" % (fields[identifier_col], fields[sequence_col], fields[quality_col])) 21 out.write("@%s\n%s\n+\n%s\n" % (fields[identifier_col], fields[sequence_col], fields[quality_col]))
22 else: 22 else:
23 skipped_lines += 1 23 skipped_lines += 1
24 24
25 out.close()
26 if num_reads is None: 25 if num_reads is None:
27 print("Input was empty.") 26 print("Input was empty.")
28 else: 27 else:
29 print("%i tabular lines were written as FASTQ reads. Be sure to use the FASTQ Groomer tool on this output before further analysis." % (num_reads + 1 - skipped_lines)) 28 print("%i tabular lines were written as FASTQ reads. Be sure to use the FASTQ Groomer tool on this output before further analysis." % (num_reads + 1 - skipped_lines))
30 29