-
Notifications
You must be signed in to change notification settings - Fork 0
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
Add in combinatorial code #68
Open
dkhofer
wants to merge
7
commits into
main
Choose a base branch
from
combinatorial-designs
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
365ad0d
Add in combinatorial code
dkhofer 5e75b1a
Fix after rebasing
dkhofer 36bbbce
Add command for updating with a library
dkhofer d03e30f
Get coordinate math right, fix test
dkhofer c1d1a6b
Fix after rebase
dkhofer 7970ee7
Fix warnings
dkhofer 8d5205d
Add operation summary
dkhofer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -320,7 +320,7 @@ impl Edge { | |
.collect::<Vec<i64>>() | ||
} | ||
|
||
pub fn blocks_from_edges(conn: &Connection, edges: &Vec<Edge>) -> (Vec<GroupBlock>, Vec<Edge>) { | ||
pub fn blocks_from_edges(conn: &Connection, edges: &Vec<Edge>) -> Vec<GroupBlock> { | ||
let mut node_ids = HashSet::new(); | ||
let mut edges_by_source_node_id: HashMap<i64, Vec<&Edge>> = HashMap::new(); | ||
let mut edges_by_target_node_id: HashMap<i64, Vec<&Edge>> = HashMap::new(); | ||
|
@@ -346,7 +346,6 @@ impl Edge { | |
|
||
let mut blocks = vec![]; | ||
let mut block_index = 0; | ||
let mut boundary_edges = vec![]; | ||
// we sort by keys to exploit the external sequence cache which keeps the most recently used | ||
// external sequence in memory. | ||
for (node_id, sequence) in sequences_by_node_id | ||
|
@@ -358,21 +357,6 @@ impl Edge { | |
edges_by_target_node_id.get(node_id), | ||
sequence.length, | ||
); | ||
for block_boundary in &block_boundaries { | ||
// NOTE: Most of this data is bogus, the Edge struct is just a convenient wrapper | ||
// for the data we need to set up boundary edges in the block group graph | ||
boundary_edges.push(Edge { | ||
id: -1, | ||
source_node_id: *node_id, | ||
source_coordinate: *block_boundary, | ||
source_strand: Strand::Forward, | ||
target_node_id: *node_id, | ||
target_coordinate: *block_boundary, | ||
target_strand: Strand::Forward, | ||
chromosome_index: 0, | ||
phased: 0, | ||
}); | ||
} | ||
|
||
if !block_boundaries.is_empty() { | ||
let start = 0; | ||
|
@@ -422,7 +406,7 @@ impl Edge { | |
0, | ||
); | ||
blocks.push(end_block); | ||
(blocks, boundary_edges) | ||
blocks | ||
} | ||
|
||
pub fn build_graph( | ||
|
@@ -483,6 +467,30 @@ impl Edge { | |
|
||
(graph, edges_by_node_pair) | ||
} | ||
|
||
pub fn boundary_edges_from_sequences( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I didn't like returning two separate things from the above method, felt like splitting out the boundary edge computation into a separate method |
||
node_blocks_by_id: &HashMap<i64, Vec<GroupBlock>>, | ||
) -> Vec<Edge> { | ||
let mut boundary_edges = vec![]; | ||
for node_blocks in node_blocks_by_id.values() { | ||
for (previous_block, next_block) in node_blocks.iter().tuple_windows() { | ||
// NOTE: Most of this data is bogus, the Edge struct is just a convenient wrapper | ||
// for the data we need to set up boundary edges in the block group graph | ||
boundary_edges.push(Edge { | ||
id: -1, | ||
source_node_id: previous_block.node_id, | ||
source_coordinate: previous_block.end, | ||
source_strand: Strand::Forward, | ||
target_node_id: next_block.node_id, | ||
target_coordinate: next_block.start, | ||
target_strand: Strand::Forward, | ||
chromosome_index: 0, | ||
phased: 0, | ||
}); | ||
} | ||
} | ||
boundary_edges | ||
} | ||
} | ||
|
||
#[cfg(test)] | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
VCF imports fail now on a collision between -s for sample and -s for start
thread 'main' panicked at /Users/bvh/.cargo/registry/src/index.crates.io-6f17d22bba15001f/clap_builder-4.5.17/src/builder/debug_asserts.rs:112:17: Command update: Short option names must be unique for each argument, but '-s' is in use by both 'sample' and 'start'