• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

griffithlab / regtools / 3689436247

pending completion
3689436247

push

github

GitHub
Merge pull request #169 from griffithlab/doc_update

2407 of 2774 relevant lines covered (86.77%)

3662.66 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

83.05
/src/junctions/junctions_main.cc
1
/*  junctions_main.cc -- handle the 'junction' commands
2

3
    Copyright (c) 2015, The Griffith Lab
4

5
    Author: Avinash Ramu <aramu@genome.wustl.edu>
6

7
Permission is hereby granted, free of charge, to any person obtaining a copy
8
of this software and associated documentation files (the "Software"), to deal
9
in the Software without restriction, including without limitation the rights
10
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
copies of the Software, and to permit persons to whom the Software is
12
furnished to do so, subject to the following conditions:
13

14
The above copyright notice and this permission notice shall be included in
15
all copies or substantial portions of the Software.
16

17
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23
DEALINGS IN THE SOFTWARE.  */
24

25
#include <iostream>
26
#include <getopt.h>
27
#include <stdexcept>
28
#include "common.h"
29
#include "gtf_parser.h"
30
#include "junctions_annotator.h"
31
#include "junctions_extractor.h"
32

33
using namespace std;
34

35
//Usage for junctions subcommands
36
int junctions_usage(ostream &out = cout) {
×
37
    out << "Usage:\t\t" << "regtools junctions <command> [options]" << endl;
×
38
    out << "Command:\t" << "extract\t\tIdentify exon-exon junctions from alignments." << endl;
×
39
    out << "\t\tannotate\tAnnotate the junctions." << endl;
×
40
    out << endl;
×
41
    return 0;
×
42
}
43

44
//Run 'junctions extract'
45
int junctions_extract(int argc, char *argv[]) {
10✔
46
    JunctionsExtractor extract;
10✔
47
    try {
48
        extract.parse_options(argc, argv);
10✔
49
        extract.identify_junctions_from_BAM();
7✔
50
        extract.print_all_junctions();
6✔
51
    } catch(const common::cmdline_help_exception& e) {
4✔
52
        cerr << e.what() << endl;
1✔
53
        return 0;
1✔
54
    } catch(const runtime_error& error) {
4✔
55
        cerr << error.what() << endl;
3✔
56
        return 1;
3✔
57
    }
3✔
58
    return 0;
6✔
59
}
10✔
60

61
//Run 'junctions annotate' subcommand
62
int junctions_annotate(int argc, char *argv[]) {
2✔
63
    JunctionsAnnotator anno;
2✔
64
    AnnotatedJunction line;
2✔
65
    line.reset();
2✔
66
    int linec = 0;
2✔
67
    ofstream out;
2✔
68
    try {
69
        anno.parse_options(argc, argv);
2✔
70
        anno.load_gtf();
1✔
71
        anno.open_junctions();
1✔
72
        anno.set_ofstream_object(out);
1✔
73
        line.print_header(out);
1✔
74
        while(anno.get_single_junction(line)) {
42✔
75
            anno.adjust_junction_ends(line);
41✔
76
            anno.get_splice_site(line);
41✔
77
            anno.annotate_junction_with_gtf(line);
41✔
78
            line.print(out);
41✔
79
            line.reset();
41✔
80
            linec++;
41✔
81
        }
82
        anno.close_ofstream();
1✔
83
        cerr << endl << "Annotated " << linec << " lines." << endl;
1✔
84
        anno.close_junctions();
1✔
85
    } catch(const common::cmdline_help_exception& e) {
1✔
86
        cerr << e.what() << endl;
1✔
87
        return 0;
1✔
88
    } catch(const runtime_error& e) {
1✔
89
        cerr << e.what() << endl;
×
90
        return 1;
×
91
    }
×
92
    return 0;
1✔
93
}
2✔
94

95
//Parse out subcommands under junctions
96
int junctions_main(int argc, char *argv[]) {
12✔
97
    if(argc > 1) {
12✔
98
        string subcmd(argv[1]);
12✔
99
        if(subcmd == "extract") {
12✔
100
            return junctions_extract(argc - 1, argv + 1);
10✔
101
        }
102
        if(subcmd == "annotate") {
2✔
103
            return junctions_annotate(argc - 1, argv + 1);
2✔
104
        }
105
    }
12✔
106
    return junctions_usage();
×
107
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc