Project

General

Profile

Appion code for Jensen lab

Added by Jane Ding over 13 years ago

Hi Anchi, remember you helped to write a uploadJaneTomo.py for me during my last visit in SD? It demonstrates how to obtain the leginon parameters of a tilt series. It is designed to be called from a webpage such as tomosummary.php . Grant would like the uploading function to be called automatically, that is, it should run automatically as soon as a raptor runs successfully. So I'm thinking to add the function into tomoraptor.py -- after raptor runs successfully (raptoraligndata==0 in tomoraptor.py).

I'm trying to copy the functions parallelly from uploadJaneTomo.py to tomoraptor.py, mainly, this section:

    def start(self):
        commit = self.params['commit']
        description = self.params['description']
        processdir = self.params['fulltomodir']
        runname = self.params['runname']
        fulltomodata = apTomo.getFullTomoData(self.params['fulltomoId'])
        alignrun = fulltomodata['alignrun']
        tiltseries = fulltomodata['tiltseries']
        imagelist = apTomo.getImageList([tiltseries])
        defocus = imagelist[0]['preset']['defocus']
        magnification = imagelist[0]['preset']['magnification']
        q = appiondata.ApTiltsInAlignRunData(alignrun=alignrun)
        r = q.query()
        tomosettings = r[0]['settings']
        tilt_min = tomosettings['tilt min']
        dose = tomosettings['dose']
        print defocus,magnification,tilt_min,dose

My question is: when I move this part to tomoraptor.py , how should I find "fulltomoId" (so I can obtain "fulltomodata" and then "tiltseries" etc. in the above code)?

Thanks,


Replies (5)

RE: Appion code for Jensen lab - Added by Anchi Cheng over 13 years ago

The last line of tomoraptor.py start function inserts the fulltomogram into appiondatabase by this line:

fulltomodata = apTomo.insertFullTomogram(sessiondata,tiltdatalist[0],alignerdata,
            fullrundata,runname,description,zimagedata,thickness_pixel,reconbin)

The output fulltomodata is an instance of ApFullTomogramData and contains all information of the row of the data the insert function just did. Therefore, to get fulltomoId, meaning the database id for the just-inserted tomogram, you can get from its attribute dbid. In other words,

fulltomoId = fulltomodata.dbid

You don't have to do that, though. The line in uploadJanTomo.py

fulltomodata = apTomo.getFullTomoData(self.params['fulltomoId'])

is meant to get fulltomodata from the input fulltomoId, but you already have fulltomodata from the output of the last line in tomoraptor.py shown above! Therefore, you can skip the two lines and use the existing fulltomodata directly to get tiltseries etc.

Same is true for several other information you need here. Since you are operating in tomoraptor.py that would have tiltseries, imagelist and other things queried, you can get to what you need to insert into your database easier from the available stuff.

RE: Appion code for Jensen lab - Added by Jane Ding over 13 years ago

Hi Anchi,

A couple of more questions:

1. in tomoraptor.py, how do I obtain the session number and description (e.g., 11apr22a - Martin VC), tilt series full id (e.g., 11apr22a_flgP_00011gr_00005sq_v02_00006hl_v06_00004tomo), tiltSeriesId (e.g. 1489) and timestamp (e.g. 2011-04-11)?

2. if I know the Leginon tilt series id, is there an URL which allows user to enter the corresponding Leginon tomography viewing page directly? Currently, users opens the Leginon Web tools, click on Tomography, and then choose Session and Tilt Series. In our tomography database, we would like to record the Leginon tilt id and present a direct web link so that user can connect to the Leginon tomography viewer directly.

Thanks!

RE: Appion code for Jensen lab - Added by Anchi Cheng over 13 years ago

1. Looking at the myamiweb/tomo/tomography.php where it determines what to show in index.php page as tiltseries time and name, the time is determined by the timestamp of the tilt series, the name is a substring of the filename from the first image of the tilt series. The session description is a combined string of session name and session comment.

This means that you should try to get these using the corresponding python object like this:

session: Almost all leginondata tables have reference to SessionData table, so you can access it by either of these:
  • sessiondata = tiltseries['session']
  • sessiondata = imagelist0['session']

See http://emg.nysbc.org/boards/14/topics/844?r=1013 for how to get to id, timestamp, and a field in the that row of database table.

2. The current version of the page does not do that. I started an issue #1303 and made the option possible now. You should be able to find out how to do it from that point on.

RE: Appion code for Jensen lab - Added by Jane Ding over 13 years ago

thanks!
http://your_webserver/myamiweb/tomo/index.php?tid=45958 works well in my test.

But it's still not very clear for me how to get the tid (tilt series id) in tomoraptor.py. When I use
session_id = sessiondata.dbid
it doesn't seem to be the tilt series id?

RE: Appion code for Jensen lab - Added by Anchi Cheng over 13 years ago

You should use

tiltseries.dbid in your code as you present in the first posting of this thread.

session is the experiment session

tiltseries is, well, the individual tilt series.

    (1-5/5)