Mercurial > repos > dfornika > match_plasmid_to_reference
comparison match_plasmid_to_reference.py @ 1:3616b6eda1da draft
"planemo upload for repository https://github.com/dfornika/galaxy/tree/master/tools/match_plasmid_to_reference commit dcdac86bce5c44043516fbd472ab7c19d7bf4d50-dirty"
author | dfornika |
---|---|
date | Wed, 06 Nov 2019 00:42:05 -0500 |
parents | 8bb674372911 |
children | 826ddf832bef |
comparison
equal
deleted
inserted
replaced
0:8bb674372911 | 1:3616b6eda1da |
---|---|
63 # break while statement if it is not a comment line | 63 # break while statement if it is not a comment line |
64 # i.e. does not startwith # | 64 # i.e. does not startwith # |
65 if line.startswith('ACCESSION'): | 65 if line.startswith('ACCESSION'): |
66 return line.strip().split()[1] | 66 return line.strip().split()[1] |
67 | 67 |
68 | |
69 | 68 |
70 def count_contigs(plasmid_fasta_path): | 69 def count_contigs(plasmid_fasta_path): |
71 contigs = 0 | 70 contigs = 0 |
72 with open(plasmid_fasta_path, 'r') as f: | 71 with open(plasmid_fasta_path, 'r') as f: |
73 contigs = 2 | 72 for line in f: |
73 if line.startswith('>'): | |
74 contigs += 1 | |
74 return contigs | 75 return contigs |
75 | 76 |
76 def count_bases(plasmid_fasta_path): | 77 def count_bases(plasmid_fasta_path): |
77 bases = 0 | 78 bases = 0 |
78 with open(plasmid_fasta_path, 'r') as f: | 79 with open(plasmid_fasta_path, 'r') as f: |
79 bases = 11117 | 80 for line in f: |
81 line = line.strip() | |
82 if not line.startswith('>'): | |
83 bases += len(line) | |
80 return bases | 84 return bases |
81 | 85 |
82 def main(args): | 86 def main(args): |
83 # create output directory | 87 # create output directory |
84 try: | 88 try: |