Mercurial > repos > yating-l > jbrowse_hub
comparison jbrowse_hub.py @ 26:a4a54b925c73 draft
planemo upload for repository https://github.com/Yating-L/jbrowse_hub commit e81fecac281f299db00cfc88a068e056b031ae9d-dirty
author | yating-l |
---|---|
date | Wed, 15 Mar 2017 10:51:23 -0400 |
parents | f2285f29a6fa |
children | 5580dbf2a31c |
comparison
equal
deleted
inserted
replaced
25:55c62db02917 | 26:a4a54b925c73 |
---|---|
81 array_inputs_gff3_mrna = args.gff3_mrna | 81 array_inputs_gff3_mrna = args.gff3_mrna |
82 array_inputs_gtf = args.gtf | 82 array_inputs_gtf = args.gtf |
83 array_inputs_blastxml = args.blastxml | 83 array_inputs_blastxml = args.blastxml |
84 if array_inputs_bam: | 84 if array_inputs_bam: |
85 all_datatype_dictionary['bam'] = array_inputs_bam | 85 all_datatype_dictionary['bam'] = array_inputs_bam |
86 if array_inputs_bai: | |
87 all_datatype_dictionary['bai'] = array_inputs_bai | |
88 if array_inputs_bed_simple_repeats: | 86 if array_inputs_bed_simple_repeats: |
89 all_datatype_dictionary['bedSimpleRepeats'] = array_inputs_bed_simple_repeats | 87 all_datatype_dictionary['bedSimpleRepeats'] = array_inputs_bed_simple_repeats |
90 if array_inputs_bed_splice_junctions: | 88 if array_inputs_bed_splice_junctions: |
91 all_datatype_dictionary['bedSpliceJunctions'] = array_inputs_bed_splice_junctions | 89 all_datatype_dictionary['bedSpliceJunctions'] = array_inputs_bed_splice_junctions |
92 if array_inputs_bigwig: | 90 if array_inputs_bigwig: |
113 all_tracks.addToRaw(f, datatype) | 111 all_tracks.addToRaw(f, datatype) |
114 | 112 |
115 jbrowseHub = TrackHub.TrackHub(all_tracks, reference, out_path, tool_directory, genome, extra_files_path) | 113 jbrowseHub = TrackHub.TrackHub(all_tracks, reference, out_path, tool_directory, genome, extra_files_path) |
116 jbrowseHub.createHub() | 114 jbrowseHub.createHub() |
117 | 115 |
118 | |
119 | |
120 ''' | |
121 if reference: | |
122 p = subprocess.Popen(['JBrowse-1.12.1/bin/prepare-refseqs.pl', '--fasta', reference, '--out', out_path]) | |
123 # Wait for process to terminate. | |
124 p.communicate() | |
125 else: | |
126 parser.print_help() | |
127 | |
128 | |
129 if input_simple_repeats: | |
130 bedToGff3(input_simple_repeats, chrom_size, 'trfbig', 'repeats.gff3') | |
131 label = "repeats" | |
132 p = subprocess.Popen(['JBrowse-1.12.1/bin/flatfile-to-json.pl', '--gff', 'repeats.gff3', '--trackType', 'CanvasFeatures', '--trackLabel', label, '--out', out_path]) | |
133 p.communicate() | |
134 if input_splice_junctions: | |
135 bedToGff3(input_splice_junctions, chrom_size, 'regtools', 'regtools.gff3') | |
136 label = "regtools" | |
137 p = subprocess.Popen(['JBrowse-1.12.1/bin/flatfile-to-json.pl', '--gff', 'regtools.gff3', '--trackType', 'CanvasFeatures', '--trackLabel', label, '--out', out_path]) | |
138 p.communicate() | |
139 attr = dict() | |
140 track = dict() | |
141 attr['glyph'] = 'JBrowse/View/FeatureGlyph/Segments' | |
142 track['regtools'] = attr | |
143 json_file = os.path.join(out_path, "trackList.json") | |
144 utils.add_tracks_to_json(json_file, track, 'add_attr') | |
145 if blastxml: | |
146 blastxmlToGff3.blastxml2gff3(blastxml, "blast.gff3") | |
147 label = "blast" | |
148 p = subprocess.Popen(['JBrowse-1.12.1/bin/flatfile-to-json.pl', '--gff', 'blast.gff3', '--trackType', 'CanvasFeatures', '--trackLabel', label, '--out', out_path]) | |
149 p.communicate() | |
150 if array_inputs_gff3: | |
151 for gff3 in array_inputs_gff3: | |
152 label = os.path.basename(gff3) | |
153 label = label.replace('.', '_') | |
154 p = subprocess.Popen(['JBrowse-1.12.1/bin/flatfile-to-json.pl', '--gff', gff3, '--trackType', 'CanvasFeatures', '--trackLabel', label, '--out', out_path]) | |
155 p.communicate() | |
156 if 'Augustus' in label: | |
157 attr = dict() | |
158 track = dict() | |
159 attr['transcriptType'] = 'transcript' | |
160 track['Augustus'] = attr | |
161 json_file = os.path.join(out_path, "trackList.json") | |
162 utils.add_tracks_to_json(json_file, track, 'add_attr') | |
163 if bam: | |
164 json_file = os.path.join(out_path, "trackList.json") | |
165 bam_track = dict() | |
166 bam_track['type'] = 'JBrowse/View/Track/Alignments2' | |
167 bam_track['label'] = 'alignments' | |
168 bam_track['urlTemplate'] = '../raw/HISAT_on_data_3,_data_2,_and_data_1.bam' | |
169 utils.add_tracks_to_json(json_file, bam_track, 'add_tracks') | |
170 print "add bam track\n" | |
171 if bigwig: | |
172 json_file = os.path.join(out_path, "trackList.json") | |
173 bigwig_track = dict() | |
174 bigwig_track['label'] = 'rnaseq' | |
175 bigwig_track['key'] = 'RNA-Seq Coverage' | |
176 bigwig_track['urlTemplate'] = '../raw/Convert_Bam_to_BigWig_on_data_3_and_data_15.bigwig' | |
177 bigwig_track['type'] = 'JBrowse/View/Track/Wiggle/XYPlot' | |
178 bigwig_track['variance_band'] = True | |
179 bigwig_track['style'] = dict() | |
180 bigwig_track['style']['pos_color'] = '#FFA600' | |
181 bigwig_track['style']['neg_color'] = '#005EFF' | |
182 bigwig_track['style']['clip_marker_color'] = 'red' | |
183 bigwig_track['style']['height'] = 100 | |
184 utils.add_tracks_to_json(json_file, bigwig_track, 'add_tracks') | |
185 | |
186 if gtf: | |
187 utils.gtfToGff3(gtf, 'stringtie.gff3', chrom_size) | |
188 label = os.path.basename('stringtie') | |
189 p = subprocess.Popen(['JBrowse-1.12.1/bin/flatfile-to-json.pl', '--gff', 'stringtie.gff3', '--trackType', 'CanvasFeatures', '--trackLabel', label, '--out', out_path]) | |
190 p.communicate() | |
191 attr = dict() | |
192 track = dict() | |
193 attr['glyph'] = 'JBrowse/View/FeatureGlyph/Segments' | |
194 track['stringtie'] = attr | |
195 json_file = os.path.join(out_path, "trackList.json") | |
196 utils.add_tracks_to_json(json_file, track, 'add_attr') | |
197 | |
198 # Index name, it takes a long time, exclude it for now | |
199 p = subprocess.Popen(['JBrowse-1.12.1/bin/generate-names.pl', '-v', '--out', out_path]) | |
200 p.communicate() | |
201 print "finished name index \n" | |
202 ''' | |
203 | 116 |
204 if __name__ == "__main__": | 117 if __name__ == "__main__": |
205 main(sys.argv) | 118 main(sys.argv) |
206 | 119 |