huget 0.1.0

gProfiler for human genomics
mod annotate;
mod args;
mod generatannot;
mod map;
mod readstruct;
mod threadedhuman;
mod threadedmouse;
use crate::annotate::annotateall;
use crate::args::CommandParse;
use crate::args::Commands;
use crate::generatannot::getrsid;
use crate::map::mapid;
use crate::threadedhuman::threadedlengthhuman;
use crate::threadedmouse::threadedlengthmouse;
use clap::Parser;
use figlet_rs::FIGfont;
mod exon;
use crate::exon::exonsearch;
mod gofetcher;
mod molecular;
use crate::gofetcher::gofetcheradd;
use crate::molecular::molfetcheradd;
mod function;
use crate::function::funcfetcheradd;
mod hp;
mod hpa;
mod mirna;
mod pathways;
mod react;
use crate::hp::hpanalyze;
use crate::hpa::hpa_analyze;
use crate::mirna::mirna_analyze;
use crate::pathways::path_analyze;
use crate::react::react_analyze;
mod pdb;
use crate::pdb::pdbfetch;
mod hgnc;
use crate::hgnc::hgnc_fetch;
mod refseq;
use crate::refseq::refseq_add;
mod swissprot;
use crate::swissprot::swiss_add;
mod trembl;
use crate::trembl::trembl_add;
mod metadata;
use crate::metadata::metadata_fetch;
mod rnn;
use crate::rnn::train;

/*
Gaurav Sablok
codeprog@icloud.com
*/

fn main() {
    let standard_font = FIGfont::standard().unwrap();
    let figure = standard_font.convert("huget");
    assert!(figure.is_some());
    println!("{}", figure.unwrap());
    let argparse = CommandParse::parse();
    match &argparse.command {
        Commands::MaprsID {
            pathfile,
            rsid,
            thread,
        } => {
            let pool = rayon::ThreadPoolBuilder::new()
                .num_threads(thread.parse::<usize>().unwrap())
                .build()
                .unwrap();
            pool.install(|| {
                let command = mapid(pathfile, rsid.to_string()).unwrap();
                println!("The command has finished:{}", command);
            });
        }
        Commands::GenerateInfo { rsid, thread } => {
            let pool = rayon::ThreadPoolBuilder::new()
                .num_threads(thread.parse::<usize>().unwrap())
                .build()
                .unwrap();
            pool.install(|| {
                let command = getrsid(rsid).unwrap();
                println!("The command has finished:{}", command);
            });
        }
        Commands::AnnotateAll {
            annotate,
            pathfile,
            thread,
        } => {
            let pool = rayon::ThreadPoolBuilder::new()
                .num_threads(thread.parse::<usize>().unwrap())
                .build()
                .unwrap();
            pool.install(|| {
                let command = annotateall(annotate, pathfile).unwrap();
                println!("The command has finished:{}", command);
            });
        }
        Commands::ThreadedLengthHuman { generate, thread } => {
            let pool = rayon::ThreadPoolBuilder::new()
                .num_threads(thread.parse::<usize>().unwrap())
                .build()
                .unwrap();
            pool.install(|| {
                let command = threadedlengthhuman(generate);
                println!("The command has finished:{:?}", command);
            });
        }
        Commands::ThreadedLengthMouse { generate, thread } => {
            let pool = rayon::ThreadPoolBuilder::new()
                .num_threads(thread.parse::<usize>().unwrap())
                .build()
                .unwrap();
            pool.install(|| {
                let command = threadedlengthmouse(generate).unwrap();
                println!("The command has finished:{:?}", command);
            });
        }
        Commands::ThreadedHuman { count, thread } => {
            let pool = rayon::ThreadPoolBuilder::new()
                .num_threads(thread.parse::<usize>().unwrap())
                .build()
                .unwrap();
            pool.install(|| {
                let command = threadedlengthhuman(count).unwrap();
                println!("The command has finished:{:?}", command);
            });
        }
        Commands::ThreadedMouse { count, thread } => {
            let pool = rayon::ThreadPoolBuilder::new()
                .num_threads(thread.parse::<usize>().unwrap())
                .build()
                .unwrap();
            pool.install(|| {
                let command = threadedlengthmouse(count).unwrap();
                println!("The command has finished:{:?}", command);
            });
        }
        Commands::Exon {
            pathname,
            searchgene,
            threads,
        } => {
            let pool = rayon::ThreadPoolBuilder::new()
                .num_threads(threads.parse::<usize>().unwrap())
                .build()
                .unwrap();
            pool.install(|| {
                let command = exonsearch(pathname, searchgene);
                println!("The command has finished:{:?}", command);
            });
        }
        Commands::GOCC {
            pathname,
            ensemblid,
        } => {
            let pool = rayon::ThreadPoolBuilder::new()
                .num_threads(4)
                .build()
                .expect("number of threads failed");
            pool.install(|| {
                let command = gofetcheradd(pathname, ensemblid).unwrap();
                println!("The command has been finished:{}", command);
            });
        }
        Commands::GOBP {
            pathname,
            ensemblid,
        } => {
            let pool = rayon::ThreadPoolBuilder::new()
                .num_threads(4)
                .build()
                .expect("number of threads failed");
            pool.install(|| {
                let command = molfetcheradd(pathname, ensemblid).unwrap();
                println!("The command has been finished:{}", command);
            });
        }
        Commands::GOMF {
            pathname,
            ensemblid,
        } => {
            let pool = rayon::ThreadPoolBuilder::new()
                .num_threads(4)
                .build()
                .expect("number of threads failed");
            pool.install(|| {
                let command = funcfetcheradd(pathname, ensemblid).unwrap();
                println!("The command has been finished:{}", command);
            });
        }
        Commands::HP {
            pathname,
            ensemblid,
        } => {
            let pool = rayon::ThreadPoolBuilder::new()
                .num_threads(4)
                .build()
                .expect("number of threads failed");
            pool.install(|| {
                let command = hpa_analyze(pathname, ensemblid).unwrap();
                println!("The command has been finished:{}", command);
            });
        }
        Commands::HPA {
            pathname,
            ensemblid,
        } => {
            let pool = rayon::ThreadPoolBuilder::new()
                .num_threads(4)
                .build()
                .expect("number of threads failed");
            pool.install(|| {
                let command = hpanalyze(pathname, ensemblid).unwrap();
                println!("The command has been finished:{}", command);
            });
        }
        Commands::MiRNA {
            pathname,
            ensemblid,
        } => {
            let pool = rayon::ThreadPoolBuilder::new()
                .num_threads(4)
                .build()
                .expect("number of threads failed");
            pool.install(|| {
                let command = mirna_analyze(pathname, ensemblid).unwrap();
                println!("The command has been finished:{}", command);
            });
        }
        Commands::React {
            pathname,
            ensemblid,
        } => {
            let pool = rayon::ThreadPoolBuilder::new()
                .num_threads(4)
                .build()
                .expect("number of threads failed");
            pool.install(|| {
                let command = react_analyze(pathname, ensemblid).unwrap();
                println!("The command has been finished:{}", command);
            });
        }
        Commands::Pathways {
            pathname,
            ensemblid,
        } => {
            let pool = rayon::ThreadPoolBuilder::new()
                .num_threads(4)
                .build()
                .expect("number of threads failed");
            pool.install(|| {
                let command = path_analyze(pathname, ensemblid).unwrap();
                println!("The command has been finished:{}", command);
            });
        }
        Commands::PDB {
            pathname,
            ensemblid,
        } => {
            let pool = rayon::ThreadPoolBuilder::new()
                .num_threads(4)
                .build()
                .expect("number of threads failed");
            pool.install(|| {
                let command = pdbfetch(pathname, ensemblid).unwrap();
                println!("The command has been finished:{}", command);
            });
        }
        Commands::HGNC {
            pathname,
            ensemblid,
        } => {
            let pool = rayon::ThreadPoolBuilder::new()
                .num_threads(4)
                .build()
                .expect("number of threads failed");
            pool.install(|| {
                let command = hgnc_fetch(pathname, ensemblid).unwrap();
                println!("The command has been finished:{}", command);
            });
        }
        Commands::RefSeq {
            pathname,
            ensemblid,
        } => {
            let pool = rayon::ThreadPoolBuilder::new()
                .num_threads(4)
                .build()
                .expect("number of threads failed");
            pool.install(|| {
                let command = refseq_add(pathname, ensemblid).unwrap();
                println!("The command has been finished:{}", command);
            });
        }
        Commands::Swiss {
            pathname,
            ensemblid,
        } => {
            let pool = rayon::ThreadPoolBuilder::new()
                .num_threads(4)
                .build()
                .expect("number of threads failed");
            pool.install(|| {
                let command = swiss_add(pathname, ensemblid).unwrap();
                println!("The command has been finished:{}", command);
            });
        }
        Commands::TrEMBL {
            pathname,
            ensemblid,
        } => {
            let pool = rayon::ThreadPoolBuilder::new()
                .num_threads(4)
                .build()
                .expect("number of threads failed");
            pool.install(|| {
                let command = trembl_add(pathname, ensemblid).unwrap();
                println!("The command has been finished:{}", command);
            });
        }
        Commands::MetaData {
            pathname,
            ensemblid,
            typestring,
        } => {
            let pool = rayon::ThreadPoolBuilder::new()
                .num_threads(4)
                .build()
                .expect("number of threads failed");
            pool.install(|| {
                let command = metadata_fetch(pathname, ensemblid, typestring).unwrap();
                println!("The command has been finished:{}", command);
            });
        }
        Commands::NeuralConv1D { pathname, thread } => {
            let pool = rayon::ThreadPoolBuilder::new()
                .num_threads(thread.parse::<usize>().unwrap())
                .build()
                .expect("Threads failed");
            pool.install(|| {
                type MyBackend = burn::backend::Autodiff<burn::backend::NdArray>;
                let device = Default::default();
                train::<MyBackend>(device, pathname);
            })
        }
    }
}