Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Due to section sampling density, projection data grids are at 100µm resolution while gene expression grids are at 200µm resolution. Upsampling with appropriate interpolation of the gene expression data is necessary in order to numerically compare between the two different types of data.  When interpolating the data, "no data" (-1) voxels needs to be handled specifically.

  Example Matlab code snippet to upsample gene expression grid with "no data" handling:    % Download and unzip energy volume file for gene Rasd2 coronal SectionDataSet 73636089
   

     

Code Block

 % Download and unzip energy volume file for gene Rasd2 coronal SectionDataSet 73636089
    mkdir('Rasd2_73636089');

...


    urlwrite('http://api.brain-map.org/grid_data/download/74819249?include=density', 'temp.zip');

...


    unzip('temp.zip','Rasd2_73636089');

...

  
    % Download and unzip density volume file for BLAa injection SectionDataSet 113144533

...


    mkdir('BLAa_113144533');

...


    urlwrite('http://api.brain-map.org/grid_data/download/113144533?include=density', 'temp.zip');

...


    unzip('temp.zip','BLAa_113144533');

...


 
    % Gene expression grids are at 200 micron resolution.

...


    geneGridSize = 

...

[67 41 58

...

];

...

    fid = fopen('Rasd2_73636089/density.raw', 'r', 'l'

...

  );

...

    Rasd2 = fread( fid, prod(geneGridSize), 'float' );

...

    fclose(fid);

...

    Rasd2 = reshape( Rasd2, geneGridSize );

...


 
    % Projection grids are at 100 micron 

...

resolution
    projectionGridSize = 

...

[133 81 115

...

];

...

    fid = fopen('BLAa_113144533/density.raw', 'r', 'l'

...

  );

...

    BLAa = fread( fid, prod(projectionGridSize), 'float' );

...

    fclose(fid);

...

    BLAa = reshape( BLAa, projectionGridSize );

...


 
    % Upsample gene expression grid to same dimension as projection grid using linear 

...

interpolation
    [xi,yi,zi

...

] = meshgrid(1:0.5:41,1:0.5:67,1:0.5:58); %note: matlab transposes x-y

...

    d = Rasd2; d(d<0) = 0; % fill in missing data as zeroes

...

    Rasd2_100 = interp3(d ,xi,yi,zi,'linear');

...


 
    % Handle "no data" (-1) voxels.

...


    % Create a mask of "data" vs "no data" voxels and apply linear interpolation

...


    m = (Rasd2  >= 0); mi = interp3(m,xi,yi,zi,'linear');

...


 
    % Normalize data by dividing by interpolated mask. Assign value of "-1" to "no data" voxels.

...


    Rasd2_100 = Rasd2_100 ./ mi;

...


    Rasd2_100( mi <= 0 ) = -1;

...


 
    % Create a merged image of one coronal plane;

...


    gimg = squeeze(Rasd2_100(52,:,

...

:)); gimg = max(0,gimg); gimg = gimg / 0.025; gimg = min(1,gimg);

...

    pimg = squeeze(BLAa(52,:,

...

:)); pimg = max(0,pimg); pimg = pimg / 0.8; pimg = min(1,pimg);

...

    rgb = zeros(

...

[size(gimg),3

...

]); rgb(:,:,1) = gimg; rgb(:,:,2) = pimg;

...

    figure; image(rgb);

Figure: ISH SectionDataSet (id=73636089) for gene Rasd2 showing enriched expression in the striatum (left). Projection SectionDataSet (id=73636089) with injection in the anterior part of the basolateral amygdalar nucleus (BLAa) showing projection to the striatum and other brain areas (center). One coronal slice of the BLAa projection density grid (green) merged with an upsampled and interpolated Rasd2 expression density grid (red).