内容に応じてファイルを別のディレクトリに移動するには?

内容に応じてファイルを別のディレクトリに移動するには?

次の文字列を含むファイルがたくさんあります。

/databis/defontis/Dossier_fasta_chrm_avec_piler/SRR6237661_chrm.fasta: N putative CRISPR arrays found

N次の1つ以上になることができる数字はどこにありますか0?そのディレクトリN内のすべてのファイルとそのディレクトリより大きいすべてのファイルをそのディレクトリに移動する必要があります。0Sans_crisprN0Avec_crispr

lsまた、CRISPRが見つからないすべてのファイル(その中のファイルN)が03355バイト未満であるため、使用できる可能性があります。

私はこれを試しました:

find . -name "*.out" -type 'f' -size -5k -exec mv {} /databis/defontis/Dossier_fasta_chrm_avec_piler/Dossier_fasta_chrm_sortie_pilercr/Sans_Crispr/ \;

しかし、私のすべてのファイルにはこれがあります

mv: cannot move './SRR5273182_chrm.fasta.fa-pilercr.out' to '/databis/defontis/Dossier_fasta_chrm_avec_piler/Dossier_fasta_chrm_sortie_pilercr/Sans-Crispr/': Not a directory

私はいくつかのモードを試しましたが、for f in ...do doneそのうちの何も動作しませんでした。常にエラーが発生したり、必要なものが見つかりませんでした。if then figrep' 0 putative CRISPR arrays found'

私のファイルの例は次のとおりです。

ここに画像の説明を入力してください。

これがCrisprと一緒にすることです。

Help on reading this report
===========================

This report has three sections: Detailed, Summary by Similarity and Summary by Position.

The detailed section shows each repeat in each putative CRISPR array.

The summary sections give one line for each array.

An 'array' is a contiguous sequence of CRISPR repeats looking like this:

    REPEAT Spacer REPEAT Spacer REPEAT ... Spacer REPEAT

Within one array, repeats have high similarity and spacers are, roughly speaking, unique within a window around the array. In a given array, each repeat has a similar length, and each spacer has a similar length. With default parameters, the algorithm allows a fair amount of variability in order to maximize sensitivity. This may allow identification of inactive ("fossil") arrays, and may in rare cases also induce false positives due to other classes of repeats such as microsatellites, LTRs and arrays of RNA genes.


Columns in the detailed section are:

  Pos               Sequence position, starting at 1 for the first base.   Repeat            Length of the repeat.   %id               Identity with the consensus sequence.   Spacer            Length of spacer to the right of this repeat.   Left flank        10 bases to the left of this repeat.   Repeat            Sequence of this repeat.
                      Dots indicate positions where this repeat
                      agrees with the consensus sequence below.   Spacer            Sequence of spacer to the right of this repeat,
                      or 10 bases if this is the last repeat.

The left flank sequence duplicates the end of the spacer for the preceding repeat; it is provided to facilitate visual identification of cases where the algorithm does not correctly identify repeat endpoints.

At the end of each array there is a sub-heading that gives the average repeat length, average spacer length and consensus sequence.

Columns in the summary sections are:

  Array             Number 1, 2 ... referring back to the detailed report.   Sequence          FASTA label of the sequence. May be truncated.   From              Start position of array.   To           End position of array.   # copies          Number of repeats in the array.   Repeat            Average repeat length.   Spacer            Average spacer length.   +                 +/-, indicating orientation relative to first array in group.   Distance          Distance from previous array.   Consensus         Consensus sequence.

In the Summary by Similarity section, arrays are grouped by similarity of their consensus sequences. If consensus sequences are sufficiently similar, they are aligned to each other to indicate probable relationships between arrays.

In the Summary by Position section, arrays are sorted by position within the input sequence file.

The Distance column facilitates identification of cases where a single array has been reported as two adjacent arrays. In such a case, (a) the consensus sequences will be similar or identical, and (b) the distance will be approximately a small multiple of the repeat length + spacer length.

Use the -noinfo option to turn off this help. Use the -help option to get a list of command line options.

pilercr v1.06 By Robert C. Edgar

/databis/defontis/Dossier_fasta_chrm_avec_piler/SRR2177954_chrm.fasta: 1 putative CRISPR arrays found.



DETAIL REPORT



Array 1
>SRR2177954.k141_500270 flag=1 multi=9.2309 len=7453

       Pos  Repeat     %id  Spacer  Left flank    Repeat                                  Spacer
==========  ======  ======  ======  ==========    ====================================    ======
        66      36   100.0      25  CAGAAGTATT    ....................................    CTCACACACGCTGATGCAGACAACA
       127      36   100.0      26  GCAGACAACA    ....................................    GCGAGAGCAGGGATTTGGAACGTAAT
       189      36   100.0      26  GGAACGTAAT    ....................................    ATGTTGATGGAAAAACTCCCACAGAC
       251      36   100.0          TCCCACAGAC    ....................................    ACTGAATGTG
==========  ======  ======  ======  ==========    ====================================
         4      36              25                ATCTACAAAAGTAGAAATTTTATAGAGGTATTTGGC


SUMMARY BY SIMILARITY



Array          Sequence    Position      Length  # Copies  Repeat  Spacer  +  Consensus
=====  ================  ==========  ==========  ========  ======  ======  =  =========
    1  SRR2177954.k141_          66         221         4      36      25  +  ATCTACAAAAGTAGAAATTTTATAGAGGTATTTGGC



SUMMARY BY POSITION



>SRR2177954.k141_500270 flag=1 multi=9.2309 len=7453

Array          Sequence    Position      Length  # Copies  Repeat  Spacer    Distance  Consensus
=====  ================  ==========  ==========  ========  ======  ======  ==========  =========
    1  SRR2177954.k141_          66         221         4      36      25              ATCTACAAAAGTAGAAATTTTATAGAGGTATTTGGC

サクサクしない

Help on reading this report
===========================

This report has three sections: Detailed, Summary by Similarity
and Summary by Position.

The detailed section shows each repeat in each putative
CRISPR array.

The summary sections give one line for each array.

An 'array' is a contiguous sequence of CRISPR repeats
looking like this:

    REPEAT Spacer REPEAT Spacer REPEAT ... Spacer REPEAT

Within one array, repeats have high similarity and spacers
are, roughly speaking, unique within a window around the array.
In a given array, each repeat has a similar length, and each
spacer has a similar length. With default parameters, the
algorithm allows a fair amount of variability in order to
maximize sensitivity. This may allow identification of
inactive ("fossil") arrays, and may in rare cases also
induce false positives due to other classes of repeats
such as microsatellites, LTRs and arrays of RNA genes.


Columns in the detailed section are:

  Pos               Sequence position, starting at 1 for the first base.
  Repeat            Length of the repeat.
  %id               Identity with the consensus sequence.
  Spacer            Length of spacer to the right of this repeat.
  Left flank        10 bases to the left of this repeat.
  Repeat            Sequence of this repeat.
                      Dots indicate positions where this repeat
                      agrees with the consensus sequence below.
  Spacer            Sequence of spacer to the right of this repeat,
                      or 10 bases if this is the last repeat.

The left flank sequence duplicates the end of the spacer for the preceding
repeat; it is provided to facilitate visual identification of cases
where the algorithm does not correctly identify repeat endpoints.

At the end of each array there is a sub-heading that gives the average
repeat length, average spacer length and consensus sequence.

Columns in the summary sections are:

  Array             Number 1, 2 ... referring back to the detailed report.
  Sequence          FASTA label of the sequence. May be truncated.
  From              Start position of array.
  To                End position of array.
  # copies          Number of repeats in the array.
  Repeat            Average repeat length.
  Spacer            Average spacer length.
  +                 +/-, indicating orientation relative to first array in group.
  Distance          Distance from previous array.
  Consensus         Consensus sequence.

In the Summary by Similarity section, arrays are grouped by similarity of their
consensus sequences. If consensus sequences are sufficiently similar, they are
aligned to each other to indicate probable relationships between arrays.

In the Summary by Position section, arrays are sorted by position within the
input sequence file.

The Distance column facilitates identification of cases where a single
array has been reported as two adjacent arrays. In such a case, (a) the
consensus sequences will be similar or identical, and (b) the distance
will be approximately a small multiple of the repeat length + spacer length.

Use the -noinfo option to turn off this help.
Use the -help option to get a list of command line options.

pilercr v1.06
By Robert C. Edgar

/databis/defontis/Dossier_fasta_chrm_avec_piler/ERR1544006_chrm.fasta: 0 putative CRISPR arrays found.

時間をいただきありがとうございます

ベストアンサー1

ファイルを繰り返し、一致するgrepもの: 0 putative CRISPR regionsgrep見つかったらファイルを移動します。

mkdir -p Sans_crispr Avec_crispr
for file in *pilercr.out; do
    if grep -q ': 0 putative CRISPR arrays' "$file"; then
        mv "$file" Sans_crispr
    else
        mv "$file" Avec_crispr
    fi
done

フラグは出力を印刷しないように-q指示しますgrepが、一致するものがない場合はまだ失敗状態で終了し、一致するものがあれば成功状態で終了します。したがって、ここではファイルを適切なフォルダに移動します。

このエラーが発生する理由:

mv: cannot move './SRR5273182_chrm.fasta.fa-pilercr.out' to '/databis/defontis/Dossier_fasta_chrm_avec_piler/Dossier_fasta_chrm_sortie_pilercr/Sans-Crispr/': Not a directory

/databis/defontis/Dossier_fasta_chrm_avec_piler/Dossier_fasta_chrm_sortie_pilercr/Sans-Crispr/ディレクトリが存在しないためです。そのため、上記の小さなスクリプトの最初のコマンドは、mkdir -p Sans_crispr Avec_crispr「存在しない限り、Sans_crisprとAvec_crisprディレクトリを作成する」を意味します。

おすすめ記事