Commit c41d2bae authored by Luis Pedro Coelho's avatar Luis Pedro Coelho

Line 85 in metaSNV.py:

Bugfix, add if clause to check header of bam file. Line 31 of src/collapse_coverages.py: Sort strings instead of integers to make the code more general. Now keys can be string or number, when sorting strings we get the same result.
parents e80e4429 ca7ed980
...@@ -82,9 +82,10 @@ def get_header(args): ...@@ -82,9 +82,10 @@ def get_header(args):
line = line.rstrip().split('\t') line = line.rstrip().split('\t')
if len(line) != 3: if len(line) != 3:
continue continue
line[1] = line[1].replace('SN:','') if line[0] == "@SQ":
line[2] = line[2].replace('LN:','') line[1] = line[1].replace('SN:','')
f.write(line[1]+'\t1\t'+line[2]+'\n') line[2] = line[2].replace('LN:','')
f.write(line[1]+'\t1\t'+line[2]+'\n')
f.close() f.close()
args.ctg_len = args.project_dir + '/bed_header' args.ctg_len = args.project_dir + '/bed_header'
...@@ -270,4 +271,3 @@ SOLUTION: make\n\n'''.format(basedir)) ...@@ -270,4 +271,3 @@ SOLUTION: make\n\n'''.format(basedir))
if __name__ == '__main__': if __name__ == '__main__':
main() main()
...@@ -28,7 +28,7 @@ def write_matrix(cov, header, ofile): ...@@ -28,7 +28,7 @@ def write_matrix(cov, header, ofile):
out.write('TaxId\t') out.write('TaxId\t')
out.write('\t'.join([header for _ in bamfiles])) out.write('\t'.join([header for _ in bamfiles]))
out.write('\n') out.write('\n')
for taxid in sorted(avg_cov.keys(), key=int): for taxid in sorted(avg_cov.keys()):
c = cov[taxid] c = cov[taxid]
out.write('{}\t'.format(taxid)) out.write('{}\t'.format(taxid))
out.write('\t'.join([c[bf] for bf in bamfiles])) out.write('\t'.join([c[bf] for bf in bamfiles]))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment