Skip to content

Commit 86da3d4

Browse files
authored
Merge branch 'master' into improved_compare_junctions
2 parents 1dd7b9c + 1cce7e7 commit 86da3d4

File tree

4 files changed

+21
-6
lines changed

4 files changed

+21
-6
lines changed

src/cis-splice-effects/cis_splice_effects_identifier.cc

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ void CisSpliceEffectsIdentifier::usage(ostream& out) {
4040
out << "\t\t" << "-j STR\tOutput file containing the aberrant junctions in BED12 format." << endl;
4141
out << "\t\t" << "-s INT\tStrand specificity of RNA library preparation \n"
4242
<< "\t\t\t " << "(0 = unstranded, 1 = first-strand/RF, 2, = second-strand/FR). REQUIRED" << endl;
43+
out << "\t\t" << "-t STR\tTag used in bam to label strand. [XS]" << endl;
4344
out << "\t\t" << "-a INT\tMinimum anchor length. Junctions which satisfy a minimum \n"
4445
<< "\t\t\t " << "anchor length on both sides are reported. [8]" << endl;
4546
out << "\t\t" << "-m INT\tMinimum intron length. [70]" << endl;
@@ -103,7 +104,7 @@ void CisSpliceEffectsIdentifier::parse_options(int argc, char* argv[]) {
103104
optind = 1; //Reset before parsing again.
104105
stringstream help_ss;
105106
char c;
106-
while((c = getopt(argc, argv, "o:w:v:j:e:Ei:IShs:a:m:M:")) != -1) {
107+
while((c = getopt(argc, argv, "o:w:v:j:e:Ei:ISht:s:a:m:M:")) != -1) {
107108
switch(c) {
108109
case 'o':
109110
output_file_ = string(optarg);
@@ -138,6 +139,9 @@ void CisSpliceEffectsIdentifier::parse_options(int argc, char* argv[]) {
138139
case 's':
139140
strandness_ = atoi(optarg);
140141
break;
142+
case 't':
143+
strand_tag_ = string(optarg);
144+
break;
141145
case 'a':
142146
min_anchor_length_ = atoi(optarg);
143147
break;
@@ -246,7 +250,7 @@ void CisSpliceEffectsIdentifier::identify() {
246250
if(write_annotated_variants_)
247251
va.write_annotation_output(v1);
248252
//Extract junctions near this variant
249-
JunctionsExtractor je1(bam_, variant_region, strandness_, min_anchor_length_, min_intron_length_, max_intron_length_);
253+
JunctionsExtractor je1(bam_, variant_region, strandness_, strand_tag_, min_anchor_length_, min_intron_length_, max_intron_length_);
250254
je1.identify_junctions_from_BAM();
251255
vector<Junction> junctions = je1.get_all_junctions();
252256
//Add all the junctions to the unique set

src/cis-splice-effects/cis_splice_effects_identifier.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ class CisSpliceEffectsIdentifier {
8080
bool skip_single_exon_genes_;
8181
//strandness of data
8282
int strandness_;
83+
//tag used in BAM to denote strand, default "XS"
84+
string strand_tag_;
8385
//Minimum anchor length for junctions
8486
//Junctions need atleast this many bp overlap
8587
// on both ends.
@@ -101,6 +103,7 @@ class CisSpliceEffectsIdentifier {
101103
all_exonic_space_(false),
102104
skip_single_exon_genes_(true),
103105
strandness_(-1),
106+
strand_tag_("XS"),
104107
min_anchor_length_(8),
105108
min_intron_length_(70),
106109
max_intron_length_(500000) {}

src/junctions/junctions_extractor.cc

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ int JunctionsExtractor::parse_options(int argc, char *argv[]) {
4141
optind = 1; //Reset before parsing again.
4242
int c;
4343
stringstream help_ss;
44-
while((c = getopt(argc, argv, "ha:m:M:o:r:s:")) != -1) {
44+
while((c = getopt(argc, argv, "ha:m:M:o:r:t:s:")) != -1) {
4545
switch(c) {
4646
case 'a':
4747
min_anchor_length_ = atoi(optarg);
@@ -58,6 +58,9 @@ int JunctionsExtractor::parse_options(int argc, char *argv[]) {
5858
case 'r':
5959
region_ = string(optarg);
6060
break;
61+
case 't':
62+
strand_tag_ = string(optarg);
63+
break;
6164
case 'h':
6265
usage(help_ss);
6366
throw common::cmdline_help_exception(help_ss.str());
@@ -104,6 +107,8 @@ int JunctionsExtractor::usage(ostream& out) {
104107
<< "\t\t\t " << "in \"chr:start-end\" format. Entire BAM by default." << endl;
105108
out << "\t\t" << "-s INT\tStrand specificity of RNA library preparation \n"
106109
<< "\t\t\t " << "(0 = unstranded, 1 = first-strand/RF, 2, = second-strand/FR). REQUIRED" << endl;
110+
out << "\t\t" << "-t STR\tTag used in bam to label strand. [XS]" << endl;
111+
107112
out << endl;
108113
return 0;
109114
}
@@ -224,7 +229,7 @@ void JunctionsExtractor::print_all_junctions(ostream& out) {
224229

225230
//Get the strand from the XS aux tag
226231
void JunctionsExtractor::set_junction_strand_XS(bam1_t *aln, Junction& j1) {
227-
uint8_t *p = bam_aux_get(aln, "XS");
232+
uint8_t *p = bam_aux_get(aln, strand_tag_.c_str());
228233
if(p != NULL) {
229234
char strand = bam_aux2A(p);
230235
strand ? j1.strand = string(1, strand) : j1.strand = string(1, '?');

src/junctions/junctions_extractor.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,8 @@ class JunctionsExtractor {
155155
string region_;
156156
//strandness of data; 0 = unstranded, 1 = RF, 2 = FR
157157
int strandness_;
158+
//tag used in BAM to denote strand, default "XS"
159+
string strand_tag_;
158160
public:
159161
//Default constructor
160162
JunctionsExtractor() {
@@ -163,12 +165,13 @@ class JunctionsExtractor {
163165
max_intron_length_ = 500000;
164166
junctions_sorted_ = false;
165167
strandness_ = -1;
168+
strand_tag_ = "XS";
166169
bam_ = "NA";
167170
output_file_ = "NA";
168171
region_ = ".";
169172
}
170-
JunctionsExtractor(string bam1, string region1, int strandness1, uint32_t min_anchor_length1, uint32_t min_intron_length1, uint32_t max_intron_length1) :
171-
bam_(bam1), region_(region1), strandness_(strandness1), min_anchor_length_(min_anchor_length1), min_intron_length_(min_anchor_length1), max_intron_length_(max_intron_length1) {
173+
JunctionsExtractor(string bam1, string region1, int strandness1, string strand_tag1, uint32_t min_anchor_length1, uint32_t min_intron_length1, uint32_t max_intron_length1) :
174+
bam_(bam1), region_(region1), strandness_(strandness1), strand_tag_(strand_tag1), min_anchor_length_(min_anchor_length1), min_intron_length_(min_anchor_length1), max_intron_length_(max_intron_length1) {
172175
junctions_sorted_ = false;
173176
output_file_ = "NA";
174177
}

0 commit comments

Comments
 (0)