Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/bash
- #sudeti homopolimer eilutes gale pagal log failus:
- #https://stackoverflow.com/questions/3685970/check-if-a-bash-array-contains-a-value
- function contains() {
- local n=$#
- local value=${!n}
- for ((i=1;i < $#;i++)) {
- if [ "${!i}" == "${value}" ]; then
- echo "y"
- return 0
- fi
- }
- echo "n"
- return 1
- }
- #example:
- #A=("one" "two" "three four")
- #if [ $(contains "${A[@]}" "one") == "y" ]; then
- # echo "contains one"
- #fi
- for file in *_Filtered/Variants/*/; do
- echo $file
- cd $file
- for log in homo*.log; do
- line=""
- while IFS='' read -r line || [[ -n "$line" ]]; do
- ARRAY=()
- ARRAY+=($line)
- for i in ${ARRAY[@]}; do echo $i; done
- done < $log
- #atitinkamas vcf failas yra kiekvienam log
- #kurio kieviena eilute skenuot del skaiciaus is log failo
- line=""
- chr=${log%.log}
- chr=${chr#homo}
- echo "SmallVariants.filtered_${chr}.vcf.recode_out2.vcf"
- while IFS='' read -r line || [[ -n "$line" ]]; do
- #istraukti ID...
- if [ $(contains "${ARRAY[@]}" "dummy") == "y" ]; then
- #echo "contains dummy"
- fi
- done < SmallVariants.filtered_${chr}.vcf.recode_out2.vcf
- done
- cd ~/SNP_Luko_0523/
- done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement