Skip to content

Commit

Permalink
this addresses issue #10 in which some splice junctions recieve "null"
Browse files Browse the repository at this point in the history
labels, which caused the enumerate function to run incorrectly.

This issue labeling junctions occured because the aligner (STAR)
assigned the read a strand flag (XS) that conflicted with the strand
implied by the sequencing protocol. 

This patch modifies IsoSCM such that splice junctions from reads with
conflicting strand information are omitted from assembled transcript
models.
  • Loading branch information
shenkers committed Jul 8, 2015
1 parent a7f4686 commit 43ed1cf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion IsoSCM/src/executable/IsoSCM.java
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ else if(jc.getParsedCommand().equals("assemble")){
SAMFileReader sfr = new SAMFileReader(bamFile);
logger.info("tabulating splice junctions...");
BEDWriter sj_bw = new BEDWriter(IO.bufferedPrintstream(splice_junction_bed));
FindSpliceJunctions.tabulateSpliceJunctions(sfr, sj_bw);
FindSpliceJunctions.tabulateSpliceJunctions(sfr, strandedness, sj_bw);
sj_bw.close();

logger.info("counting junction supporting reads...");
Expand Down
8 changes: 7 additions & 1 deletion IsoSCM/src/processing/FindSpliceJunctions.java
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public static List<AnnotatedRegion> splice_junctions(SAMRecord sr){
return splice_junctions;
}

public static StrandedGenomicIntervalTree<Map<String,Object>> tabulateSpliceJunctions(SAMFileReader sfr, BEDWriter bw){
public static StrandedGenomicIntervalTree<Map<String,Object>> tabulateSpliceJunctions(SAMFileReader sfr, Strandedness strandedness, BEDWriter bw){
Map<String,Integer> referenceLengths = BAMTools.referenceSequenceLengths(sfr.getFileHeader());

StrandedGenomicIntervalTree<Map<String,Object>> splice_junctions = new StrandedGenomicIntervalTree<Map<String,Object>>();
Expand All @@ -130,6 +130,9 @@ public static StrandedGenomicIntervalTree<Map<String,Object>> tabulateSpliceJunc
SAMRecord sr = sri.next();
if(sr.getCigarString().indexOf('N') == -1)
continue;

if(strandedness!=Strandedness.unstranded && sr.getAttribute("XS")!=null && BAMTools.strand(sr, strandedness)!=sr.getCharacterAttribute("XS"))
continue;

Cigar cigar = sr.getCigar();
int alignmentPosition = sr.getAlignmentStart();
Expand Down Expand Up @@ -869,6 +872,9 @@ public MapCounter<Integer> instantiate(Object... objects) {
String chr = sr.getReferenceName();
int alignment_start = sr.getAlignmentStart();

if(strandedness!=Strandedness.unstranded && sr.getAttribute("XS")!=null && BAMTools.strand(sr, strandedness)!=sr.getCharacterAttribute("XS"))
continue;

if(prev_chr!=null && !chr.equals(prev_chr)){
writeAll(strand_count_5p_splice,strand_count_5p_span, prev_chr, true,gw);
// IMPORTANT: corrected error when last read aligned to the chromosome is spliced
Expand Down

0 comments on commit 43ed1cf

Please sign in to comment.