-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor is_valid fn #388
Refactor is_valid fn #388
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Huge improvement, nice work! I think the ContigStatus
type needs some tweaks.
vdj_ann/src/annotate.rs
Outdated
@@ -3018,6 +3018,7 @@ pub struct ContigAnnotation { | |||
pub invalidated_umis: Option<Vec<String>>, // invalidated UMIs | |||
pub is_cell: bool, // was the barcode declared a cell? | |||
pub productive: Option<bool>, // productive? (null means not full length) | |||
pub productive_criteria: Option<ContigStatus>, // New field added in CR 8.1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use ///
for documenting fields, so the docs show up in intellisense. Also, it's best for comments to be "timeless" - prefer describing what something does rather than, for example, when it was added.
pub productive_criteria: Option<ContigStatus>, // New field added in CR 8.1 | |
/// <insert description of what this field is> | |
pub productive_criteria: Option<ContigStatus>, |
@@ -3050,6 +3051,7 @@ impl ContigAnnotation { | |||
invalidated_umis: Option<Vec<String>>, // invalidated UMIs | |||
is_cellx: bool, // was the barcode declared a cell? | |||
productivex: bool, // productive? | |||
productive_criteria: ContigStatus, // criteria used to asess productive status |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same kind of thing here.
productive_criteria: ContigStatus, // criteria used to asess productive status | |
/// Criteria used to asess productive status. | |
productive_criteria: ContigStatus, |
vdj_ann/src/transcript.rs
Outdated
pub struct VdjChainSpecificVJGenes { | ||
v_type: String, | ||
j_type: String, | ||
} | ||
|
||
impl From<VdjChain> for VdjChainSpecificVJGenes { | ||
fn from(chain: VdjChain) -> Self { | ||
VdjChainSpecificVJGenes { | ||
v_type: format!("{chain}V"), | ||
j_type: format!("{chain}J"), | ||
} | ||
let mut too_large = false; | ||
const MIN_DELTA: i32 = -25; | ||
const MIN_DELTA_IGH: i32 = -55; | ||
const MAX_DELTA: i32 = 35; | ||
if first_vstart >= 0 && last_jstop >= 0 { | ||
let delta = (last_jstop_len + first_vstart_len + 3 * cdr3[0].1.len() as i32 - 20) | ||
- (last_jstop - first_vstart); | ||
if logme { | ||
fwriteln!(log, "VJ delta = {}", delta); | ||
} | ||
let mut min_delta = MIN_DELTA; | ||
if igh { | ||
min_delta = MIN_DELTA_IGH; | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we actually need a type here - we only use it once, and we don't ever pass it around as a structure. I think you can delete this and replace it with these format calls in-place.
pub fn is_productive_contig( | ||
b: &DnaString, | ||
refdata: &RefData, | ||
ann: &[(i32, i32, i32, i32, i32)], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not necessary in this PR, but we should at some point in the future replace these annotation tuples with structs.
cad8f5b
to
a2db8ff
Compare
No description provided.