Coder Social home page Coder Social logo

mrcfile.jl's Introduction

MRCFile.jl

Lifecycle Build Status Coverage Stable Dev Code Style: Blue

MRCFile.jl implements the MRC2014 format for storing image and volume data such as those produced by electron microscopy. It offers the ability to read, edit, and write MRC files, as well as utility functions for extracting useful information from the headers.

The key type is MRCData, which contains the contents of the MRC file, accessible with header and extendedheader. MRCData is an AbstractArray whose elements are those of the data portion of the file and can be accessed or modified accordingly.

Installation

using Pkg
Pkg.add("MRCFile")

Example

This example downloads a map of TRPV1 and animates slices taken through the map.

To set-up this example, install FTPClient and Plots with

using Pkg
Pkg.add("FTPClient")
Pkg.add("Plots")
using MRCFile, FTPClient, Plots

emdid = 5778 # TRPV1
ftp = FTP(hostname = "ftp.rcsb.org/pub/emdb/structures/EMD-$(emdid)/map")
dmap = read(download(ftp, "emd_$(emdid).map.gz"), MRCData)
close(ftp)
dmin, dmax = extrema(header(dmap))
drange = dmax - dmin

anim = @animate for xsection in eachmapsection(dmap)
    plot(RGB.((xsection .- dmin) ./ drange))
end

gif(anim, "emd-$(emdid)_slices.gif", fps = 30)

EMD-5778 slices

Reading a map as a memory-mapped array

MRC files can be huge. It is convenient then to load their data as memory-mapped arrays. This is easy to do:

using MRCFile

path = "mymap.mrc" # path to large uncompressed MRC file
mrc = read_mmap(path, MRCData)
... # do something

Note that writing to memory-mapped arrays is currently not supported.

Related packages

mrcfile is a full-featured Python implementation of of the MRC2014 format.

mrcfile.jl's People

Contributors

sethaxen avatar ehgus avatar github-actions[bot] avatar shuuul avatar andreaskroepelin avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.