Skip to content

Commit 6dd13d6

Browse files
IBCHgenomic
starting the final compilation
1 parent 1573810 commit 6dd13d6

File tree

7 files changed

+163
-11
lines changed

7 files changed

+163
-11
lines changed

README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,30 @@
55
- Parallel threaded variant linker.
66
- sample vcf file from [vcflib](https://github.com/vcflib/vcflib/blob/master/samples/sample.vcf)
77

8+
9+
```
10+
specific position annotator for human genomics.
11+
************************************************
12+
Gaurav Sablok, IBCH, PAN, Poznan, Poland,
13+
https://portal.ichb.pl/laboratory-of-genomics/.
14+
15+
Prof. Luiza Handschuh
16+
17+
************************************************
18+
19+
Usage: varlinker <COMMAND>
20+
21+
Commands:
22+
variantlinker annotate the specific coordinate
23+
variantrefanno extract the annotation of the specific ref allele
24+
variantaltanno extract the annotation of the specific alt allele
25+
help Print this message or the help of the given subcommand(s)
26+
27+
Options:
28+
-h, --help Print help
29+
-V, --version Print version
30+
```
31+
832
- Acknowledgements: MOSAIC platform, developed as part of the ECBiG-MOSAIC project (POIR.04.02.00-00-D017/20), co-financed by the European Regional Development Fund (ERDF) under the Smart Growth Operational Programme 2014-2020, Measure 4.2 for the development of modern research infrastructure in the science sector.
933
- Project PI and Informal queries: Prof. Luiza Handschuh: [email protected].
1034
- Code related queries: Dr. Gaurav Sablok: [email protected].

src/args.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,18 @@ pub enum Commands {
2525
/// variant VCF file
2626
vcfile: String,
2727
},
28+
/// extract the annotation of the specific ref allele
29+
VARIANTREFANNO {
30+
/// variant VCF file
31+
vcffile: String,
32+
/// ref allele
33+
refallele: String,
34+
},
35+
/// extract the annotation of the specific alt allele
36+
VARIANTALTANNO {
37+
/// variant VCF file
38+
vcffile: String,
39+
/// alt allele
40+
altallel: String,
41+
}
2842
}

src/main.rs

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
11
mod args;
22
mod store;
33
mod variantlinker;
4+
mod varaltannot;
5+
mod varrefannot;
46
use crate::args::CommandParse;
57
use crate::args::Commands;
68
use clap::Parser;
9+
use crate::variantlinker::varlinker;
10+
use crate::varrefannot::varrefanno;
11+
use crate::varaltannot::varaltanno;
12+
713

814
/*
915
Authom GauravSablok
@@ -16,13 +22,16 @@ use clap::Parser;
1622
fn main() {
1723
let argsparse = CommandParse::parse();
1824
match &argsparse.command {
19-
Commands::CUIGENERATE {
20-
medgenhpo,
21-
medgen_omim,
22-
medgenmapping,
23-
medgenpubmed,
24-
} => {
25-
let command = cuiparallel(medgenhpo, medgen_omim, medgenmapping, medgenpubmed).unwrap();
25+
Commands::VARIANTLINKER { vcfile } => {
26+
let command = varlinker(vcfile).unwrap();
27+
println!("The command has been completed:{:?}", command);
28+
}
29+
Commands::VARIANTALTANNO { vcffile, altallel } => {
30+
let command = varaltanno(vcffile, altallel).unwrap();
31+
println!("The command has been completed:{:?}", command);
32+
}
33+
Commands::VARIANTREFANNO { vcffile, refallele } => {
34+
let command = varrefanno(vcffile, refallele).unwrap();
2635
println!("The command has been completed:{:?}", command);
2736
}
2837
}

src/store.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,6 @@ pub struct VCF {
1212
#[derive(Debug, Clone, PartialOrd, PartialEq)]
1313

1414
pub struct GENCODE {
15-
pub
15+
pub chrom: String,
16+
pub typeannotate: String,
1617
}

src/varaltannot.rs

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
use std::fs::File;
2+
use std::io::{BufReader, BufRead};
3+
use std::error::Error;
4+
use std::process::Command;
5+
use crate::store::VCF;
6+
7+
8+
/*
9+
Author Gaurav Sablok
10+
Instytut Chemii Bioorganicznej
11+
Polskiej Akademii Nauk
12+
ul. Noskowskiego 12/14 | 61-704, Poznań
13+
Date: 2025-6-9
14+
*/
15+
16+
pub fn varaltanno(pathfile : &str, variant: &str) -> Result<String, Box<dyn Error>>{
17+
18+
let _ = Command::new("wegt").
19+
arg("https://ftp.ebi.ac.uk/pub/databases/gencode/Gencode_human/release_48/gencode.v48.chr_patch_hapl_scaff.annotation.gtf.gz")
20+
.output()
21+
.expect("command failed");
22+
let _ = Command::new("gunzip").arg("gencode.v48.chr_patch_hapl_scaff.annotation.gtf.gz")
23+
.output()
24+
.expect("command failed");
25+
let fileopen = File::open(pathfile).expect("file not present");
26+
let fileread = BufReader::new(fileopen);
27+
let gtfopen = File::open("gencode.v48.chr_patch_hapl_scaff.annotation.gtf")
28+
.expect("file not present");
29+
let gtfread = BufReader::new(gtfopen);
30+
let exonvector:Vec<String> = Vec::new();
31+
let gene: Vec<String> = Vec::new();
32+
let mut vcstring_file: Vec<VCF> = Vec::new();
33+
for i in fileread.lines(){
34+
let linevcf = i.expect("file not present");
35+
let linevec:Vec<String> = linevcf.split("\t").
36+
map(|x|x.to_string())
37+
.collect::<Vec<_>>();
38+
vcstring_file.push(VCF{
39+
chrom: linevec[0].to_string(),
40+
pos: linevec[1].parse::<usize>().unwrap(),
41+
id: linevec[2].to_string(),
42+
refnuc: linevec[3].to_string(),
43+
altnuc: linevec[4].to_string(),
44+
qual: linevec[5].to_string(),
45+
});
46+
}
47+
48+
49+
50+
51+
Ok("The regions have been annotated".to_string())
52+
}

src/variantlinker.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ use crate::store::VCF;
66

77

88
/*
9-
Authom GauravSablok
9+
Author Gaurav Sablok
1010
Instytut Chemii Bioorganicznej
1111
Polskiej Akademii Nauk
1212
ul. Noskowskiego 12/14 | 61-704, Poznań
13-
Date: 2025-4-8
13+
Date: 2025-6-9
1414
*/
1515

16-
pub async fn varlinker(pathfile : &str) -> Result<String, Box<dyn Error>>{
16+
pub fn varlinker(pathfile : &str) -> Result<String, Box<dyn Error>>{
1717

1818
let _ = Command::new("wegt").
1919
arg("https://ftp.ebi.ac.uk/pub/databases/gencode/Gencode_human/release_48/gencode.v48.chr_patch_hapl_scaff.annotation.gtf.gz")

src/varrefannot.rs

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
use std::fs::File;
2+
use std::io::{BufReader, BufRead};
3+
use std::error::Error;
4+
use std::process::Command;
5+
use crate::store::VCF;
6+
7+
8+
/*
9+
Author Gaurav Sablok
10+
Instytut Chemii Bioorganicznej
11+
Polskiej Akademii Nauk
12+
ul. Noskowskiego 12/14 | 61-704, Poznań
13+
Date: 2025-6-9
14+
*/
15+
16+
pub fn varrefanno(pathfile : &str, variant: &str) -> Result<String, Box<dyn Error>>{
17+
18+
let _ = Command::new("wegt").
19+
arg("https://ftp.ebi.ac.uk/pub/databases/gencode/Gencode_human/release_48/gencode.v48.chr_patch_hapl_scaff.annotation.gtf.gz")
20+
.output()
21+
.expect("command failed");
22+
let _ = Command::new("gunzip").arg("gencode.v48.chr_patch_hapl_scaff.annotation.gtf.gz")
23+
.output()
24+
.expect("command failed");
25+
let fileopen = File::open(pathfile).expect("file not present");
26+
let fileread = BufReader::new(fileopen);
27+
let gtfopen = File::open("gencode.v48.chr_patch_hapl_scaff.annotation.gtf")
28+
.expect("file not present");
29+
let gtfread = BufReader::new(gtfopen);
30+
let exonvector:Vec<String> = Vec::new();
31+
let gene: Vec<String> = Vec::new();
32+
let mut vcstring_file: Vec<VCF> = Vec::new();
33+
for i in fileread.lines(){
34+
let linevcf = i.expect("file not present");
35+
let linevec:Vec<String> = linevcf.split("\t").
36+
map(|x|x.to_string())
37+
.collect::<Vec<_>>();
38+
vcstring_file.push(VCF{
39+
chrom: linevec[0].to_string(),
40+
pos: linevec[1].parse::<usize>().unwrap(),
41+
id: linevec[2].to_string(),
42+
refnuc: linevec[3].to_string(),
43+
altnuc: linevec[4].to_string(),
44+
qual: linevec[5].to_string(),
45+
});
46+
}
47+
48+
49+
50+
51+
Ok("The regions have been annotated".to_string())
52+
}

0 commit comments

Comments
 (0)