root/galaxy-central/lib/galaxy/datatypes/converters/vcf_to_summary_tree_converter.py @ 2

リビジョン 2, 0.8 KB (コミッタ: hatakeyama, 14 年 前)

import galaxy-central

行番号 
1#!/usr/bin/env python
2
3"""
4Convert from VCF file to summary tree file.
5
6usage: %prog in_file out_file
7"""
8from __future__ import division
9
10import optparse
11import galaxy_utils.sequence.vcf
12from galaxy.visualization.tracks.summary import SummaryTree
13
14def main():
15    # Read options, args.
16    parser = optparse.OptionParser()
17    (options, args) = parser.parse_args()
18    in_file, out_file = args
19       
20    # Do conversion.
21    st = SummaryTree(block_size=25, levels=6, draw_cutoff=150, detail_cutoff=30)
22    for line in list( galaxy_utils.sequence.vcf.Reader( open( in_file ) ) ):
23        # VCF format provides a chrom and 1-based position for each variant.
24        # SummaryTree expects 0-based coordinates.
25        st.insert_range( line.chrom, long( line.pos-1 ), long( line.pos ) )
26   
27    st.write(out_file)
28
29if __name__ == "__main__":
30    main()
Note: リポジトリブラウザについてのヘルプは TracBrowser を参照してください。