Skip to content

Commit 1573810

Browse files
IBCHGenomic
Finished the first part and writing the last part
1 parent 2b939e6 commit 1573810

File tree

5 files changed

+216
-1
lines changed

5 files changed

+216
-1
lines changed

main.rs

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
use crate::annotation::ontologyannotate;
2+
use crate::args::CommandParse;
3+
use crate::args::Commands;
4+
use crate::clinicvar::clinvarmapper;
5+
use crate::clinvarlinker::clinvarvcf;
6+
use crate::medgen::cuiparallel;
7+
use crate::ncbigeneid::ncbiannotate;
8+
use crate::omim::omimevidence;
9+
use crate::phenotype::phenotypeall;
10+
use crate::databases::databasedownload;
11+
use clap::Parser;
12+
13+
/*
14+
Authom GauravSablok
15+
Instytut Chemii Bioorganicznej
16+
Polskiej Akademii Nauk
17+
ul. Noskowskiego 12/14 | 61-704, Poznań
18+
Date: 2025-4-8
19+
*/
20+
21+
fn main() {
22+
let argsparse = CommandParse::parse();
23+
match &argsparse.command {
24+
Commands::CUIGENERATE {
25+
medgenhpo,
26+
medgen_omim,
27+
medgenmapping,
28+
medgenpubmed,
29+
} => {
30+
let command = cuiparallel(medgenhpo, medgen_omim, medgenmapping, medgenpubmed).unwrap();
31+
println!("The command has been completed:{:?}", command);
32+
}
33+
Commands::OMIM {
34+
omimfile,
35+
evidencenumber,
36+
hpomapping,
37+
hpomedgen,
38+
} => {
39+
let command = omimevidence(omimfile, evidencenumber, hpomapping, hpomedgen).unwrap();
40+
println!("The links for the given evidence are:{:?}", command);
41+
}
42+
Commands::CLINVAROMIMEVIDENCE {
43+
clinvar,
44+
medgen,
45+
medgenhpo,
46+
omim,
47+
} => {
48+
let command = clinvarmapper(clinvar, medgen, medgenhpo, omim).unwrap();
49+
println!("The command has completed:{:?}", command);
50+
}
51+
Commands::NCBIANNOTATE {
52+
ncbigeneid,
53+
clinvar,
54+
medgenomim,
55+
medgenhpo,
56+
omimsearch,
57+
} => {
58+
let command =
59+
ncbiannotate(ncbigeneid, clinvar, medgenomim, medgenhpo, omimsearch).unwrap();
60+
println!("The command has completed:{:?}", command);
61+
}
62+
Commands::ANNOTATOR {
63+
pathncbimaxo,
64+
medgenomim,
65+
medgenhpo,
66+
evidence,
67+
} => {
68+
let command = ontologyannotate(pathncbimaxo, medgenomim, medgenhpo, evidence).unwrap();
69+
println!("The command has been completed:{:?}", command)
70+
}
71+
Commands::VCFCLINVARANNOTATE { vcffile, clinvar } => {
72+
let command = clinvarvcf(vcffile, clinvar).unwrap();
73+
println!(
74+
"The command has finished and the annotated vcf file has been written:{:?}",
75+
command
76+
);
77+
}
78+
Commands::PHENOTYPELINKER {
79+
genesdisease,
80+
genesphenotype,
81+
phenotypehpoa,
82+
phenotypesgenes,
83+
} => {
84+
let command =
85+
phenotypeall(genesdisease, genesphenotype, phenotypehpoa, phenotypesgenes).unwrap();
86+
println!("The command has finished: {:?}", command);
87+
}
88+
Commands::Databases { databaseoption } => {
89+
let command = databasedownload(*databaseoption).unwrap();
90+
println!("The command has been finished and all the files have been downloaded:{}", command);
91+
}
92+
}
93+
}

src/args.rs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
use clap::{Parser, Subcommand};
2+
#[derive(Debug, Parser)]
3+
#[command(
4+
name = "varlinker",
5+
version = "1.0",
6+
about = "specific position annotator for human genomics.
7+
************************************************
8+
Gaurav Sablok, IBCH, PAN, Poznan, Poland,
9+
https://portal.ichb.pl/laboratory-of-genomics/.
10+
11+
Prof. Luiza Handschuh
12+
13+
************************************************"
14+
)]
15+
pub struct CommandParse {
16+
/// subcommands for the specific actions
17+
#[command(subcommand)]
18+
pub command: Commands,
19+
}
20+
21+
#[derive(Subcommand, Debug)]
22+
pub enum Commands {
23+
/// annotate the specific coordinate
24+
VARIANTLINKER {
25+
/// variant VCF file
26+
vcfile: String,
27+
},
28+
}

src/main.rs

100644100755
Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,29 @@
1+
mod args;
2+
mod store;
3+
mod variantlinker;
4+
use crate::args::CommandParse;
5+
use crate::args::Commands;
6+
use clap::Parser;
7+
8+
/*
9+
Authom GauravSablok
10+
Instytut Chemii Bioorganicznej
11+
Polskiej Akademii Nauk
12+
ul. Noskowskiego 12/14 | 61-704, Poznań
13+
Date: 2025-4-8
14+
*/
15+
116
fn main() {
2-
println!("Hello, world!");
17+
let argsparse = CommandParse::parse();
18+
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();
26+
println!("The command has been completed:{:?}", command);
27+
}
28+
}
329
}

src/store.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#[derive(Debug, Clone, PartialOrd, PartialEq)]
2+
3+
pub struct VCF {
4+
pub chrom: String,
5+
pub pos: usize,
6+
pub id: String,
7+
pub refnuc: String,
8+
pub altnuc: String,
9+
pub qual: String,
10+
}
11+
12+
#[derive(Debug, Clone, PartialOrd, PartialEq)]
13+
14+
pub struct GENCODE {
15+
pub
16+
}

src/variantlinker.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+
Authom GauravSablok
10+
Instytut Chemii Bioorganicznej
11+
Polskiej Akademii Nauk
12+
ul. Noskowskiego 12/14 | 61-704, Poznań
13+
Date: 2025-4-8
14+
*/
15+
16+
pub async fn varlinker(pathfile : &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)