def new_history( self ): # Start with a new history self.twill_test_case.logout() self.twill_test_case.login( email='*****@*****.**' ) admin_user = sa_session.query( galaxy.model.User ).filter( galaxy.model.User.table.c.email == '*****@*****.**' ).one() self.twill_test_case.new_history() latest_history = sa_session.query( galaxy.model.History ) \ .filter( and_( galaxy.model.History.table.c.deleted == False, galaxy.model.History.table.c.user_id == admin_user.id ) ) \ .order_by( desc( galaxy.model.History.table.c.create_time ) ) \ .first() assert latest_history is not None, "Problem retrieving latest_history from database" if len( self.twill_test_case.get_history_as_data_list() ) > 0: raise AssertionError("ToolTestCase.do_it failed") return latest_history
def test_00_metadata_edit( self ): """test_metadata_edit: Testing metadata editing""" self.logout() self.login( email='*****@*****.**', username='******' ) admin_user = sa_session.query( galaxy.model.User ) \ .filter( galaxy.model.User.table.c.email=='*****@*****.**' ) \ .one() self.new_history( name='Test Metadata Edit' ) history1 = sa_session.query( galaxy.model.History ) \ .filter( and_( galaxy.model.History.table.c.deleted==False, galaxy.model.History.table.c.user_id==admin_user.id ) ) \ .order_by( desc( galaxy.model.History.table.c.create_time ) ) \ .first() self.upload_file( '1.bed' ) latest_hda = sa_session.query( galaxy.model.HistoryDatasetAssociation ) \ .order_by( desc( galaxy.model.HistoryDatasetAssociation.table.c.create_time ) ) \ .first() self.home() # Due to twill not being able to handle the permissions forms, we'll eliminate # DefaultHistoryPermissions prior to uploading a dataset so that the permission # form will not be displayed on ted edit attributes page. for dp in latest_hda.dataset.actions: sa_session.delete( dp ) sa_session.flush() sa_session.refresh( latest_hda.dataset ) self.check_history_for_string( '1.bed' ) self.check_metadata_for_string( '1.bed uploaded file unspecified (\?) chromCol value="1" selected endCol value="3" is_strandCol value="true" checked', hid=str( latest_hda.hid ) ) """test editing attributes""" self.edit_hda_attribute_info( hda_id=str( latest_hda.id ), new_name='Testdata', new_info="Uploaded my file", new_dbkey='hg16', new_startcol='6' ) self.check_metadata_for_string( 'Testdata bed Uploaded my file hg16 "bed" selected="yes" "startCol" value="6" selected', hid=str( latest_hda.hid ) ) """test Auto-detecting attributes""" self.auto_detect_metadata( hda_id=str( latest_hda.id ) ) self.check_metadata_for_string('Testdata bed Uploaded my file hg16 "bed" selected="yes" "startCol" value="2" selected', hid=str( latest_hda.hid ) ) """test converting formats""" self.convert_format( hda_id=str( latest_hda.id ), target_type='gff' ) self.check_metadata_for_string( '"gff" selected="yes"', hid=str( latest_hda.hid ) ) """test changing data type""" self.change_datatype( hda_id=str( latest_hda.id ), datatype='gff3' ) self.check_metadata_for_string( 'gff3', hid=str( latest_hda.hid ) ) self.delete_history( id=self.security.encode_id( history1.id ) ) self.logout()
def test_get_DNAseHSS_flanked_genes( self ): self.logout() self.login( email='*****@*****.**' ) admin_user = sa_session.query( galaxy.model.User ) \ .filter( galaxy.model.User.table.c.email=='*****@*****.**' ) \ .one() self.new_history( name='DNAseHSS_flanked_genes' ) history1 = sa_session.query( galaxy.model.History ) \ .filter( and_( galaxy.model.History.table.c.deleted==False, galaxy.model.History.table.c.user_id==admin_user.id ) ) \ .order_by( desc( galaxy.model.History.table.c.create_time ) ) \ .first() track_params = dict( db="hg17", hgta_group="regulation", hgta_table="dukeDnaseCd4Sites", hgta_track="dukeDnaseCd4Sites", hgta_regionType="range", position="chr22", hgta_outputType="bed", sendToGalaxy="1" ) output_params = dict( fbQual="whole", ) # Test 1 self.run_ucsc_main( track_params, output_params ) self.wait() self.verify_dataset_correctness('DNAseHSS.dat') latest_hda = sa_session.query( galaxy.model.HistoryDatasetAssociation ) \ .order_by( desc( galaxy.model.HistoryDatasetAssociation.table.c.create_time ) ) \ .first() # Due to twill not being able to handle the permissions forms, we'll eliminate # DefaultHistoryPermissions prior to uploading a dataset so that the permission # form will not be displayed on ted edit attributes page. for dp in latest_hda.dataset.actions: sa_session.delete( dp ) sa_session.flush() sa_session.refresh( latest_hda.dataset ) self.edit_hda_attribute_info( str( latest_hda.id ), new_name="DNAse HS" ) self.check_metadata_for_string( "DNAse HS" ) track_params = dict( db="hg17", hgta_group="genes", hgta_table="knownGene", hgta_track="knownGene", hgta_regionType="range", position="chr22", hgta_outputType="bed", sendToGalaxy="1" ) output_params = dict( fbQual="whole", ) # Test 2 self.run_ucsc_main( track_params, output_params ) self.wait() self.verify_dataset_correctness('hg17chr22KnownGenes.dat') latest_hda = sa_session.query( galaxy.model.HistoryDatasetAssociation ) \ .order_by( desc( galaxy.model.HistoryDatasetAssociation.table.c.create_time ) ) \ .first() for dp in latest_hda.dataset.actions: sa_session.delete( dp ) sa_session.flush() sa_session.refresh( latest_hda.dataset ) self.edit_hda_attribute_info( str( latest_hda.id ), new_name="Genes" ) self.check_metadata_for_string( "Genes" ) # Test 3 self.run_tool( 'get_flanks1', input="2", region="whole", direction="Upstream", offset="0", size="500" ) self.wait() self.verify_dataset_correctness( 'knownGeneUpstream500Flanks.dat' ) latest_hda = sa_session.query( galaxy.model.HistoryDatasetAssociation ) \ .order_by( desc( galaxy.model.HistoryDatasetAssociation.table.c.create_time ) ) \ .first() for dp in latest_hda.dataset.actions: sa_session.delete( dp ) sa_session.flush() sa_session.refresh( latest_hda.dataset ) self.edit_hda_attribute_info( str( latest_hda.id ), new_name="Flanks" ) self.check_metadata_for_string( "Flanks" ) # Test 4 self.run_tool( 'gops_join_1', input1="3", input2="1", min="1", fill="none" ) self.wait() # We cannot verify this dataset, because this tool spits out data in a non-deterministic order #self.verify_dataset_correctness( 'joinFlanksDNAse.dat' ) # Test 5 self.run_tool( 'Filter1', input="4", cond="c17==1000" ) self.wait() self.verify_dataset_correctness( 'filteredJoinedFlanksDNAse.dat' ) self.delete_history( self.security.encode_id( history1.id ) ) self.logout()