# HG changeset patch # User drosofff # Date 1458595957 14400 # Node ID c1ab6747fb6679806809e367b41918dbb3c7e33b # Parent 4c60ceadc414f25c299869e4a86ef5440757e02a planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/sam_to_fastq commit 0651eb8c86d890e4b223fec82ab3980932710030 diff -r 4c60ceadc414 -r c1ab6747fb66 sam_to_fastq.py --- a/sam_to_fastq.py Mon Mar 21 14:40:06 2016 -0400 +++ b/sam_to_fastq.py Mon Mar 21 17:32:37 2016 -0400 @@ -15,18 +15,18 @@ def print_fastq_sequence(samline, file): samfields = samline[:-1].split("\t") - print >> file, '@%s\n%s\n+\n%s' % (samfields[0], samfields[9], samfields[10]) + file.write ( '@%s\n%s\n+\n%s' % (samfields[0], samfields[9], samfields[10]) ) def main(input, output): infile = open (input, "r") outfile = open (output, "w") - for line in infile: - if line[0] == "@": - continue - if line.split("\t")[1] != "4": - print_fastq_sequence (line, outfile) - infile.close() - outfile.close() + with open (input, "r") as infile: + with open (output, "w") as outfile: + for line in infile: + if line[0] == "@": + continue + if line.split("\t")[1] != "4": + print_fastq_sequence (line, outfile) if __name__ == "__main__": args = Parser() diff -r 4c60ceadc414 -r c1ab6747fb66 sam_to_fastq.xml --- a/sam_to_fastq.xml Mon Mar 21 14:40:06 2016 -0400 +++ b/sam_to_fastq.xml Mon Mar 21 17:32:37 2016 -0400 @@ -11,7 +11,7 @@ - +