aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCalvin Morrison <mutantturkey@gmail.com>2014-07-16 14:06:21 -0400
committerCalvin Morrison <mutantturkey@gmail.com>2014-07-16 14:06:21 -0400
commit765a73ed7bb055d11aea2627af8daa9cfc6d664b (patch)
treeb3f553314002bca59f0f2c8aeaefbc8a588c2463
parent7246d741138a5692e57b2fdd3eb229f07b29ff5d (diff)
add working remove mers from file
-rwxr-xr-xSelectiveWholeGenomeAmplification6
-rwxr-xr-xsrc/remove_mers_from_file.py9
2 files changed, 9 insertions, 6 deletions
diff --git a/SelectiveWholeGenomeAmplification b/SelectiveWholeGenomeAmplification
index 37ddeb1..23b14bc 100755
--- a/SelectiveWholeGenomeAmplification
+++ b/SelectiveWholeGenomeAmplification
@@ -27,7 +27,7 @@ check_mers() {
local counts="$2"
local mer=0
- echo " counting mers in $fasta_file:e"
+ echo " counting mers in $fasta_file:"
echo -e "\e[32m"
# remove the counts file so we can concatenate
@@ -315,11 +315,11 @@ if [[ -n "$step_filters" ]] || [[ -n "$all" ]]; then
# check mers from next ignore file
counts="$counts_directory/ignore-"$(basename "$ignore_file")
check_mers "$ignore_file" "$counts"
+ counts="$counts-counts"
echo " filtering ignored mers from: $ignore_file"
- cat "$ignore_all_mers_counts" | remove_mers_from_file.py "$ignore_file"> "$ignore_all_mers_counts-tmp"
+ cat "$ignore_all_mers_counts" | remove_mers_from_file.py "$counts"> "$ignore_all_mers_counts-tmp"
mv "$ignore_all_mers_counts-tmp" "$ignore_all_mers_counts"
- read
check_non_empty "$ignore_all_mers_counts" "ignore all mers from file $ignore_file"
else
echo " $ignore_file not found, continuing..."
diff --git a/src/remove_mers_from_file.py b/src/remove_mers_from_file.py
index bef3ea3..3576e35 100755
--- a/src/remove_mers_from_file.py
+++ b/src/remove_mers_from_file.py
@@ -8,9 +8,12 @@ if __name__ == "__main__":
mers_to_delete = set()
- for mer in open(sys.argv[1], 'r'):
- mer = mer.strip().split()[0]
- mers_to_delete.add(mer)
+ for mer in open(sys.argv[1], 'rU'):
+ sp = mer.strip().split()
+ if len(sp) == 2:
+ mer = sp[0]
+ mers_to_delete.add(mer)
+
for line in sys.stdin:
if line.split()[0] not in mers_to_delete: