Mercurial > repos > jackcurragh > ribogalaxy_get_chrom_sizes
diff get_chrom_sizes/calculating_chrom.sizes.py @ 3:cfdf764b9226 draft
Uploaded
author | jackcurragh |
---|---|
date | Thu, 21 Apr 2022 10:39:18 +0000 |
parents | 27f3669eda60 |
children | c6a297d05c8e |
line wrap: on
line diff
--- a/get_chrom_sizes/calculating_chrom.sizes.py Wed Apr 20 15:20:33 2022 +0000 +++ b/get_chrom_sizes/calculating_chrom.sizes.py Thu Apr 21 10:39:18 2022 +0000 @@ -3,7 +3,8 @@ from sys import argv # python calculating_chrom.sizes.py genome_input.fa output.chrom.sizes genome = str(argv[1]) -output = str(argv[2]) +prefix = str(argv[2]) +output = str(argv[3]) # genome = 'test-data/test.fasta' # output = "test-data/test_chrom.sizes" @@ -20,9 +21,12 @@ else: sequence = line.strip('\n') record[1] += len(sequence) - + +if record not in records: + records.append(record) + for seq_record in records: - output_line = '%s\t%i\n' % (seq_record[0], seq_record[1]) + output_line = f"{prefix}{seq_record[0]}\t{seq_record[1]}\n" chromSizesoutput.write(output_line) chromSizesoutput.close()