Skip to content

Commit

Permalink
also handle leading whitespace in .blocks.det file
Browse files Browse the repository at this point in the history
  • Loading branch information
aryarm authored Jan 14, 2024
1 parent da48f2d commit 033f567
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion docs/api/examples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ As an example, let's say we would like to convert `the following simple.blocks.d
for idx, line in enumerate(blocks_file.read().splitlines()[1:]):
# initialize variables and parse line from the blocks file
hap_id = f"H{idx}"
chrom, bp1, bp2, kb, nsnps, snps = line.split()
chrom, bp1, bp2, kb, nsnps, snps = line.strip().split()
# create a haplotype line in the .hap file
hp.data[hap_id] = data.Haplotype(
Expand Down
8 changes: 4 additions & 4 deletions tests/data/simple.blocks.det
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CHR BP1 BP2 KB NSNPS SNPS
1 10114 10117 2.001 2 1:10114:T:C|1:10116:A:G
1 10114 10119 2.007 2 1:10114:T:C|1:10117:C:A
1 10116 10119 2.011 2 1:10116:A:G|1:10117:C:A
CHR BP1 BP2 KB NSNPS SNPS
1 10114 10117 2.001 2 1:10114:T:C|1:10116:A:G
1 10114 10119 2.007 2 1:10114:T:C|1:10117:C:A
1 10116 10119 2.011 2 1:10116:A:G|1:10117:C:A
2 changes: 1 addition & 1 deletion tests/test_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -2129,7 +2129,7 @@ def test_blocks2hap(self):
for idx, line in enumerate(blocks_file.read().splitlines()[1:]):
# initialize variables and parse line from the blocks file
hap_id = f"H{idx}"
chrom, bp1, bp2, kb, nsnps, snps = line.split()
chrom, bp1, bp2, kb, nsnps, snps = line.strip().split()

# create a haplotype line in the .hap file
hp.data[hap_id] = Haplotype(
Expand Down

0 comments on commit 033f567

Please sign in to comment.