root / Am1.0 / buildscaffold.py @ 52e54a06
History | View | Annotate | Download (403 Bytes)
1 | 8c368a17 | Daofeng Li | print 'ROOT\tchromosome\t0\nROOT\tcontig\t0' |
---|---|---|---|
2 | 8c368a17 | Daofeng Li | |
3 | 8c368a17 | Daofeng Li | fout=open('longstr','w') |
4 | 8c368a17 | Daofeng Li | |
5 | 8c368a17 | Daofeng Li | with open('chromlen') as fin: |
6 | 8c368a17 | Daofeng Li | for line in fin: |
7 | 8c368a17 | Daofeng Li | lst=line.rstrip().split('\t')
|
8 | 8c368a17 | Daofeng Li | if lst[0].startswith('Scaffold') or lst[0].startswith('scaffold'): |
9 | 8c368a17 | Daofeng Li | print 'chromosome\t{0}\t{1}'.format(lst[0],lst[1]) |
10 | 8c368a17 | Daofeng Li | fout.write(lst[0]+',') |
11 | 8c368a17 | Daofeng Li | else:
|
12 | 8c368a17 | Daofeng Li | print 'contig\t{0}\t{1}'.format(lst[0],lst[1]) |
13 | 8c368a17 | Daofeng Li | fout.write('\n')
|
14 | 8c368a17 | Daofeng Li | fout.close() |
15 | 8c368a17 | Daofeng Li | |
16 | 8c368a17 | Daofeng Li | # sort -k2nr |