Re: [galaxy-dev] [API] Get the hashed dataset id within Galaxy
Le 30/08/2011 18:00, Nate Coraor a écrit : Louise-Amélie Schmitt wrote: Le 30/08/2011 16:51, Nate Coraor a écrit : Louise-Amélie Schmitt wrote: I just changed it and ran into an error, so I modified the line and it now works fine: $__app__.security.encode_id( '%s' % $input1.id ) What was the 'file.' originally for? On the API side, a library or history's "contents" are all identified by ID, so: http://server/api/libraries//contents/ That content ID can refer to a dataset (file) or folder, but if this was not 'file.' or 'folder.', when the framework decoded it, it would just get a numeric ID and wouldn't know to which type it refered. So instead of using just the ID, it uses the encoded form of 'file.' and 'folder.'. This was extended to histories even though there isn't a concept of folders in histories. So just encoding the ID is going to give you the encoded HistoryDatasetAssociation id, but that ID won't be the dataset's API id. For example, using the default id_secret in universe_wsgi.ini, if I upload a dataset to a fresh instance of Galaxy, its encoded ID (the encoded value of '1') is: f2db41e1fa331b3e As you can see in the 'display' URL for the dataset: http://server/datasets/f2db41e1fa331b3e/display/ But that ID won't work for the history API: % ./display.py http://server/api/histories/f597429621d6eb2b/contents Collection Members -- #1: /api/histories/f597429621d6eb2b/contents/cc1c6c1afcb4fd4e name: 1.bed type: file id: cc1c6c1afcb4fd4e f597429621d6eb2b is the encoding of '2' with the default id_secret since this dataset is in history ID 2. cc1c6c1afcb4fd4e is the encoding of 'file.1'. --nate This really confuses me. I'll try to explain why: I have a script that runs two workflows one after the other. The ids in the results of workflow 1 are stored in a database, along with some parameters for workflow 2. Then, I run workflow 2 on workflow 1's results. In this workflow I have a tool that queries the database to get the parameters it needs, so it compares the input ids with those stored previously. If I use this line: $__app__.security.encode_id( 'file.%s' % $input1.id ) It does not match the output ids of workflow 1, so I cannot access the corresponding parameters. But if I use this: $__app__.security.encode_id( '%s' % $input1.id ) the ids match and I get the appropriate database entry. What I understood of it: There must be something wrong somewhere, since I'm clearly manipulating "file." free stuff and it works just fine. Those same ids are passed to workflow 2 and it runs properly, on the appropriate datasets. Did I miss anything? Did I do something wrong? Ah, no, the workflow API is using the encoded id without 'file.', and specifies the source by using the format: == Since the type is provided as a parameter it isn't included in the encoded id. This is more ideal since the encoded id will match what's in the UI, so let me think about how we can do this in the history and library APIs without having ugly URLs. --nate Ah ok, I get it :) Thanks for all the information! Best, L-A L-A Le 24/08/2011 15:00, Louise-Amélie Schmitt a écrit : Thanks a lot! I found another way to do it but it is awfully more complicated so I'll change as soon as I have some time. Best, L-A Le 23/08/2011 19:49, Nate Coraor a écrit : Louise-Amélie Schmitt wrote: Hi, I would need to make a tool that can get the API dataset id out of the input dataset of the tool, how can I do that? Hi L-A, Pass in as an argument: $__app__.security.encode_id( 'file.%s' % $input1.id ) Where 'input1' is the param name of your input. --nate ___ Please keep all replies on the list by using "reply all" in your mail client. To manage your subscriptions to this and other Galaxy lists, please use the interface at: http://lists.bx.psu.edu/ ___ Please keep all replies on the list by using "reply all" in your mail client. To manage your subscriptions to this and other Galaxy lists, please use the interface at: http://lists.bx.psu.edu/ ___ Please keep all replies on the list by using "reply all" in your mail client. To manage your subscriptions to this and other Galaxy lists, please use the interface at: http://lists.bx.psu.edu/ ___ Please keep all replies on the list by using "reply all" in your mail client. To manage your subscriptions to this and other Galaxy lists, please use the interface at: http://lists.bx.psu.edu/
Re: [galaxy-dev] [API] Get the hashed dataset id within Galaxy
Louise-Amélie Schmitt wrote: > Le 30/08/2011 16:51, Nate Coraor a écrit : > >Louise-Amélie Schmitt wrote: > >>I just changed it and ran into an error, so I modified the line and > >>it now works fine: > >>$__app__.security.encode_id( '%s' % $input1.id ) > >>What was the 'file.' originally for? > >On the API side, a library or history's "contents" are all identified by > >ID, so: > > > > http://server/api/libraries//contents/ > > > >That content ID can refer to a dataset (file) or folder, but if this was not > >'file.' or 'folder.', when the framework decoded it, it would just > >get > >a numeric ID and wouldn't know to which type it refered. So instead of using > >just the ID, it uses the encoded form of 'file.' and 'folder.'. This > >was extended to histories even though there isn't a concept of folders in > >histories. > > > >So just encoding the ID is going to give you the encoded > >HistoryDatasetAssociation id, but that ID won't be the dataset's API id. > >For example, using the default id_secret in universe_wsgi.ini, if I > >upload a dataset to a fresh instance of Galaxy, its encoded ID (the > >encoded value of '1') is: > > > > f2db41e1fa331b3e > > > >As you can see in the 'display' URL for the dataset: > > > > http://server/datasets/f2db41e1fa331b3e/display/ > > > >But that ID won't work for the history API: > > > > % ./display.py > > http://server/api/histories/f597429621d6eb2b/contents > > Collection Members > > -- > > #1: /api/histories/f597429621d6eb2b/contents/cc1c6c1afcb4fd4e > > name: 1.bed > > type: file > > id: cc1c6c1afcb4fd4e > > > >f597429621d6eb2b is the encoding of '2' with the default id_secret since this > >dataset is in history ID 2. cc1c6c1afcb4fd4e is the encoding of 'file.1'. > > > >--nate > > This really confuses me. I'll try to explain why: > > I have a script that runs two workflows one after the other. The ids > in the results of workflow 1 are stored in a database, along with > some parameters for workflow 2. > > Then, I run workflow 2 on workflow 1's results. In this workflow I > have a tool that queries the database to get the parameters it > needs, so it compares the input ids with those stored previously. > > If I use this line: > > $__app__.security.encode_id( 'file.%s' % $input1.id ) > > It does not match the output ids of workflow 1, so I cannot access > the corresponding parameters. > But if I use this: > > $__app__.security.encode_id( '%s' % $input1.id ) > > the ids match and I get the appropriate database entry. > > What I understood of it: > There must be something wrong somewhere, since I'm clearly > manipulating "file." free stuff and it works just fine. Those same > ids are passed to workflow 2 and it runs properly, on the > appropriate datasets. > > Did I miss anything? Did I do something wrong? Ah, no, the workflow API is using the encoded id without 'file.', and specifies the source by using the format: == Since the type is provided as a parameter it isn't included in the encoded id. This is more ideal since the encoded id will match what's in the UI, so let me think about how we can do this in the history and library APIs without having ugly URLs. --nate > > L-A > > >> > >> > >>Le 24/08/2011 15:00, Louise-Amélie Schmitt a écrit : > >>>Thanks a lot! > >>> > >>>I found another way to do it but it is awfully more complicated so > >>>I'll change as soon as I have some time. > >>> > >>>Best, > >>>L-A > >>> > >>> > >>>Le 23/08/2011 19:49, Nate Coraor a écrit : > Louise-Amélie Schmitt wrote: > >Hi, > > > >I would need to make a tool that can get the API dataset id out of > >the input dataset of the tool, how can I do that? > Hi L-A, > > Pass in as an argument: > > $__app__.security.encode_id( 'file.%s' % $input1.id ) > > Where 'input1' is the param name of your input. > > --nate > > >___ > >Please keep all replies on the list by using "reply all" > >in your mail client. To manage your subscriptions to this > >and other Galaxy lists, please use the interface at: > > > > http://lists.bx.psu.edu/ > >>>___ > >>>Please keep all replies on the list by using "reply all" > >>>in your mail client. To manage your subscriptions to this > >>>and other Galaxy lists, please use the interface at: > >>> > >>>http://lists.bx.psu.edu/ > >>___ > >>Please keep all replies on the list by using "reply all" > >>in your mail client. To manage your subscriptions to this > >>and other Galaxy lists, please use the interface at: > >> > >> http://lists.bx.psu.edu/ > >> > ___ Please keep all replies on the list by using "reply all" in your mail client. To manage your subscriptions to th
Re: [galaxy-dev] [API] Get the hashed dataset id within Galaxy
Le 30/08/2011 16:51, Nate Coraor a écrit : Louise-Amélie Schmitt wrote: I just changed it and ran into an error, so I modified the line and it now works fine: $__app__.security.encode_id( '%s' % $input1.id ) What was the 'file.' originally for? On the API side, a library or history's "contents" are all identified by ID, so: http://server/api/libraries//contents/ That content ID can refer to a dataset (file) or folder, but if this was not 'file.' or 'folder.', when the framework decoded it, it would just get a numeric ID and wouldn't know to which type it refered. So instead of using just the ID, it uses the encoded form of 'file.' and 'folder.'. This was extended to histories even though there isn't a concept of folders in histories. So just encoding the ID is going to give you the encoded HistoryDatasetAssociation id, but that ID won't be the dataset's API id. For example, using the default id_secret in universe_wsgi.ini, if I upload a dataset to a fresh instance of Galaxy, its encoded ID (the encoded value of '1') is: f2db41e1fa331b3e As you can see in the 'display' URL for the dataset: http://server/datasets/f2db41e1fa331b3e/display/ But that ID won't work for the history API: % ./display.py http://server/api/histories/f597429621d6eb2b/contents Collection Members -- #1: /api/histories/f597429621d6eb2b/contents/cc1c6c1afcb4fd4e name: 1.bed type: file id: cc1c6c1afcb4fd4e f597429621d6eb2b is the encoding of '2' with the default id_secret since this dataset is in history ID 2. cc1c6c1afcb4fd4e is the encoding of 'file.1'. --nate This really confuses me. I'll try to explain why: I have a script that runs two workflows one after the other. The ids in the results of workflow 1 are stored in a database, along with some parameters for workflow 2. Then, I run workflow 2 on workflow 1's results. In this workflow I have a tool that queries the database to get the parameters it needs, so it compares the input ids with those stored previously. If I use this line: $__app__.security.encode_id( 'file.%s' % $input1.id ) It does not match the output ids of workflow 1, so I cannot access the corresponding parameters. But if I use this: $__app__.security.encode_id( '%s' % $input1.id ) the ids match and I get the appropriate database entry. What I understood of it: There must be something wrong somewhere, since I'm clearly manipulating "file." free stuff and it works just fine. Those same ids are passed to workflow 2 and it runs properly, on the appropriate datasets. Did I miss anything? Did I do something wrong? L-A Le 24/08/2011 15:00, Louise-Amélie Schmitt a écrit : Thanks a lot! I found another way to do it but it is awfully more complicated so I'll change as soon as I have some time. Best, L-A Le 23/08/2011 19:49, Nate Coraor a écrit : Louise-Amélie Schmitt wrote: Hi, I would need to make a tool that can get the API dataset id out of the input dataset of the tool, how can I do that? Hi L-A, Pass in as an argument: $__app__.security.encode_id( 'file.%s' % $input1.id ) Where 'input1' is the param name of your input. --nate ___ Please keep all replies on the list by using "reply all" in your mail client. To manage your subscriptions to this and other Galaxy lists, please use the interface at: http://lists.bx.psu.edu/ ___ Please keep all replies on the list by using "reply all" in your mail client. To manage your subscriptions to this and other Galaxy lists, please use the interface at: http://lists.bx.psu.edu/ ___ Please keep all replies on the list by using "reply all" in your mail client. To manage your subscriptions to this and other Galaxy lists, please use the interface at: http://lists.bx.psu.edu/ ___ Please keep all replies on the list by using "reply all" in your mail client. To manage your subscriptions to this and other Galaxy lists, please use the interface at: http://lists.bx.psu.edu/
Re: [galaxy-dev] [API] Get the hashed dataset id within Galaxy
Louise-Amélie Schmitt wrote: > I just changed it and ran into an error, so I modified the line and > it now works fine: > $__app__.security.encode_id( '%s' % $input1.id ) > What was the 'file.' originally for? On the API side, a library or history's "contents" are all identified by ID, so: http://server/api/libraries//contents/ That content ID can refer to a dataset (file) or folder, but if this was not 'file.' or 'folder.', when the framework decoded it, it would just get a numeric ID and wouldn't know to which type it refered. So instead of using just the ID, it uses the encoded form of 'file.' and 'folder.'. This was extended to histories even though there isn't a concept of folders in histories. So just encoding the ID is going to give you the encoded HistoryDatasetAssociation id, but that ID won't be the dataset's API id. For example, using the default id_secret in universe_wsgi.ini, if I upload a dataset to a fresh instance of Galaxy, its encoded ID (the encoded value of '1') is: f2db41e1fa331b3e As you can see in the 'display' URL for the dataset: http://server/datasets/f2db41e1fa331b3e/display/ But that ID won't work for the history API: % ./display.py http://server/api/histories/f597429621d6eb2b/contents Collection Members -- #1: /api/histories/f597429621d6eb2b/contents/cc1c6c1afcb4fd4e name: 1.bed type: file id: cc1c6c1afcb4fd4e f597429621d6eb2b is the encoding of '2' with the default id_secret since this dataset is in history ID 2. cc1c6c1afcb4fd4e is the encoding of 'file.1'. --nate > > > > Le 24/08/2011 15:00, Louise-Amélie Schmitt a écrit : > >Thanks a lot! > > > >I found another way to do it but it is awfully more complicated so > >I'll change as soon as I have some time. > > > >Best, > >L-A > > > > > >Le 23/08/2011 19:49, Nate Coraor a écrit : > >>Louise-Amélie Schmitt wrote: > >>>Hi, > >>> > >>>I would need to make a tool that can get the API dataset id out of > >>>the input dataset of the tool, how can I do that? > >>Hi L-A, > >> > >>Pass in as an argument: > >> > >> $__app__.security.encode_id( 'file.%s' % $input1.id ) > >> > >>Where 'input1' is the param name of your input. > >> > >>--nate > >> > >>>___ > >>>Please keep all replies on the list by using "reply all" > >>>in your mail client. To manage your subscriptions to this > >>>and other Galaxy lists, please use the interface at: > >>> > >>> http://lists.bx.psu.edu/ > > > >___ > >Please keep all replies on the list by using "reply all" > >in your mail client. To manage your subscriptions to this > >and other Galaxy lists, please use the interface at: > > > > http://lists.bx.psu.edu/ > > ___ > Please keep all replies on the list by using "reply all" > in your mail client. To manage your subscriptions to this > and other Galaxy lists, please use the interface at: > > http://lists.bx.psu.edu/ > ___ Please keep all replies on the list by using "reply all" in your mail client. To manage your subscriptions to this and other Galaxy lists, please use the interface at: http://lists.bx.psu.edu/
Re: [galaxy-dev] [API] Get the hashed dataset id within Galaxy
I just changed it and ran into an error, so I modified the line and it now works fine: $__app__.security.encode_id( '%s' % $input1.id ) What was the 'file.' originally for? Le 24/08/2011 15:00, Louise-Amélie Schmitt a écrit : Thanks a lot! I found another way to do it but it is awfully more complicated so I'll change as soon as I have some time. Best, L-A Le 23/08/2011 19:49, Nate Coraor a écrit : Louise-Amélie Schmitt wrote: Hi, I would need to make a tool that can get the API dataset id out of the input dataset of the tool, how can I do that? Hi L-A, Pass in as an argument: $__app__.security.encode_id( 'file.%s' % $input1.id ) Where 'input1' is the param name of your input. --nate ___ Please keep all replies on the list by using "reply all" in your mail client. To manage your subscriptions to this and other Galaxy lists, please use the interface at: http://lists.bx.psu.edu/ ___ Please keep all replies on the list by using "reply all" in your mail client. To manage your subscriptions to this and other Galaxy lists, please use the interface at: http://lists.bx.psu.edu/ ___ Please keep all replies on the list by using "reply all" in your mail client. To manage your subscriptions to this and other Galaxy lists, please use the interface at: http://lists.bx.psu.edu/
Re: [galaxy-dev] [API] Get the hashed dataset id within Galaxy
Thanks a lot! I found another way to do it but it is awfully more complicated so I'll change as soon as I have some time. Best, L-A Le 23/08/2011 19:49, Nate Coraor a écrit : Louise-Amélie Schmitt wrote: Hi, I would need to make a tool that can get the API dataset id out of the input dataset of the tool, how can I do that? Hi L-A, Pass in as an argument: $__app__.security.encode_id( 'file.%s' % $input1.id ) Where 'input1' is the param name of your input. --nate ___ Please keep all replies on the list by using "reply all" in your mail client. To manage your subscriptions to this and other Galaxy lists, please use the interface at: http://lists.bx.psu.edu/ ___ Please keep all replies on the list by using "reply all" in your mail client. To manage your subscriptions to this and other Galaxy lists, please use the interface at: http://lists.bx.psu.edu/
Re: [galaxy-dev] [API] Get the hashed dataset id within Galaxy
Louise-Amélie Schmitt wrote: > Hi, > > I would need to make a tool that can get the API dataset id out of > the input dataset of the tool, how can I do that? Hi L-A, Pass in as an argument: $__app__.security.encode_id( 'file.%s' % $input1.id ) Where 'input1' is the param name of your input. --nate > ___ > Please keep all replies on the list by using "reply all" > in your mail client. To manage your subscriptions to this > and other Galaxy lists, please use the interface at: > > http://lists.bx.psu.edu/ ___ Please keep all replies on the list by using "reply all" in your mail client. To manage your subscriptions to this and other Galaxy lists, please use the interface at: http://lists.bx.psu.edu/
[galaxy-dev] [API] Get the hashed dataset id within Galaxy
Hi, I would need to make a tool that can get the API dataset id out of the input dataset of the tool, how can I do that? ___ Please keep all replies on the list by using "reply all" in your mail client. To manage your subscriptions to this and other Galaxy lists, please use the interface at: http://lists.bx.psu.edu/