para loop para arquivos contendo caracteres específicos (“rem_trim”) no nome do arquivo

0

Eu gostaria de fazer um loop for nos arquivos abaixo, mas apenas para os arquivos que contêm " rem_trim " no nome. Os que acabaram de aparar foram feitos.

Isso funcionou para os arquivos com acabamento, mas não rem_trim

list='for i in *trim*.1.fq; do echo $i | cut -f 1 -d \. | uniq ; done'
for i in $list; do fastqc $i.1.fq ; fastqc $i.2.fq; done

Então é isso que eu tenho tentado fazer com os arquivos "rem_trim":

list='for i in *rem_trim*.1.fq; do echo $i | cut -f 1 -d \. | uniq ; done'
for i in $list; do fastqc $i.1.fq ; fastqc $i.2.fq; done

Arquivos:

sample_AACCA.rem_trim.1.fq       sample_ACTGG_trim.2_fastqc.html  sample_CTGCG_trim.1_fastqc.html  sample_GCATG_trim.2.fq           sample_GGTTG_trim.1.fq           sample_TCACG.rem_trim.2.fq
sample_AACCA.rem_trim.2.fq       sample_ACTGG_trim.2_fastqc.zip   sample_CTGCG_trim.1_fastqc.zip   sample_GCCGT.rem_trim.1.fq       sample_GGTTG_trim.2_fastqc.html  sample_TCACG_trim.1_fastqc.html
sample_AACCA_trim.1_fastqc.html  sample_ACTGG_trim.2.fq           sample_CTGCG_trim.1.fq           sample_GCCGT.rem_trim.2.fq       sample_GGTTG_trim.2_fastqc.zip   sample_TCACG_trim.1_fastqc.zip
sample_AACCA_trim.1_fastqc.zip   sample_CGAAT.rem_trim.1.fq       sample_CTGCG_trim.2_fastqc.html  sample_GCCGT_trim.1_fastqc.html  sample_GGTTG_trim.2.fq           sample_TCACG_trim.1.fq
sample_AACCA_trim.1.fq           sample_CGAAT.rem_trim.2.fq       sample_CTGCG_trim.2_fastqc.zip   sample_GCCGT_trim.1_fastqc.zip   sample_GTCCG.rem_trim.1.fq       sample_TCACG_trim.2_fastqc.html
sample_AACCA_trim.2_fastqc.html  sample_CGAAT_trim.1_fastqc.html  sample_CTGCG_trim.2.fq           sample_GCCGT_trim.1.fq           sample_GTCCG.rem_trim.2.fq       sample_TCACG_trim.2_fastqc.zip
sample_AACCA_trim.2_fastqc.zip   sample_CGAAT_trim.1_fastqc.zip   sample_GCATG.rem_trim.1.fq       sample_GCCGT_trim.2_fastqc.html  sample_GTCCG_trim.1_fastqc.html  sample_TCACG_trim.2.fq
sample_AACCA_trim.2.fq           sample_CGAAT_trim.1.fq           sample_GCATG.rem_trim.2.fq       sample_GCCGT_trim.2_fastqc.zip   sample_GTCCG_trim.1_fastqc.zip   SE
sample_ACTGG.rem_trim.1.fq       sample_CGAAT_trim.2_fastqc.html  sample_GCATG_trim.1_fastqc.html  sample_GCCGT_trim.2.fq           sample_GTCCG_trim.1.fq
sample_ACTGG.rem_trim.2.fq       sample_CGAAT_trim.2_fastqc.zip   sample_GCATG_trim.1_fastqc.zip   sample_GGTTG.rem_trim.1.fq       sample_GTCCG_trim.2_fastqc.html
sample_ACTGG_trim.1_fastqc.html  sample_CGAAT_trim.2.fq           sample_GCATG_trim.1.fq           sample_GGTTG.rem_trim.2.fq       sample_GTCCG_trim.2_fastqc.zip
sample_ACTGG_trim.1_fastqc.zip   sample_CTGCG.rem_trim.1.fq       sample_GCATG_trim.2_fastqc.html  sample_GGTTG_trim.1_fastqc.html  sample_GTCCG_trim.2.fq
sample_ACTGG_trim.1.fq           sample_CTGCG.rem_trim.2.fq       sample_GCATG_trim.2_fastqc.zip   sample_GGTTG_trim.1_fastqc.zip   sample_TCACG.rem_trim.1.fq

mas eu entendo isso:

Skipping 'sample_AACCA.1.fq' which didn't exist, or couldn't be read
Skipping 'sample_AACCA.2.fq' which didn't exist, or couldn't be read
Skipping 'sample_ACTGG.1.fq' which didn't exist, or couldn't be read
Skipping 'sample_ACTGG.2.fq' which didn't exist, or couldn't be read
Skipping 'sample_CGAAT.1.fq' which didn't exist, or couldn't be read
Skipping 'sample_CGAAT.2.fq' which didn't exist, or couldn't be read
Skipping 'sample_CTGCG.1.fq' which didn't exist, or couldn't be read
Skipping 'sample_CTGCG.2.fq' which didn't exist, or couldn't be read
Skipping 'sample_GCATG.1.fq' which didn't exist, or couldn't be read
Skipping 'sample_GCATG.2.fq' which didn't exist, or couldn't be read
Skipping 'sample_GCCGT.1.fq' which didn't exist, or couldn't be read
Skipping 'sample_GCCGT.2.fq' which didn't exist, or couldn't be read
Skipping 'sample_GGTTG.1.fq' which didn't exist, or couldn't be read
Skipping 'sample_GGTTG.2.fq' which didn't exist, or couldn't be read
Skipping 'sample_GTCCG.1.fq' which didn't exist, or couldn't be read
Skipping 'sample_GTCCG.2.fq' which didn't exist, or couldn't be read
Skipping 'sample_TCACG.1.fq' which didn't exist, or couldn't be read
Skipping 'sample_TCACG.2.fq' which didn't exist, or couldn't be read

Alguma ideia do que estou fazendo de errado e o que pode funcionar? obrigado!

    
por Age87 18.10.2017 / 16:48

1 resposta

1

O problema é que o primeiro grupo de arquivos tem apenas um ponto em seu nome, o segundo grupo tem três.

for i in *rem_trim*.1.fq; do echo "${i%.?.fq}" | uniq ; done

fornece as partes certas do nome.

Mas eu não entendo porque você não faz isso muito mais fácil:

for i in *rem_trim*.1.fq; do
    fastqc $i
done
for i in *rem_trim*.2.fq; do
    fastqc $i
done

ou até mesmo

for i in *rem_trim*.1.fq *rem_trim*.2.fq; do
    fastqc "$i"
done
    
por 18.10.2017 / 19:48