Skip to content

Commit c1d1d4a

Browse files
IBCHgenomic
all asynchronous and prepairing for the final release.
1 parent 7a2402e commit c1d1d4a

File tree

6 files changed

+29
-26
lines changed

6 files changed

+29
-26
lines changed

src/args.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,19 @@ pub struct CommandParse {
2121
#[derive(Subcommand, Debug)]
2222
pub enum Commands {
2323
/// annotate the specific coordinate
24-
VARIANTLINKER {
24+
VariantLINKER {
2525
/// variant VCF file
2626
vcfile: String,
2727
},
2828
/// extract the annotation of the specific ref allele
29-
VARIANTREFANNO {
29+
VariantTREFANNO {
3030
/// variant VCF file
3131
vcffile: String,
3232
/// ref allele
3333
refallele: String,
3434
},
3535
/// extract the annotation of the specific alt allele
36-
VARIANTALTANNO {
36+
VariantTALTANNO {
3737
/// variant VCF file
3838
vcffile: String,
3939
/// alt allele

src/main.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ use crate::args::Commands;
88
use crate::varaltannot::varaltanno;
99
use crate::variantlinker::varlinker;
1010
use crate::varrefannot::varrefanno;
11-
use clap::Parser;
1211
use async_std::task;
12+
use clap::Parser;
1313

1414
/*
1515
Authom GauravSablok
@@ -22,15 +22,15 @@ use async_std::task;
2222
fn main() {
2323
let argsparse = CommandParse::parse();
2424
match &argsparse.command {
25-
Commands::VARIANTLINKER { vcfile } => {
25+
Commands::VariantLINKER { vcfile } => {
2626
let command = task::block_on(varlinker(vcfile)).unwrap();
2727
println!("The command has been completed:{:?}", command);
2828
}
29-
Commands::VARIANTALTANNO { vcffile, altallel } => {
29+
Commands::VariantTALTANNO { vcffile, altallel } => {
3030
let command = task::block_on(varaltanno(vcffile, altallel)).unwrap();
3131
println!("The command has been completed:{:?}", command);
3232
}
33-
Commands::VARIANTREFANNO { vcffile, refallele } => {
33+
Commands::VariantTREFANNO { vcffile, refallele } => {
3434
let command = task::block_on(varrefanno(vcffile, refallele)).unwrap();
3535
println!("The command has been completed:{:?}", command);
3636
}

src/store.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ pub struct VCF {
1111

1212
#[derive(Debug, Clone, PartialOrd, PartialEq)]
1313

14-
pub struct GENCODE {
14+
pub struct GenCode {
1515
pub chrom: String,
1616
pub typeannotate: String,
1717
pub start: usize,

src/varaltannot.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use crate::store::VCF;
2-
use crate::store::{GENCODE, OUTPUT};
2+
use crate::store::{GenCode, OUTPUT};
3+
use async_std::task;
34
use std::error::Error;
45
use std::fs::File;
56
use std::io::Write;
@@ -25,8 +26,8 @@ pub async fn varaltanno(pathfile: &str, variant: &str) -> Result<String, Box<dyn
2526
.expect("command failed");
2627
let fileopen = File::open(pathfile).expect("file not present");
2728
let fileread = BufReader::new(fileopen);
28-
let gtfresults: Vec<GENCODE> =
29-
gtfread("gencode.v48.chr_patch_hapl_scaff.annotation.gtf").unwrap();
29+
let gtfresults: Vec<GenCode> =
30+
task::block_on(gtfread("gencode.v48.chr_patch_hapl_scaff.annotation.gtf")).unwrap();
3031
let mut vcstring_file: Vec<VCF> = Vec::new();
3132
for i in fileread.lines() {
3233
let linevcf = i.expect("file not present");
@@ -79,10 +80,10 @@ pub async fn varaltanno(pathfile: &str, variant: &str) -> Result<String, Box<dyn
7980
Ok("The regions have been annotated".to_string())
8081
}
8182

82-
pub fn gtfread(gtffile: &str) -> Result<Vec<GENCODE>, Box<dyn Error>> {
83+
pub async fn gtfread(gtffile: &str) -> Result<Vec<GenCode>, Box<dyn Error>> {
8384
let fileopen = File::open(gtffile).expect("file not found");
8485
let fileread = BufReader::new(fileopen);
85-
let mut gtf_vector: Vec<GENCODE> = Vec::new();
86+
let mut gtf_vector: Vec<GenCode> = Vec::new();
8687
for i in fileread.lines() {
8788
let linegtf = i.expect("line not found");
8889
let linevec: Vec<String> = linegtf
@@ -94,7 +95,7 @@ pub fn gtfread(gtffile: &str) -> Result<Vec<GENCODE>, Box<dyn Error>> {
9495
.split("-")
9596
.collect::<Vec<_>>()[1]
9697
.to_string();
97-
gtf_vector.push(GENCODE {
98+
gtf_vector.push(GenCode {
9899
chrom: linevec[0].clone(),
99100
typeannotate: linevec[2].clone(),
100101
start: linevec[3].parse::<usize>().unwrap(),

src/variantlinker.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
use crate::store::GENCODE;
1+
use crate::store::GenCode;
22
use crate::store::OUTPUT;
33
use crate::store::VCF;
4+
use async_std::task;
45
use std::error::Error;
56
use std::fs::File;
67
use std::io::Write;
@@ -26,8 +27,8 @@ pub async fn varlinker(pathfile: &str) -> Result<String, Box<dyn Error>> {
2627
.expect("command failed");
2728
let fileopen = File::open(pathfile).expect("file not present");
2829
let fileread = BufReader::new(fileopen);
29-
let gtfresults: Vec<GENCODE> =
30-
gtfread("gencode.v48.chr_patch_hapl_scaff.annotation.gtf").unwrap();
30+
let gtfresults: Vec<GenCode> =
31+
task::block_on(gtfread("gencode.v48.chr_patch_hapl_scaff.annotation.gtf")).unwrap();
3132
let mut vcstring_file: Vec<VCF> = Vec::new();
3233
for i in fileread.lines() {
3334
let linevcf = i.expect("file not present");
@@ -81,10 +82,10 @@ pub async fn varlinker(pathfile: &str) -> Result<String, Box<dyn Error>> {
8182
Ok("The regions have been annotated".to_string())
8283
}
8384

84-
pub fn gtfread(gtffile: &str) -> Result<Vec<GENCODE>, Box<dyn Error>> {
85+
pub async fn gtfread(gtffile: &str) -> Result<Vec<GenCode>, Box<dyn Error>> {
8586
let fileopen = File::open(gtffile).expect("file not found");
8687
let fileread = BufReader::new(fileopen);
87-
let mut gtf_vector: Vec<GENCODE> = Vec::new();
88+
let mut gtf_vector: Vec<GenCode> = Vec::new();
8889
for i in fileread.lines() {
8990
let linegtf = i.expect("line not found");
9091
let linevec: Vec<String> = linegtf
@@ -96,7 +97,7 @@ pub fn gtfread(gtffile: &str) -> Result<Vec<GENCODE>, Box<dyn Error>> {
9697
.split("-")
9798
.collect::<Vec<_>>()[1]
9899
.to_string();
99-
gtf_vector.push(GENCODE {
100+
gtf_vector.push(GenCode {
100101
chrom: linevec[0].clone(),
101102
typeannotate: linevec[2].clone(),
102103
start: linevec[3].parse::<usize>().unwrap(),

src/varrefannot.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use crate::store::VCF;
2-
use crate::store::{GENCODE, OUTPUT};
2+
use crate::store::{GenCode, OUTPUT};
3+
use async_std::task;
34
use std::error::Error;
45
use std::fs::File;
56
use std::io::Write;
@@ -25,8 +26,8 @@ pub async fn varrefanno(pathfile: &str, variant: &str) -> Result<String, Box<dyn
2526
.expect("command failed");
2627
let fileopen = File::open(pathfile).expect("file not present");
2728
let fileread = BufReader::new(fileopen);
28-
let gtfresults: Vec<GENCODE> =
29-
gtfread("gencode.v48.chr_patch_hapl_scaff.annotation.gtf").unwrap();
29+
let gtfresults: Vec<GenCode> =
30+
task::block_on(gtfread("gencode.v48.chr_patch_hapl_scaff.annotation.gtf")).unwrap();
3031
let mut vcstring_file: Vec<VCF> = Vec::new();
3132
for i in fileread.lines() {
3233
let linevcf = i.expect("file not present");
@@ -79,10 +80,10 @@ pub async fn varrefanno(pathfile: &str, variant: &str) -> Result<String, Box<dyn
7980
Ok("The regions have been annotated".to_string())
8081
}
8182

82-
pub fn gtfread(gtffile: &str) -> Result<Vec<GENCODE>, Box<dyn Error>> {
83+
pub async fn gtfread(gtffile: &str) -> Result<Vec<GenCode>, Box<dyn Error>> {
8384
let fileopen = File::open(gtffile).expect("file not found");
8485
let fileread = BufReader::new(fileopen);
85-
let mut gtf_vector: Vec<GENCODE> = Vec::new();
86+
let mut gtf_vector: Vec<GenCode> = Vec::new();
8687
for i in fileread.lines() {
8788
let linegtf = i.expect("line not found");
8889
let linevec: Vec<String> = linegtf
@@ -94,7 +95,7 @@ pub fn gtfread(gtffile: &str) -> Result<Vec<GENCODE>, Box<dyn Error>> {
9495
.split("-")
9596
.collect::<Vec<_>>()[1]
9697
.to_string();
97-
gtf_vector.push(GENCODE {
98+
gtf_vector.push(GenCode {
9899
chrom: linevec[0].clone(),
99100
typeannotate: linevec[2].clone(),
100101
start: linevec[3].parse::<usize>().unwrap(),

0 commit comments

Comments
 (0)