diff --git a/ChangeLog b/ChangeLog index 1e93637250467ab05b0f473206b20f593bcbac0e..ac4dd048395daa01284b23dad4492a9d26cf6eb6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -32,7 +32,8 @@ Version XX Added RNASeq strand specific option to the BAM popup menu ('Colour By' -> 'RNASeq Strand Specific Tag (XS)'). Reads colours are based on the XS - tag (used by TopHat). The RNA strand is then used in the coverage plots. + tag (used by TopHat). The RNA strand is then used in the coverage plots + and in calculation of read counts and RPKM values. Added the following flags: -Dshow_snps Show SNP marks in BamView diff --git a/etc/versions b/etc/versions index 421ae9799d4195db9eaba97fbcc4226e4b96109b..9554acd842830fd4a4ffb8cf976daaf615dc3fa4 100644 --- a/etc/versions +++ b/etc/versions @@ -1,4 +1,4 @@ -Artemis Release 15.1.10 -ACT Release 12.1.10 +Artemis Release 15.1.11 +ACT Release 12.1.11 DNAPlotter Release 1.11 BamView 1.2.10 \ No newline at end of file diff --git a/uk/ac/sanger/artemis/chado/ChadoTransactionManager.java b/uk/ac/sanger/artemis/chado/ChadoTransactionManager.java index 444080cdba525688245711c67a5080b79db333e8..8e00d327128cbc1ff1bdb3bc4b3b0cbfd74ac425 100644 --- a/uk/ac/sanger/artemis/chado/ChadoTransactionManager.java +++ b/uk/ac/sanger/artemis/chado/ChadoTransactionManager.java @@ -1343,7 +1343,16 @@ public class ChadoTransactionManager } // get the cvterm_id for this featureprop/qualifier - Integer lcvterm_id = DatabaseDocument.getCvtermID(name); + CvTerm cvterm = DatabaseDocument.getCvTermByCvAndCvTerm(name, "feature_property"); + Integer lcvterm_id; + if(cvterm != null) + lcvterm_id = cvterm.getCvTermId(); + else + lcvterm_id = DatabaseDocument.getCvtermID(name); + + if(lcvterm_id == null) + lcvterm_id = DatabaseDocument.getCvtermID(name); + if(lcvterm_id == null) // chado doesn't recognise this { JOptionPane.showMessageDialog(null, @@ -1406,7 +1415,11 @@ public class ChadoTransactionManager Integer lcvterm_id = null; if(!name.equals("timelastmodified")) { - lcvterm_id = DatabaseDocument.getCvtermID(name); + CvTerm cvterm = DatabaseDocument.getCvTermByCvAndCvTerm(name, "feature_property"); + if(cvterm != null) + lcvterm_id = cvterm.getCvTermId(); + else + lcvterm_id = DatabaseDocument.getCvtermID(name); if(lcvterm_id == null) // chado doesn't recognise this { diff --git a/uk/ac/sanger/artemis/components/alignment/BamUtils.java b/uk/ac/sanger/artemis/components/alignment/BamUtils.java index 8f7c017c33b55f18c220186ea4c9acfb3e6ead66..c064061f317bf05844cb67b532257fc5756b42b8 100644 --- a/uk/ac/sanger/artemis/components/alignment/BamUtils.java +++ b/uk/ac/sanger/artemis/components/alignment/BamUtils.java @@ -65,6 +65,7 @@ class BamUtils * @param samRecordFlagPredicate * @param samRecordMapQPredicate * @param contained + * @param useStrandTag - strand specific tag * @return */ protected static float[] getCount( @@ -79,7 +80,8 @@ class BamUtils final HashMap<String, Integer> seqLengths, final SAMRecordPredicate samRecordFlagPredicate, final SAMRecordMapQPredicate samRecordMapQPredicate, - final boolean contained) + final boolean contained, + final boolean useStrandTag) { int cnt[] = new int[2]; cnt[0] = 0; @@ -107,7 +109,7 @@ class BamUtils thisEnd = thisLength; cnt = count(bam, samFileReaderHash, name, thisStart, thisEnd, - samRecordFlagPredicate, samRecordMapQPredicate, contained, true); + samRecordFlagPredicate, samRecordMapQPredicate, contained, true, useStrandTag); } lastLen = len; @@ -116,7 +118,7 @@ class BamUtils else { cnt = count(bam, samFileReaderHash, refName, start, end, - samRecordFlagPredicate, samRecordMapQPredicate, contained, true); + samRecordFlagPredicate, samRecordMapQPredicate, contained, true, useStrandTag); } float cntf[] = new float[2]; @@ -133,7 +135,8 @@ class BamUtils final SAMRecordPredicate samRecordFlagPredicate, final SAMRecordPredicate samRecordMapQPredicate, final boolean contained, - final boolean byStrand) + final boolean byStrand, + final boolean useStrandTag) { int cnt[] = new int[2]; cnt[0] = 0; @@ -151,7 +154,7 @@ class BamUtils if(samRecordMapQPredicate == null || samRecordMapQPredicate.testPredicate(samRecord)) { - if(byStrand && samRecord.getReadNegativeStrandFlag()) + if(byStrand && BamView.isNegativeStrand(samRecord, useStrandTag)) cnt[1]++; else cnt[0]++; diff --git a/uk/ac/sanger/artemis/components/alignment/BamView.java b/uk/ac/sanger/artemis/components/alignment/BamView.java index 6b6275c238e22cd0cf08f19a171d4121944b6cd5..ed133c2cf02ec9ad4c1667e7fc1b7045c98e44cc 100644 --- a/uk/ac/sanger/artemis/components/alignment/BamView.java +++ b/uk/ac/sanger/artemis/components/alignment/BamView.java @@ -1623,7 +1623,7 @@ public class BamView extends JPanel for(BamViewRecord bamViewRecord: readsInView) { SAMRecord samRecord = bamViewRecord.sam; - if( isNegativeStrand(samRecord) == isStrandNegative ) + if( isNegativeStrand(samRecord, colourByStrandTag.isSelected()) == isStrandNegative ) { final int offset = getSequenceOffset(samRecord.getReferenceName()); final int recordStart = samRecord.getAlignmentStart()+offset; @@ -1847,11 +1847,13 @@ public class BamView extends JPanel * Check if a record is on the negative strand. If the RNA strand specific * checkbox is set then use the RNA strand. * @param samRecord + * @param useStrandTag - strand specific tag * @return */ - private boolean isNegativeStrand(final SAMRecord samRecord) + protected static boolean isNegativeStrand(final SAMRecord samRecord, + final boolean useStrandTag) { - if(colourByStrandTag.isSelected()) + if(useStrandTag) { if(samRecord.getAttribute("XS") == null) return samRecord.getReadNegativeStrandFlag(); @@ -2583,7 +2585,7 @@ public class BamView extends JPanel new MappedReads(features, (String)combo.getSelectedItem(), samFileReaderHash, bamList, seqNames, offsetLengths, concatSequences, seqLengths, samRecordFlagPredicate, samRecordMapQPredicate, - !overlap.isSelected(), spliced.isSelected()); + !overlap.isSelected(), spliced.isSelected(), colourByStrandTag.isSelected()); } }); @@ -2623,7 +2625,8 @@ public class BamView extends JPanel new MappedReads(features, (String)combo.getSelectedItem(), samFileReaderHash, bamList, seqNames, offsetLengths, concatSequences, seqLengths, seqlen, samRecordFlagPredicate, samRecordMapQPredicate, - !overlap.isSelected(), spliced.isSelected(), allRefSeqs.isSelected()); + !overlap.isSelected(), spliced.isSelected(), allRefSeqs.isSelected(), + colourByStrandTag.isSelected()); } }); diff --git a/uk/ac/sanger/artemis/components/alignment/MappedReads.java b/uk/ac/sanger/artemis/components/alignment/MappedReads.java index e51f5f0cc98c49e6baae68d19fda195542d6d297..7b13366f24db748b3fe0ebed063be798eb3898d0 100644 --- a/uk/ac/sanger/artemis/components/alignment/MappedReads.java +++ b/uk/ac/sanger/artemis/components/alignment/MappedReads.java @@ -58,6 +58,7 @@ public class MappedReads private SAMRecordMapQPredicate samRecordMapQPredicate; private boolean contained; private boolean useIntrons; + private boolean useStrandTag = false; private JDialog dialog = new JDialog((JFrame)null, "Calculating", true);; private int mappedReads[]; @@ -87,7 +88,8 @@ public class MappedReads SAMRecordMapQPredicate samRecordMapQPredicate, final boolean contained, final boolean useIntrons, - final boolean allRefSeqs) + final boolean allRefSeqs, + final boolean useStrandTag) { this.features = features; this.refName = refName; @@ -102,6 +104,7 @@ public class MappedReads this.samRecordMapQPredicate = samRecordMapQPredicate; this.contained = contained; this.useIntrons = useIntrons; + this.useStrandTag = useStrandTag; progressBar = new JProgressBar(0, sequenceLength); progressBar.setValue(0); @@ -150,7 +153,8 @@ public class MappedReads final SAMRecordPredicate samRecordFlagPredicate, final SAMRecordMapQPredicate samRecordMapQPredicate, final boolean contained, - final boolean useIntrons) + final boolean useIntrons, + final boolean useStrandTag) { this.features = features; this.refName = refName; @@ -164,6 +168,7 @@ public class MappedReads this.samRecordMapQPredicate = samRecordMapQPredicate; this.contained = contained; this.useIntrons = useIntrons; + this.useStrandTag = useStrandTag; progressBar = new JProgressBar(0, features.size()); progressBar.setValue(0); @@ -297,7 +302,7 @@ public class MappedReads float tmpcnt[] = new float[2]; tmpcnt = BamUtils.getCount(start, end, bam, refName, samFileReaderHash, seqNames, offsetLengths, concatSequences, seqLengths, - samRecordFlagPredicate, samRecordMapQPredicate, contained); + samRecordFlagPredicate, samRecordMapQPredicate, contained, useStrandTag); cnt[0] += tmpcnt[0]; cnt[1] += tmpcnt[1]; } @@ -305,7 +310,7 @@ public class MappedReads else cnt = BamUtils.getCount(start, end, bam, refName, samFileReaderHash, seqNames, offsetLengths, concatSequences, seqLengths, - samRecordFlagPredicate, samRecordMapQPredicate, contained); + samRecordFlagPredicate, samRecordMapQPredicate, contained, useStrandTag); if (mappedReads != null) { @@ -543,7 +548,7 @@ public class MappedReads mappedReads[j] += BamUtils.count(bam, samFileReaderHash, name, thisStart, thisEnd, samRecordFlagPredicate, - samRecordMapQPredicate, contained, false)[0]; + samRecordMapQPredicate, contained, false, useStrandTag)[0]; } lastLen = len; @@ -553,7 +558,7 @@ public class MappedReads { mappedReads[j] += BamUtils.count(bam, samFileReaderHash, refName, sbegc, sendc, samRecordFlagPredicate, samRecordMapQPredicate, - contained, false)[0]; + contained, false, useStrandTag)[0]; } } }