Skip to content

Commit

Permalink
Merge pull request #254 from mgalardini/issue_253
Browse files Browse the repository at this point in the history
Add option to allow intersection with other feature types other than CDSs
  • Loading branch information
mgalardini authored Nov 9, 2023
2 parents 0233353 + 0b1392a commit 0714ece
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
7 changes: 6 additions & 1 deletion pyseer/kmer_mapping/annotate_hits.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ def get_options():
parser.add_argument("output",
help="Output file")

parser.add_argument("--feature-type",
action="append",
help="Which feature types to consider "
"[default=CDSs only]",
default=["CDS"])
parser.add_argument("--bwa",
help="Location of bwa executable "
"[default=bwa]",
Expand Down Expand Up @@ -138,7 +143,7 @@ def main():
# python prior to 3.5
subprocess.check_call("gff2bed < \"" + ref_gff + "\" > \"" + tmp_bed.name + "\"", shell=True)
ref_annotation = pybedtools.BedTool(tmp_bed.name)
filtered_ref = ref_annotation.filter(lambda x: True if x[7] == "CDS" else False).saveas('tmp_bed')
filtered_ref = ref_annotation.filter(lambda x: True if x[7] in options.feature_type else False).saveas('tmp_bed')
ref_annotation = pybedtools.BedTool('tmp_bed')

for bwa_algorithm in bwa_algorithms:
Expand Down
7 changes: 6 additions & 1 deletion tests/run_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@ cd "test (1)"
python ../../annotate_hits_pyseer-runner.py ../significant_kmers.txt references.txt /dev/null > /dev/null 2> /dev/null || die 'Annotate hits with weird folder names'
cd ..
#
# issue 253
python ../annotate_hits_pyseer-runner.py significant_kmers.txt references.txt with_rRNA.txt --feature-type rRNA > /dev/null 2> /dev/null || die 'Annotate hits with rRNA (1)'
grep TAGCACTCATCGTTTACAGCGTGGACTACCAGGGTATCTAATCCTGTTTGCTCCCCACGCTTTCGAGCCTCAGCGTCAGTTACAAGCCAGAGAGCCGCTT with_rRNA.txt | grep FM211187.6350 > /dev/null 2> /dev/null || die 'Annotate hits with rRNA (2)'
rm with_rRNA.txt
#
python ../phandango_mapper-runner.py significant_kmers.txt Spn23F.fa phandango.test.out > /dev/null 2> /dev/null || die 'Phandango mapper'
python ../enet_predict-runner.py --vcf variants.vcf.gz enet_vcf_model.pkl subset.samples_list > /dev/null 2> /dev/null || die "Enet predict"

Expand Down Expand Up @@ -115,4 +120,4 @@ do
python compare_tests $t.log $t.err baseline/$t.log baseline/$t.err || die "Baseline comparison failed for $t";
done

echo -e $green"All good!"$reset
echo -e $green"All good!"$reset
1 change: 1 addition & 0 deletions tests/significant_kmers.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
variant af filter-pvalue lrt-pvalue beta beta-std-err variant_h2 notes
TAGCACTCATCGTTTACAGCGTGGACTACCAGGGTATCTAATCCTGTTTGCTCCCCACGCTTTCGAGCCTCAGCGTCAGTTACAAGCCAGAGAGCCGCTT 6.47E-02 2.08E-12 2.10E-09 7.97E-01 1.31E-01 2.41E-01
TTTTTTTCTACAATAAAATAGGCTCCATAATATCTATAGTGGATTTACCCACTACAAATATTATAGAACCCGTTTTATTATGGAAAGACTTATTGGACTT 6.47E-02 2.08E-12 2.10E-09 7.97E-01 1.31E-01 2.41E-01
TTTTTTTATAGATTTCAGGATCAGCCAAATAGTAATCCG 8.42E-01 1.03E-36 2.99E-10 -4.38E-01 6.83E-02 2.53E-01
TTTTTTTATAGATTTCAGGATCAGCCAAATAGTAATCCGCCAGCTGGCGTT 8.39E-01 3.38E-35 4.04E-09 -3.95E-01 6.62E-02 2.37E-01
Expand Down

0 comments on commit 0714ece

Please sign in to comment.