동일한 작업을 여러 파일에서 반복하고 싶어요. (꾸벅)

cadava의 이미지

동일한 커맨드로 반복작업을 여러파일을 읽어서, 그 결과를 저장하는 작업을 하고 있습니다.
밑의 코드이구요. 실행되면. 마지막에. RUN COMPLETE: 출력되면서 하나의 작업이 끝납니다.

tophat ......tophat_output_11 11_NOR_1.fastq 11_NOR_2.fastq

이 코드에서 보면 결과 디렉토리는 tophat_output_11이구요.
두파일 11_NOR_1.fastq 과 11_NOR_2.fastq파일을 읽는 것입니다.

여기서 이런 파일들이 수십개가 있어서, 다른 파일 112_NOR_1.fastq 112_NOR_2.fastq 읽고 tophat_output_112 에 저장
113_NOR_1.fastq 113_NOR_2.fastq 읽고 tophat_output_113 에 저장
....
999_NOR_1.fastq 999_NOR_2.fastq 읽고 tophat_output_999 에 저장

하는 것입니다.

물론 실행한번 하는데, 하루좀 넘게 걸려서, 하나 실행하고, 다시 파일앞 번호만 바꾸어서 또 실행하고 그러면 되는데요.
이걸 그냥 반복하려면 어떻게 해야 할까요?

실행시, 코멘드등은 다음과 같습니다.

혼자 이리저리 고민하다가, 이렇게 도움얻고자 올립니다.
독학이라 힘드네요. 미리 감사드립니다.
좀 쉽게 또 간결하게 할 방법은 어떤게 있을까요?

[xxx@yyy]$ tophat ......tophat_output_111 111_NOR_1.fastq 111_NOR_2.fastq
[2012-05-08 08:36:58] Beginning TopHat run (v2.0.0)
-----------------------------------------------
[2012-05-08 08:36:58] Checking for Bowtie
Bowtie version: 2.0.0.5
[2012-05-08 08:36:58] Checking for Samtools
Samtools version: 0.1.18.0
[2012-05-08 08:36:58] Checking for Bowtie index files
[2012-05-08 08:36:58] Checking for reference FASTA file
Warning: Could not find FASTA file ./hg19/hg19.fa
[2012-05-08 08:36:58] Reconstituting reference FASTA file from Bowtie index
Executing: /Users/suknamgoongold/RNASeq/bin/bowtie2-inspect ./hg19/hg19 > ./tophat_out/tmp/hg19.fa
[2012-05-08 08:39:42] Generating SAM header for ./hg19/hg19
format: fastq
quality scale: phred33 (default)
[2012-05-08 08:39:45] Preparing reads
left reads: min. length=76, count=112054045
right reads: min. length=76, count=111968908
[2012-05-08 09:59:53] Mapping left_kept_reads against hg19 with Bowtie2
[2012-05-08 17:05:01] Mapping left_kept_reads_seg1 against hg19 with Bowtie2 (1/3)
[2012-05-08 18:19:20] Mapping left_kept_reads_seg2 against hg19 with Bowtie2 (2/3)
[2012-05-08 19:36:24] Mapping left_kept_reads_seg3 against hg19 with Bowtie2 (3/3)
[2012-05-08 21:02:36] Mapping right_kept_reads against hg19 with Bowtie2
[2012-05-09 01:29:24] Mapping right_kept_reads_seg1 against hg19 with Bowtie2 (1/3)
[2012-05-09 02:17:42] Mapping right_kept_reads_seg2 against hg19 with Bowtie2 (2/3)
[2012-05-09 02:52:55] Mapping right_kept_reads_seg3 against hg19 with Bowtie2 (3/3)
[2012-05-09 03:31:14] Searching for junctions via segment mapping
[2012-05-09 04:29:32] Retrieving sequences for splices
[2012-05-09 04:32:43] Indexing splices
[2012-05-09 04:39:53] Mapping left_kept_reads_seg1 against segment_juncs with Bowtie2 (1/3)
[2012-05-09 04:55:35] Mapping left_kept_reads_seg2 against segment_juncs with Bowtie2 (2/3)
[2012-05-09 05:12:01] Mapping left_kept_reads_seg3 against segment_juncs with Bowtie2 (3/3)
[2012-05-09 05:29:52] Joining segment hits
[2012-05-09 07:11:27] Mapping right_kept_reads_seg1 against segment_juncs with Bowtie2 (1/3)
[2012-05-09 07:19:18] Mapping right_kept_reads_seg2 against segment_juncs with Bowtie2 (2/3)
[2012-05-09 07:27:29] Mapping right_kept_reads_seg3 against segment_juncs with Bowtie2 (3/3)
[2012-05-09 07:36:20] Joining segment hits
[2012-05-09 08:24:39] Reporting output tracks
-----------------------------------------------
[2012-05-09 12:29:15] Run complete: 1 days 03:52:16 elapsed

Prentice의 이미지

cd /path/to/target

for I in $(seq 1 10); do tophat ......tophat_output_${I} ${I}_NOR_1.fastq ${I}_NOR_2.fastq ; done
for I in $(seq 11 20); do tophat ......tophat_output_${I} ${I}_NOR_1.fastq ${I}_NOR_2.fastq ; done
for I in $(seq 113 999); do tophat ......tophat_output_${I} ${I}_NOR_1.fastq ${I}_NOR_2.fastq ; done

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

BBCode

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param>
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

Textile

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • You can use Textile markup to format text.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Markdown

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Plain text

  • HTML 태그를 사용할 수 없습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.