1 | import galaxy.model |
---|
2 | from galaxy.model.orm import * |
---|
3 | from galaxy.model.mapping import context as sa_session |
---|
4 | from base.twilltestcase import TwillTestCase |
---|
5 | from base.test_db_util import * |
---|
6 | |
---|
7 | class UploadData( TwillTestCase ): |
---|
8 | def test_0000_setup_upload_tests( self ): |
---|
9 | """Configuring upload tests, setting admin_user""" |
---|
10 | self.logout() |
---|
11 | self.login( email='test@bx.psu.edu' ) |
---|
12 | global admin_user |
---|
13 | admin_user = get_user( email='test@bx.psu.edu' ) |
---|
14 | def test_0005_upload_file( self ): |
---|
15 | """Test uploading 1.bed, NOT setting the file format""" |
---|
16 | history = get_latest_history_for_user( admin_user ) |
---|
17 | self.upload_file( '1.bed' ) |
---|
18 | hda = get_latest_hda() |
---|
19 | assert hda is not None, "Problem retrieving hda from database" |
---|
20 | self.verify_dataset_correctness( '1.bed', hid=str( hda.hid ) ) |
---|
21 | self.check_history_for_string( "<th>1.Chrom</th><th>2.Start</th><th>3.End</th>" ) |
---|
22 | self.delete_history( id=self.security.encode_id( history.id ) ) |
---|
23 | def test_0006_upload_file( self ): |
---|
24 | """Test uploading 1.bed.spaces, with space to tab selected, NOT setting the file format""" |
---|
25 | history = get_latest_history_for_user( admin_user ) |
---|
26 | self.upload_file( '1.bed.spaces', space_to_tab = True ) |
---|
27 | hda = get_latest_hda() |
---|
28 | assert hda is not None, "Problem retrieving hda from database" |
---|
29 | self.verify_dataset_correctness( '1.bed', hid=str( hda.hid ) ) |
---|
30 | self.check_history_for_string( "<th>1.Chrom</th><th>2.Start</th><th>3.End</th>" ) |
---|
31 | self.delete_history( id=self.security.encode_id( history.id ) ) |
---|
32 | def test_0010_upload_file( self ): |
---|
33 | """Test uploading 4.bed.gz, manually setting the file format""" |
---|
34 | self.check_history_for_string( 'Your history is empty' ) |
---|
35 | history = get_latest_history_for_user( admin_user ) |
---|
36 | self.upload_file( '4.bed.gz', dbkey='hg17', ftype='bed' ) |
---|
37 | hda = get_latest_hda() |
---|
38 | assert hda is not None, "Problem retrieving hda from database" |
---|
39 | self.verify_dataset_correctness( '4.bed', hid=str( hda.hid ) ) |
---|
40 | self.check_history_for_string( "<th>1.Chrom</th><th>2.Start</th><th>3.End</th>" ) |
---|
41 | self.delete_history( id=self.security.encode_id( history.id ) ) |
---|
42 | def test_0012_upload_file( self ): |
---|
43 | """Test uploading 4.bed.bz2, manually setting the file format""" |
---|
44 | self.check_history_for_string( 'Your history is empty' ) |
---|
45 | history = get_latest_history_for_user( admin_user ) |
---|
46 | self.upload_file( '4.bed.bz2', dbkey='hg17', ftype='bed' ) |
---|
47 | hda = get_latest_hda() |
---|
48 | assert hda is not None, "Problem retrieving hda from database" |
---|
49 | self.verify_dataset_correctness( '4.bed', hid=str( hda.hid ) ) |
---|
50 | self.check_history_for_string( "<th>1.Chrom</th><th>2.Start</th><th>3.End</th>" ) |
---|
51 | self.delete_history( id=self.security.encode_id( history.id ) ) |
---|
52 | def test_0015_upload_file( self ): |
---|
53 | """Test uploading 1.scf, manually setting the file format""" |
---|
54 | self.check_history_for_string( 'Your history is empty' ) |
---|
55 | history = get_latest_history_for_user( admin_user ) |
---|
56 | self.upload_file( '1.scf', ftype='scf' ) |
---|
57 | hda = get_latest_hda() |
---|
58 | assert hda is not None, "Problem retrieving hda from database" |
---|
59 | self.verify_dataset_correctness( '1.scf', hid=str( hda.hid ) ) |
---|
60 | self.check_history_for_string( "Binary scf sequence file</pre>" ) |
---|
61 | self.delete_history( id=self.security.encode_id( history.id ) ) |
---|
62 | def test_0020_upload_file( self ): |
---|
63 | """Test uploading 1.scf, NOT setting the file format""" |
---|
64 | self.check_history_for_string( 'Your history is empty' ) |
---|
65 | history = get_latest_history_for_user( admin_user ) |
---|
66 | self.upload_file( '1.scf' ) |
---|
67 | hda = get_latest_hda() |
---|
68 | assert hda is not None, "Problem retrieving hda from database" |
---|
69 | self.check_history_for_string( "File Format' to 'Scf' when uploading scf files" ) |
---|
70 | self.delete_history( id=self.security.encode_id( history.id ) ) |
---|
71 | def test_0025_upload_file( self ): |
---|
72 | """Test uploading 4.bed.zip, manually setting the file format""" |
---|
73 | self.check_history_for_string( 'Your history is empty' ) |
---|
74 | history = get_latest_history_for_user( admin_user ) |
---|
75 | self.upload_file( '4.bed.zip', ftype='bed' ) |
---|
76 | hda = get_latest_hda() |
---|
77 | assert hda is not None, "Problem retrieving hda from database" |
---|
78 | self.verify_dataset_correctness( '4.bed', hid=str( hda.hid ) ) |
---|
79 | self.check_history_for_string( "<th>1.Chrom</th><th>2.Start</th><th>3.End</th>" ) |
---|
80 | self.delete_history( id=self.security.encode_id( history.id ) ) |
---|
81 | def test_0030_upload_file( self ): |
---|
82 | """Test uploading 4.bed.zip, NOT setting the file format""" |
---|
83 | self.check_history_for_string( 'Your history is empty' ) |
---|
84 | history = get_latest_history_for_user( admin_user ) |
---|
85 | self.upload_file( '4.bed.zip' ) |
---|
86 | hda = get_latest_hda() |
---|
87 | assert hda is not None, "Problem retrieving hda from database" |
---|
88 | self.verify_dataset_correctness( '4.bed', hid=str( hda.hid ) ) |
---|
89 | self.check_history_for_string( "<th>1.Chrom</th><th>2.Start</th><th>3.End</th>" ) |
---|
90 | self.delete_history( id=self.security.encode_id( history.id ) ) |
---|
91 | def test_0035_upload_file( self ): |
---|
92 | """Test uploading 1.sam NOT setting the file format""" |
---|
93 | self.check_history_for_string( 'Your history is empty' ) |
---|
94 | history = get_latest_history_for_user( admin_user ) |
---|
95 | self.upload_file( '1.sam' ) |
---|
96 | hda = get_latest_hda() |
---|
97 | assert hda is not None, "Problem retrieving hda from database" |
---|
98 | self.verify_dataset_correctness( '1.sam', hid=str( hda.hid ) ) |
---|
99 | self.check_history_for_string( "<th>1.QNAME</th><th>2.FLAG</th><th>3.RNAME</th><th>4.POS</th>" ) |
---|
100 | self.delete_history( id=self.security.encode_id( history.id ) ) |
---|
101 | def test_0040_upload_file( self ): |
---|
102 | """Test uploading 1.sff, NOT setting the file format""" |
---|
103 | self.check_history_for_string( 'Your history is empty' ) |
---|
104 | history = get_latest_history_for_user( admin_user ) |
---|
105 | self.upload_file( '1.sff' ) |
---|
106 | hda = get_latest_hda() |
---|
107 | assert hda is not None, "Problem retrieving hda from database" |
---|
108 | self.verify_dataset_correctness( '1.sff', hid=str( hda.hid ) ) |
---|
109 | self.check_history_for_string( 'format: <span class="sff">sff' ) |
---|
110 | self.delete_history( id=self.security.encode_id( history.id ) ) |
---|
111 | def test_0045_upload_file( self ): |
---|
112 | """Test uploading 454Score.pdf, NOT setting the file format""" |
---|
113 | self.check_history_for_string( 'Your history is empty' ) |
---|
114 | history = get_latest_history_for_user( admin_user ) |
---|
115 | self.upload_file( '454Score.pdf' ) |
---|
116 | hda = get_latest_hda() |
---|
117 | assert hda is not None, "Problem retrieving hda from database" |
---|
118 | self.check_history_for_string( "1: 454Score.pdf</span>" ) |
---|
119 | self.delete_history( id=self.security.encode_id( history.id ) ) |
---|
120 | def test_0050_upload_file( self ): |
---|
121 | """Test uploading 454Score.png, NOT setting the file format""" |
---|
122 | self.check_history_for_string( 'Your history is empty' ) |
---|
123 | history = get_latest_history_for_user( admin_user ) |
---|
124 | self.upload_file( '454Score.png' ) |
---|
125 | hda = get_latest_hda() |
---|
126 | assert hda is not None, "Problem retrieving hda from database" |
---|
127 | self.check_history_for_string( "The uploaded file contains inappropriate content" ) |
---|
128 | def test_0055_upload_file( self ): |
---|
129 | """Test uploading lped composite datatype file, manually setting the file format""" |
---|
130 | # Logged in as admin_user |
---|
131 | self.check_history_for_string( 'Your history is empty' ) |
---|
132 | history = get_latest_history_for_user( admin_user ) |
---|
133 | # lped data types include a ped_file and a map_file ( which is binary ) |
---|
134 | self.upload_file( None, ftype='lped', metadata = [ { 'name':'base_name', 'value':'rgenetics' } ], composite_data = [ { 'name':'ped_file', 'value':'tinywga.ped' }, { 'name':'map_file', 'value':'tinywga.map'} ] ) |
---|
135 | # Get the latest hid for testing |
---|
136 | hda = get_latest_hda() |
---|
137 | assert hda is not None, "Problem retrieving hda from database" |
---|
138 | # We'll test against the resulting ped file and map file for correctness |
---|
139 | self.verify_composite_datatype_file_content( 'tinywga.ped', str( hda.id ), base_name = 'rgenetics.ped' ) |
---|
140 | self.verify_composite_datatype_file_content( 'tinywga.map', str( hda.id ), base_name = 'rgenetics.map' ) |
---|
141 | self.check_history_for_string( "rgenetics" ) |
---|
142 | self.delete_history( id=self.security.encode_id( history.id ) ) |
---|
143 | def test_0056_upload_file( self ): |
---|
144 | """Test uploading lped composite datatype file, manually setting the file format, and using space to tab on one file (tinywga.ped)""" |
---|
145 | # Logged in as admin_user |
---|
146 | self.check_history_for_string( 'Your history is empty' ) |
---|
147 | history = get_latest_history_for_user( admin_user ) |
---|
148 | # lped data types include a ped_file and a map_file ( which is binary ) |
---|
149 | self.upload_file( None, ftype='lped', metadata = [ { 'name':'base_name', 'value':'rgenetics' } ], composite_data = [ { 'name':'ped_file', 'value':'tinywga.ped', 'space_to_tab':True }, { 'name':'map_file', 'value':'tinywga.map'} ] ) |
---|
150 | # Get the latest hid for testing |
---|
151 | hda = get_latest_hda() |
---|
152 | assert hda is not None, "Problem retrieving hda from database" |
---|
153 | # We'll test against the resulting ped file and map file for correctness |
---|
154 | self.verify_composite_datatype_file_content( 'tinywga.ped.space_to_tab', str( hda.id ), base_name = 'rgenetics.ped' ) |
---|
155 | self.verify_composite_datatype_file_content( 'tinywga.map', str( hda.id ), base_name = 'rgenetics.map' ) |
---|
156 | self.check_history_for_string( "rgenetics" ) |
---|
157 | self.delete_history( id=self.security.encode_id( history.id ) ) |
---|
158 | def test_0060_upload_file( self ): |
---|
159 | """Test uploading pbed composite datatype file, manually setting the file format""" |
---|
160 | # Logged in as admin_user |
---|
161 | self.check_history_for_string( 'Your history is empty' ) |
---|
162 | history = get_latest_history_for_user( admin_user ) |
---|
163 | # pbed data types include a bim_file, a bed_file and a fam_file |
---|
164 | self.upload_file( None, ftype='pbed', metadata = [ { 'name':'base_name', 'value':'rgenetics' } ], composite_data = [ { 'name':'bim_file', 'value':'tinywga.bim' }, { 'name':'bed_file', 'value':'tinywga.bed'}, { 'name':'fam_file', 'value':'tinywga.fam' } ] ) |
---|
165 | # Get the latest hid for testing |
---|
166 | hda = get_latest_hda() |
---|
167 | assert hda is not None, "Problem retrieving hda from database" |
---|
168 | # We'll test against the resulting ped file and map file for correctness |
---|
169 | self.verify_composite_datatype_file_content( 'tinywga.bim', str( hda.id ), base_name = 'rgenetics.bim' ) |
---|
170 | self.verify_composite_datatype_file_content( 'tinywga.bed', str( hda.id ), base_name = 'rgenetics.bed' ) |
---|
171 | self.verify_composite_datatype_file_content( 'tinywga.fam', str( hda.id ), base_name = 'rgenetics.fam' ) |
---|
172 | self.check_history_for_string( "rgenetics" ) |
---|
173 | self.delete_history( id=self.security.encode_id( history.id ) ) |
---|
174 | def test_0065_upload_file( self ): |
---|
175 | """Test uploading asian_chars_1.txt, NOT setting the file format""" |
---|
176 | # Logged in as admin_user |
---|
177 | self.check_history_for_string( 'Your history is empty' ) |
---|
178 | history = get_latest_history_for_user( admin_user ) |
---|
179 | self.upload_file( 'asian_chars_1.txt' ) |
---|
180 | hda = get_latest_hda() |
---|
181 | assert hda is not None, "Problem retrieving hda from database" |
---|
182 | self.verify_dataset_correctness( 'asian_chars_1.txt', hid=str( hda.hid ) ) |
---|
183 | self.check_history_for_string( 'uploaded multi-byte char file' ) |
---|
184 | self.delete_history( id=self.security.encode_id( history.id ) ) |
---|
185 | def test_0070_upload_file( self ): |
---|
186 | """Test uploading 2gen.fastq, NOT setting the file format""" |
---|
187 | # Logged in as admin_user |
---|
188 | self.check_history_for_string( 'Your history is empty' ) |
---|
189 | history = get_latest_history_for_user( admin_user ) |
---|
190 | self.upload_file( '2gen.fastq' ) |
---|
191 | hda = get_latest_hda() |
---|
192 | assert hda is not None, "Problem retrieving hda from database" |
---|
193 | self.verify_dataset_correctness( '2gen.fastq', hid=str( hda.hid ) ) |
---|
194 | self.check_history_for_string( '2gen.fastq format: <span class="fastq">fastq</span>, database: \? Info: uploaded fastq file' ) |
---|
195 | self.delete_history( id=self.security.encode_id( history.id ) ) |
---|
196 | def test_0075_upload_file( self ): |
---|
197 | """Test uploading 1.wig, NOT setting the file format""" |
---|
198 | # Logged in as admin_user |
---|
199 | self.check_history_for_string( 'Your history is empty' ) |
---|
200 | history = get_latest_history_for_user( admin_user ) |
---|
201 | self.upload_file( '1.wig' ) |
---|
202 | hda = get_latest_hda() |
---|
203 | assert hda is not None, "Problem retrieving hda from database" |
---|
204 | self.verify_dataset_correctness( '1.wig', hid=str( hda.hid ) ) |
---|
205 | self.check_history_for_string( '1.wig format: <span class="wig">wig</span>, database: \? Info: uploaded file' ) |
---|
206 | self.check_metadata_for_string( 'value="1.wig" value="\?"' ) |
---|
207 | self.check_metadata_for_string( 'Change data type selected value="wig" selected="yes"' ) |
---|
208 | self.delete_history( id=self.security.encode_id( history.id ) ) |
---|
209 | def test_0080_upload_file( self ): |
---|
210 | """Test uploading 1.tabular, NOT setting the file format""" |
---|
211 | # Logged in as admin_user |
---|
212 | self.check_history_for_string( 'Your history is empty' ) |
---|
213 | history = get_latest_history_for_user( admin_user ) |
---|
214 | self.upload_file( '1.tabular' ) |
---|
215 | hda = get_latest_hda() |
---|
216 | assert hda is not None, "Problem retrieving hda from database" |
---|
217 | self.verify_dataset_correctness( '1.tabular', hid=str( hda.hid ) ) |
---|
218 | self.check_history_for_string( '1.tabular format: <span class="tabular">tabular</span>, database: \? Info: uploaded file' ) |
---|
219 | self.check_metadata_for_string( 'value="1.tabular" value="\?"' ) |
---|
220 | self.check_metadata_for_string( 'Change data type selected value="tabular" selected="yes"' ) |
---|
221 | self.delete_history( id=self.security.encode_id( history.id ) ) |
---|
222 | def test_0085_upload_file( self ): |
---|
223 | """Test uploading qualscores.qualsolid, NOT setting the file format""" |
---|
224 | # Logged in as admin_user |
---|
225 | self.check_history_for_string( 'Your history is empty' ) |
---|
226 | history = get_latest_history_for_user( admin_user ) |
---|
227 | self.upload_file( 'qualscores.qualsolid' ) |
---|
228 | hda = get_latest_hda() |
---|
229 | assert hda is not None, "Problem retrieving hda from database" |
---|
230 | self.verify_dataset_correctness( 'qualscores.qualsolid', hid=str( hda.hid ) ) |
---|
231 | self.check_history_for_string( '48 lines, format: <span class="qualsolid">qualsolid</span>, database: \? Info: uploaded file' ) |
---|
232 | self.check_metadata_for_string( 'Change data type value="qualsolid" selected="yes">qualsolid' ) |
---|
233 | self.delete_history( id=self.security.encode_id( history.id ) ) |
---|
234 | def test_0090_upload_file( self ): |
---|
235 | """Test uploading qualscores.qual454, NOT setting the file format""" |
---|
236 | # Logged in as admin_user |
---|
237 | self.check_history_for_string( 'Your history is empty' ) |
---|
238 | history = get_latest_history_for_user( admin_user ) |
---|
239 | self.upload_file( 'qualscores.qual454' ) |
---|
240 | hda = get_latest_hda() |
---|
241 | assert hda is not None, "Problem retrieving hda from database" |
---|
242 | self.verify_dataset_correctness( 'qualscores.qual454', hid=str( hda.hid ) ) |
---|
243 | self.check_history_for_string( '49 lines, format: <span class="qual454">qual454</span>, database: \?' ) |
---|
244 | self.check_metadata_for_string( 'Change data type value="qual454" selected="yes">qual454' ) |
---|
245 | self.delete_history( id=self.security.encode_id( history.id ) ) |
---|
246 | def test_0095_upload_file( self ): |
---|
247 | """Test uploading 3.maf, NOT setting the file format""" |
---|
248 | # Logged in as admin_user |
---|
249 | self.check_history_for_string( 'Your history is empty' ) |
---|
250 | history = get_latest_history_for_user( admin_user ) |
---|
251 | self.upload_file( '3.maf' ) |
---|
252 | hda = get_latest_hda() |
---|
253 | assert hda is not None, "Problem retrieving hda from database" |
---|
254 | self.verify_dataset_correctness( '3.maf', hid=str( hda.hid ) ) |
---|
255 | self.check_history_for_string( '3.maf format: <span class="maf">maf</span>, database: \? Info: uploaded file' ) |
---|
256 | self.check_metadata_for_string( 'value="3.maf" value="\?"' ) |
---|
257 | self.check_metadata_for_string( 'Convert to new format <option value="interval">Convert MAF to Genomic Intervals <option value="fasta">Convert MAF to Fasta' ) |
---|
258 | self.check_metadata_for_string( 'Change data type selected value="maf" selected="yes"' ) |
---|
259 | self.delete_history( id=self.security.encode_id( history.id ) ) |
---|
260 | def test_0100_upload_file( self ): |
---|
261 | """Test uploading 1.lav, NOT setting the file format""" |
---|
262 | # Logged in as admin_user |
---|
263 | self.check_history_for_string( 'Your history is empty' ) |
---|
264 | history = get_latest_history_for_user( admin_user ) |
---|
265 | self.upload_file( '1.lav' ) |
---|
266 | hda = get_latest_hda() |
---|
267 | assert hda is not None, "Problem retrieving hda from database" |
---|
268 | self.verify_dataset_correctness( '1.lav', hid=str( hda.hid ) ) |
---|
269 | self.check_history_for_string( '1.lav format: <span class="lav">lav</span>, database: \? Info: uploaded file' ) |
---|
270 | self.check_metadata_for_string( 'value="1.lav" value="\?"' ) |
---|
271 | self.check_metadata_for_string( 'Change data type selected value="lav" selected="yes"' ) |
---|
272 | self.delete_history( id=self.security.encode_id( history.id ) ) |
---|
273 | def test_0105_upload_file( self ): |
---|
274 | """Test uploading 1.interval, NOT setting the file format""" |
---|
275 | # Logged in as admin_user |
---|
276 | self.check_history_for_string( 'Your history is empty' ) |
---|
277 | history = get_latest_history_for_user( admin_user ) |
---|
278 | self.upload_file( '1.interval' ) |
---|
279 | hda = get_latest_hda() |
---|
280 | assert hda is not None, "Problem retrieving hda from database" |
---|
281 | self.verify_dataset_correctness( '1.interval', hid=str( hda.hid ) ) |
---|
282 | self.check_history_for_string( '1.interval format: <span class="interval">interval</span>, database: \? Info: uploaded file' ) |
---|
283 | self.check_metadata_for_string( 'value="1.interval" value="\?"' ) |
---|
284 | self.check_metadata_for_string( 'Chrom column: <option value="1" selected> Start column: <option value="2" selected>' ) |
---|
285 | self.check_metadata_for_string( 'End column: <option value="3" selected> Strand column <option value="6" selected>' ) |
---|
286 | self.check_metadata_for_string( 'Convert to new format <option value="bed">Convert Genomic Intervals To BED' ) |
---|
287 | self.check_metadata_for_string( 'Change data type selected value="interval" selected="yes"' ) |
---|
288 | self.delete_history( id=self.security.encode_id( history.id ) ) |
---|
289 | def test_0110_upload_file( self ): |
---|
290 | """Test uploading 5.gff3, NOT setting the file format""" |
---|
291 | # Logged in as admin_user |
---|
292 | self.check_history_for_string( 'Your history is empty' ) |
---|
293 | history = get_latest_history_for_user( admin_user ) |
---|
294 | self.upload_file( '5.gff3' ) |
---|
295 | hda = get_latest_hda() |
---|
296 | assert hda is not None, "Problem retrieving hda from database" |
---|
297 | self.verify_dataset_correctness( '5.gff3', hid=str( hda.hid ) ) |
---|
298 | self.check_history_for_string( '5.gff3 format: <span class="gff3">gff3</span>, database: \? Info: uploaded file' ) |
---|
299 | self.check_metadata_for_string( 'value="5.gff3" value="\?"' ) |
---|
300 | self.check_metadata_for_string( 'Convert to new format <option value="bed">Convert GFF to BED' ) |
---|
301 | self.check_metadata_for_string( 'Change data type selected value="gff3" selected="yes"' ) |
---|
302 | self.delete_history( id=self.security.encode_id( history.id ) ) |
---|
303 | def test_0115_upload_file( self ): |
---|
304 | """Test uploading html_file.txt, NOT setting the file format""" |
---|
305 | # Logged in as admin_user |
---|
306 | self.check_history_for_string( 'Your history is empty' ) |
---|
307 | history = get_latest_history_for_user( admin_user ) |
---|
308 | self.upload_file( 'html_file.txt' ) |
---|
309 | hda = get_latest_hda() |
---|
310 | assert hda is not None, "Problem retrieving hda from database" |
---|
311 | self.check_history_for_string( 'The uploaded file contains inappropriate content' ) |
---|
312 | self.delete_history( id=self.security.encode_id( history.id ) ) |
---|
313 | def test_0120_upload_file( self ): |
---|
314 | """Test uploading 5.gff, NOT setting the file format""" |
---|
315 | # Logged in as admin_user |
---|
316 | self.check_history_for_string( 'Your history is empty' ) |
---|
317 | history = get_latest_history_for_user( admin_user ) |
---|
318 | self.upload_file( '5.gff' ) |
---|
319 | hda = get_latest_hda() |
---|
320 | assert hda is not None, "Problem retrieving hda from database" |
---|
321 | self.verify_dataset_correctness( '5.gff', hid=str( hda.hid ) ) |
---|
322 | self.check_history_for_string( '5.gff format: <span class="gff">gff</span>, database: \? Info: uploaded file' ) |
---|
323 | self.check_metadata_for_string( 'value="5.gff" value="\?"' ) |
---|
324 | self.check_metadata_for_string( 'Convert to new format <option value="bed">Convert GFF to BED' ) |
---|
325 | self.check_metadata_for_string( 'Change data type selected value="gff" selected="yes"' ) |
---|
326 | self.delete_history( id=self.security.encode_id( history.id ) ) |
---|
327 | def test_0125_upload_file( self ): |
---|
328 | """Test uploading 1.fasta, NOT setting the file format""" |
---|
329 | # Logged in as admin_user |
---|
330 | self.check_history_for_string( 'Your history is empty' ) |
---|
331 | history = get_latest_history_for_user( admin_user ) |
---|
332 | self.upload_file( '1.fasta' ) |
---|
333 | hda = get_latest_hda() |
---|
334 | assert hda is not None, "Problem retrieving hda from database" |
---|
335 | self.verify_dataset_correctness( '1.fasta', hid=str( hda.hid ) ) |
---|
336 | self.check_history_for_string( '1.fasta format: <span class="fasta">fasta</span>, database: \? Info: uploaded file' ) |
---|
337 | self.check_metadata_for_string( 'value="1.fasta" value="\?" Change data type selected value="fasta" selected="yes"' ) |
---|
338 | self.delete_history( id=self.security.encode_id( history.id ) ) |
---|
339 | def test_0130_upload_file( self ): |
---|
340 | """Test uploading 1.customtrack, NOT setting the file format""" |
---|
341 | # Logged in as admin_user |
---|
342 | self.check_history_for_string( 'Your history is empty' ) |
---|
343 | history = get_latest_history_for_user( admin_user ) |
---|
344 | self.upload_file( '1.customtrack' ) |
---|
345 | hda = get_latest_hda() |
---|
346 | assert hda is not None, "Problem retrieving hda from database" |
---|
347 | self.verify_dataset_correctness( '1.customtrack', hid=str( hda.hid ) ) |
---|
348 | self.check_history_for_string( '1.customtrack format: <span class="customtrack">customtrack</span>, database: \? Info: uploaded file' ) |
---|
349 | self.check_metadata_for_string( 'value="1.customtrack" value="\?" Change data type selected value="customtrack" selected="yes"' ) |
---|
350 | self.delete_history( id=self.security.encode_id( history.id ) ) |
---|
351 | def test_0135_upload_file( self ): |
---|
352 | """Test uploading shrimp_cs_test1.csfasta, NOT setting the file format""" |
---|
353 | # Logged in as admin_user |
---|
354 | self.check_history_for_string( 'Your history is empty' ) |
---|
355 | history = get_latest_history_for_user( admin_user ) |
---|
356 | self.upload_file( 'shrimp_cs_test1.csfasta' ) |
---|
357 | hda = get_latest_hda() |
---|
358 | assert hda is not None, "Problem retrieving hda from database" |
---|
359 | self.verify_dataset_correctness( 'shrimp_cs_test1.csfasta', hid=str( hda.hid ) ) |
---|
360 | self.check_history_for_string( '2,500 sequences, format: <span class="csfasta">csfasta</span>, <td>>2_14_26_F3,-1282216.0</td>' ) |
---|
361 | self.check_metadata_for_string( 'value="shrimp_cs_test1.csfasta" value="\?" Change data type value="csfasta" selected="yes"' ) |
---|
362 | self.delete_history( id=self.security.encode_id( history.id ) ) |
---|
363 | def test_0140_upload_file( self ): |
---|
364 | """Test uploading megablast_xml_parser_test1.gz, NOT setting the file format""" |
---|
365 | # Logged in as admin_user |
---|
366 | self.check_history_for_string( 'Your history is empty' ) |
---|
367 | history = get_latest_history_for_user( admin_user ) |
---|
368 | self.upload_file( 'megablast_xml_parser_test1.gz' ) |
---|
369 | hda = get_latest_hda() |
---|
370 | assert hda is not None, "Problem retrieving hda from database" |
---|
371 | self.check_history_for_string( 'NCBI Blast XML data format: <span class="blastxml">blastxml</span>' ) |
---|
372 | self.delete_history( id=self.security.encode_id( history.id ) ) |
---|
373 | def test_0145_upload_file( self ): |
---|
374 | """Test uploading 1.axt, NOT setting the file format""" |
---|
375 | # Logged in as admin_user |
---|
376 | self.check_history_for_string( 'Your history is empty' ) |
---|
377 | history = get_latest_history_for_user( admin_user ) |
---|
378 | self.upload_file( '1.axt' ) |
---|
379 | hda = get_latest_hda() |
---|
380 | assert hda is not None, "Problem retrieving hda from database" |
---|
381 | self.verify_dataset_correctness( '1.axt', hid=str( hda.hid ) ) |
---|
382 | self.check_history_for_string( '1.axt format: <span class="axt">axt</span>, database: \? Info: uploaded file' ) |
---|
383 | self.check_metadata_for_string( 'value="1.axt" value="\?" Change data type selected value="axt" selected="yes"' ) |
---|
384 | self.delete_history( id=self.security.encode_id( history.id ) ) |
---|
385 | def test_0150_upload_file( self ): |
---|
386 | """Test uploading 1.bam, which is a sorted Bam file creaed by the Galaxy sam_to_bam tool, NOT setting the file format""" |
---|
387 | self.check_history_for_string( 'Your history is empty' ) |
---|
388 | history = get_latest_history_for_user( admin_user ) |
---|
389 | self.upload_file( '1.bam' ) |
---|
390 | hda = get_latest_hda() |
---|
391 | assert hda is not None, "Problem retrieving hda from database" |
---|
392 | self.verify_dataset_correctness( '1.bam', hid=str( hda.hid ) ) |
---|
393 | self.check_history_for_string( '<span class="bam">bam</span>' ) |
---|
394 | # Make sure the Bam index was created |
---|
395 | assert hda.metadata.bam_index is not None, "Bam index was not correctly created for 1.bam" |
---|
396 | self.delete_history( id=self.security.encode_id( history.id ) ) |
---|
397 | def test_0155_upload_file( self ): |
---|
398 | """Test uploading 3.bam, which is an unsorted Bam file, NOT setting the file format""" |
---|
399 | self.check_history_for_string( 'Your history is empty' ) |
---|
400 | history = get_latest_history_for_user( admin_user ) |
---|
401 | self.upload_file( '3.bam' ) |
---|
402 | hda = get_latest_hda() |
---|
403 | assert hda is not None, "Problem retrieving hda from database" |
---|
404 | # Since 3.bam is not sorted, we cannot verify dataset correctness since the uploaded |
---|
405 | # dataset will be sorted. However, the check below to see if the index was created is |
---|
406 | # sufficient. |
---|
407 | self.check_history_for_string( '<span class="bam">bam</span>' ) |
---|
408 | # Make sure the Bam index was created |
---|
409 | assert hda.metadata.bam_index is not None, "Bam index was not correctly created for 3.bam" |
---|
410 | self.delete_history( id=self.security.encode_id( history.id ) ) |
---|
411 | def test_0160_url_paste( self ): |
---|
412 | """Test url paste behavior""" |
---|
413 | # Logged in as admin_user |
---|
414 | # Deleting the current history should have created a new history |
---|
415 | self.check_history_for_string( 'Your history is empty' ) |
---|
416 | history = get_latest_history_for_user( admin_user ) |
---|
417 | self.upload_url_paste( 'hello world' ) |
---|
418 | self.check_history_for_string( 'Pasted Entry' ) |
---|
419 | self.check_history_for_string( 'hello world' ) |
---|
420 | self.upload_url_paste( u'hello world' ) |
---|
421 | self.check_history_for_string( 'Pasted Entry' ) |
---|
422 | self.check_history_for_string( 'hello world' ) |
---|
423 | self.delete_history( id=self.security.encode_id( history.id ) ) |
---|
424 | def test_0165_upload_file( self ): |
---|
425 | """Test uploading 1.pileup, NOT setting the file format""" |
---|
426 | self.check_history_for_string( 'Your history is empty' ) |
---|
427 | history = get_latest_history_for_user( admin_user ) |
---|
428 | self.upload_file( '1.pileup' ) |
---|
429 | hda = get_latest_hda() |
---|
430 | assert hda is not None, "Problem retrieving hda from database" |
---|
431 | self.verify_dataset_correctness( '1.pileup', hid=str( hda.hid ) ) |
---|
432 | self.check_history_for_string( '1.pileup format: <span class="pileup">pileup</span>, database: \? Info: uploaded file' ) |
---|
433 | self.check_metadata_for_string( 'value="1.pileup" value="\?" Change data type selected value="pileup" selected="yes"' ) |
---|
434 | self.delete_history( id=self.security.encode_id( history.id ) ) |
---|
435 | def test_0170_upload_file( self ): |
---|
436 | """Test uploading 1.bigbed, NOT setting the file format""" |
---|
437 | self.check_history_for_string( 'Your history is empty' ) |
---|
438 | history = get_latest_history_for_user( admin_user ) |
---|
439 | self.upload_file( '1.bigbed' ) |
---|
440 | hda = get_latest_hda() |
---|
441 | assert hda is not None, "Problem retrieving hda from database" |
---|
442 | self.verify_dataset_correctness( '1.bigbed', hid=str( hda.hid ) ) |
---|
443 | self.check_history_for_string( '1.bigbed</span> database: \? Info: uploaded bigbed file' ) |
---|
444 | self.check_metadata_for_string( 'value="1.bigbed" value="\?" Change data type selected value="bigbed" selected="yes"' ) |
---|
445 | self.delete_history( id=self.security.encode_id( history.id ) ) |
---|
446 | def test_0175_upload_file( self ): |
---|
447 | """Test uploading 1.bigwig, NOT setting the file format""" |
---|
448 | self.check_history_for_string( 'Your history is empty' ) |
---|
449 | history = get_latest_history_for_user( admin_user ) |
---|
450 | self.upload_file( '1.bigwig' ) |
---|
451 | hda = get_latest_hda() |
---|
452 | assert hda is not None, "Problem retrieving hda from database" |
---|
453 | self.verify_dataset_correctness( '1.bigwig', hid=str( hda.hid ) ) |
---|
454 | self.check_history_for_string( '1.bigwig</span> database: \? Info: uploaded bigwig file' ) |
---|
455 | self.check_metadata_for_string( 'value="1.bigwig" value="\?" Change data type selected value="bigwig" selected="yes"' ) |
---|
456 | self.delete_history( id=self.security.encode_id( history.id ) ) |
---|
457 | def test_9999_clean_up( self ): |
---|
458 | self.logout() |
---|