Skip to content

Commit e268715

Browse files
committed
2 parents 062210d + 4d4799b commit e268715

11 files changed

Lines changed: 761 additions & 23 deletions

File tree

‎LICENSE‎

Lines changed: 674 additions & 0 deletions
Large diffs are not rendered by default.

‎README.md‎

Lines changed: 28 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,51 @@
11
# HelixerPost
22
## Dependencies
3+
### Rust
4+
A recent version of Rust (see https://www.rust-lang.org/tools/install)
5+
36
### hd5 libraries
47
On fedora & co. you will need `hdf5-devel`, while on ubuntu & co. you will need `libhdf5-dev`.
5-
Currently it's also necessary to manually build the 'lzf' compression support from h5py (https://pypi.org/project/h5py/) as a shared library and install to the hdf5 plugins directory
8+
9+
### hd5 lzf support (Skip if unsure)
10+
If you need the 'lzf' compression support (no longer needed on recent Helixer versions), you will need to download it from h5py (https://pypi.org/project/h5py/) and manually build it as a shared library and install to the hdf5 plugins directory. This will also require a C toolchain - the system provided GCC should be fine.
611

712
`tar -xzvf h5py-3.2.1.tar.gz`
813

914
`cd h5py-3.2.1/lzf/`
1015

11-
### Fedora
16+
**Fedora**
17+
1218
`gcc -O2 -fPIC -shared -Ilzf lzf/*.c lzf_filter.c -lhdf5 -o liblzf_filter.so`
1319

1420
`sudo mkdir -p /usr/local/hdf5/lib/plugin`
1521

1622
`sudo cp liblzf_filter.so /usr/local/hdf5/lib/plugin`
1723

18-
### Ubuntu
24+
**Ubuntu**
25+
1926
`gcc -O2 -fPIC -shared -Ilzf -I/usr/include/hdf5/serial/ lzf/*.c lzf_filter.c -lhdf5 -L/lib/x86_64-linux-gnu/hdf5/serial -o liblzf_filter.so`
2027

2128
`sudo mkdir /usr/lib/x86_64-linux-gnu/hdf5/plugins`
2229

2330
`sudo cp liblzf_filter.so /usr/lib/x86_64-linux-gnu/hdf5/plugins`
2431

32+
## Building HelixerPost
33+
34+
`git clone https://github.com/TonyBolger/HelixerPost.git`
35+
36+
`cd HelixerPost`
37+
38+
`cargo build --release`
39+
40+
The resulting binary is './targets/release/helixer_post_bin'
41+
42+
Running `./target/release/helixer_post_bin` should show the command line parameters, giving:
43+
44+
`HelixerPost <genome.h5> <predictions.h5> <window_size> <edge_thresh> <peak_thresh> <min_coding_length> <output.gff>`
45+
46+
In order for Helixer to find this binary, it needs to be on the PATH. The easiest way to achieve this is to copy
47+
the binary to the bin folder in the virtual environment which you previously created for Helixer
48+
(e.g. `path_to_Helixer/env/bin` )
2549

2650
## Concept
2751
HelixerPost uses a sliding window assessment to determine regions of the genome which are likely gene containing.
@@ -35,8 +59,6 @@ genic score within the window exceeds the edge threshold, and continues until th
3559
that window. The candidate region is accepted if it also contains at least one window with a genic score above
3660
the required peak threshold.
3761

38-
39-
4062
## Parameters
4163

4264
`HelixerPost <genome.h5> <predictions.h5> <window_size> <edge_thresh> <peak_thresh> <min_coding_length> <output.gff>`
@@ -58,20 +80,13 @@ this value (e.g. 60)
5880

5981
output.gff: The path for the output GFF file
6082

61-
6283
## Example Usage
6384

6485
Using 100bp sliding window for genic detection, 0.1 edge threshold, 0.8 peak threshold (before HMM)
6586

6687
60bp minimum CDS length per gene (after HMM)
6788

68-
### One Step:
69-
70-
`cargo run --release genome_data.h5 predictions.h5 100 0.1 0.8 60 output.gff`
71-
72-
### Two Step:
73-
74-
`cargo build --release`
89+
From the HelixerPost dir:
7590

7691
`./target/release/helixer_post_bin genome_data.h5 predictions.h5 100 0.1 0.8 60 output.gff`
7792

‎example/example.md‎

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Example HelixerPost data
2+
3+
## source
4+
The following was created from the first 21384 base pairs
5+
of NC\_023163.2 in the Oryza\_brachyantha genome, version
6+
GCF\_000231095.2\_ObraRS2 from refseq.
7+
8+
The genome was preprocessed into numeric form (genome\_data.h5) with `fasta2h5py`,
9+
and base-wise genic predictions (predictions.h5) were created with `HybridModel.h5`
10+
both from the Helixer project (https://github.com/weberlab-hhu/Helixer).
11+
12+
## usage
13+
From this directory
14+
15+
```
16+
helixer_post_bin genome_data.h5 predictions.h5 100 0.1 0.8 60 output.gff3
17+
```
18+
19+
## expected output
20+
21+
Using the provided data, the above should create the file 'output.gff3',
22+
and the contents there of are expected to be as follows (as of commit b674af9):
23+
24+
```
25+
##gff-version 3.2.1
26+
##species Oryza_brachyantha
27+
# f4f3f7bf629d02431241bfef18cb8ade /home/ali/.local/share/Helixer/models/land_plant/land_plant_v0.3_a_0100.h5
28+
##sequence-region NC_023163.2:1-21384 1 21384
29+
NC_023163.2:1-21384 Helixer gene 17026 18898 . + . ID=Oryza_brachyantha_NC_023163.2:1-21384_000001
30+
NC_023163.2:1-21384 Helixer mRNA 17026 18898 . + . ID=Oryza_brachyantha_NC_023163.2:1-21384_000001.1;Parent=Oryza_brachyantha_NC_023163.2:1-21384_000001
31+
NC_023163.2:1-21384 Helixer exon 17026 17356 . + . ID=Oryza_brachyantha_NC_023163.2:1-21384_000001.1.exon.1;Parent=Oryza_brachyantha_NC_023163.2:1-21384_000001.1
32+
NC_023163.2:1-21384 Helixer five_prime_UTR 17026 17115 . + . ID=Oryza_brachyantha_NC_023163.2:1-21384_000001.1.five_prime_UTR.1;Parent=Oryza_brachyantha_NC_023163.2:1-21384_000001.1
33+
NC_023163.2:1-21384 Helixer CDS 17116 17356 . + 0 ID=Oryza_brachyantha_NC_023163.2:1-21384_000001.1.CDS.1;Parent=Oryza_brachyantha_NC_023163.2:1-21384_000001.1
34+
NC_023163.2:1-21384 Helixer exon 17707 18898 . + . ID=Oryza_brachyantha_NC_023163.2:1-21384_000001.1.exon.2;Parent=Oryza_brachyantha_NC_023163.2:1-21384_000001.1
35+
NC_023163.2:1-21384 Helixer CDS 17707 18305 . + 2 ID=Oryza_brachyantha_NC_023163.2:1-21384_000001.1.CDS.2;Parent=Oryza_brachyantha_NC_023163.2:1-21384_000001.1
36+
NC_023163.2:1-21384 Helixer three_prime_UTR 18306 18898 . + . ID=Oryza_brachyantha_NC_023163.2:1-21384_000001.1.three_prime_UTR.1;Parent=Oryza_brachyantha_NC_023163.2:1-21384_000001.1
37+
```
38+

‎example/genome_data.h5‎

42.1 KB
Binary file not shown.

‎example/predictions.h5‎

491 KB
Binary file not shown.

‎helixer_post_bin/Cargo.toml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ authors = ["Tony Bolger <bolger.tony@gmail.com>"]
55
edition = "2018"
66

77
[dependencies]
8-
hdf5 = "0.7.1"
9-
ndarray = "0.14.0"
8+
hdf5 = "0.8.1"
9+
ndarray = "0.15.6"

‎helixer_post_bin/src/gff.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,12 +204,12 @@ impl<W: Write> GffWriter<W> {
204204
pub fn write_global_header(
205205
&mut self,
206206
species: Option<&str>,
207-
helixer_model_md5sum: Option<&str>,
207+
helixer_model_md5sum: Option<String>,
208208
) -> std::io::Result<()> {
209209
const GFF_VERSION: &'static str = "3.2.1";
210210
write!(self.writer, "##gff-version {}\n", GFF_VERSION)?;
211211
if let Some(species) = species {
212-
write!(self.writer, "##{}\n", species)?;
212+
write!(self.writer, "##species {}\n", species)?;
213213
}
214214
if let Some(helixer_model_md5sum) = helixer_model_md5sum {
215215
write!(self.writer, "# {}\n", helixer_model_md5sum)?;

‎helixer_post_bin/src/main.rs‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@ use helixer_post_bin::analysis::hmm::show_hmm_config;
33
use helixer_post_bin::analysis::rater::SequenceRating;
44
use helixer_post_bin::analysis::Analyzer;
55
use helixer_post_bin::gff::GffWriter;
6+
use helixer_post_bin::results::raw::RawHelixerPredictions;
67
use helixer_post_bin::results::HelixerResults;
78
use std::fs::File;
89
use std::io::BufWriter;
10+
use std::path::Path;
911
use std::process::exit;
1012

1113
fn main() {
@@ -56,8 +58,11 @@ fn main() {
5658
1,
5759
"Error: Multiple Species are not allowed for GFF output."
5860
);
59-
let model_md5sum = None; // TODO: this should fetch <hdf5>.attrs['model_md5sum']
61+
let rhg = RawHelixerPredictions::new(&Path::new(predictions_path))
62+
.expect("Error: Something went wrong while accessing the predictions.");
63+
let model_md5sum = rhg.get_model_md5sum().ok();
6064
let species_name = helixer_res.get_all_species().first().map(|x| x.get_name());
65+
6166
gff_writer
6267
.write_global_header(species_name, model_md5sum)
6368
.expect(&*format!(

‎helixer_post_bin/src/results/iter.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ impl<'a, T: H5Type + Clone + Copy> BlockedDataset1D<'a, T> {
5050

5151
fn get_data_for_block(&self, block_id: BlockID) -> hdf5::Result<Array1<T>> {
5252
let slice = s![block_id.inner(), ..];
53-
self.dataset.read_slice_1d::<T, _>(&slice)
53+
self.dataset.read_slice_1d(slice)
5454
}
5555
}
5656

@@ -164,7 +164,7 @@ impl<'a, T: ArrayConvInto<O>, O> BlockedDataset2D<'a, T, O> {
164164

165165
fn get_data_for_block(&self, block_id: BlockID) -> hdf5::Result<Array2<T>> {
166166
let slice = s![block_id.inner(), .., ..];
167-
self.dataset.read_slice_2d::<T, _>(&slice)
167+
self.dataset.read_slice_2d(slice)
168168
}
169169
}
170170

‎helixer_post_bin/src/results/raw/genome.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ pub enum ErrSamples
2828
}
2929
*/
3030

31-
type SeqidsType = FixedAscii<[u8; 50]>;
32-
type SpeciesType = FixedAscii<[u8; 25]>;
31+
type SeqidsType = FixedAscii<50>;
32+
type SpeciesType = FixedAscii<25>;
3333

3434
impl RawHelixerGenome {
3535
pub fn new(

0 commit comments

Comments
 (0)