Skip to content
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

Merged
merged 4 commits into from
Mar 7, 2024
Merged

Refactor is_valid fn #388

merged 4 commits into from
Mar 7, 2024

Conversation

shamoni
Copy link
Collaborator

@shamoni shamoni commented Mar 4, 2024

No description provided.

Copy link
Contributor

@macklin-10x macklin-10x left a 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.

enclone_args/src/read_json.rs Show resolved Hide resolved
@@ -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
Copy link
Contributor

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.

Suggested change
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
Copy link
Contributor

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.

Suggested change
productive_criteria: ContigStatus, // criteria used to asess productive status
/// Criteria used to asess productive status.
productive_criteria: ContigStatus,

vdj_ann/src/transcript.rs Show resolved Hide resolved
Comment on lines 83 to 104
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;
}
}
}
Copy link
Contributor

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.

vdj_ann/src/transcript.rs Show resolved Hide resolved
vdj_ann/src/transcript.rs Show resolved Hide resolved
vdj_ann/src/transcript.rs Show resolved Hide resolved
vdj_ann/src/transcript.rs Show resolved Hide resolved
pub fn is_productive_contig(
b: &DnaString,
refdata: &RefData,
ann: &[(i32, i32, i32, i32, i32)],
Copy link
Contributor

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.

@shamoni shamoni merged commit b67e5a7 into main Mar 7, 2024
2 checks passed
@shamoni shamoni deleted the sm/refactor_is_valid branch March 7, 2024 16:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants