Unix - Extraer tablas de un archivo txt

 
Vista:
sin imagen de perfil
Val: 5
Ha mantenido su posición en Unix (en relación al último mes)
Gráfica de Unix

Extraer tablas de un archivo txt

Publicado por Claudia (3 intervenciones) el 16/10/2019 21:38:38
Hola a todos!!! por favor necesito ayuda con algún código que me permita extraer una tabla de un archivo txt que contiene mas tablas y frases.

como lo puedo hacer?

Les adjunto una foto para que vean lo que quiero decir. enmarcada en rojo está la tabla que necesito copiar y pasarla a otro archivo.


Screen-Shot-2019-10-16-at-3.44.38-PM
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder
Imágen de perfil de joel
Val: 17
Ha mantenido su posición en Unix (en relación al último mes)
Gráfica de Unix

Extraer tablas de un archivo txt

Publicado por joel (7 intervenciones) el 17/10/2019 08:39:07
Hola Claudia, la manera que yo haria seria buscar la fila que empieza por "Query:" y la que empieza por "Domain annontation" y luego obtener el contenido entre esas dos lineas.

Si nos pegas el contenido del archivo en vez de una imagen, intento mostrarte como.
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar
sin imagen de perfil
Val: 5
Ha mantenido su posición en Unix (en relación al último mes)
Gráfica de Unix

Extraer tablas de un archivo txt

Publicado por Claudia (3 intervenciones) el 17/10/2019 20:11:23
Claro, mil gracias

es este:


hmmsearch :: search profile(s) against a sequence database
# HMMER 3.2.1 (June 2018); http://hmmer.org/
# Copyright (C) 2018 Howard Hughes Medical Institute.
# Freely distributed under the BSD open source license.
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# query HMM file: hsp90HMM
# target sequence database: proteome_01.fasta
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Query: hsp70 [M=173]
Scores for complete sequences (score includes all domains):
--- full sequence --- --- best 1 domain --- -#dom-
E-value score bias E-value score bias exp N Sequence Description
------- ------ ----- ------- ------ ----- ---- -- -------- -----------
4.5e-92 303.6 1.0 4.5e-92 303.6 1.0 2.9 3 WP_013362005.1 molecular chaperone DnaK
1.2e-53 178.5 0.0 2e-53 177.8 0.0 1.3 1 WP_013360607.1 molecular chaperone HscC
0.00028 17.8 5.1 0.0059 13.5 1.7 3.2 2 WP_013362571.1 rod shape-determining protein
0.00049 17.0 0.2 0.021 11.7 0.1 2.3 2 WP_013360481.1 ethanolamine utilization protein EutJ


Domain annotation for each sequence (and alignments):
>> WP_013362005.1 molecular chaperone DnaK
# score bias c-Evalue i-Evalue hmmfrom hmm to alifrom ali to envfrom env to acc
--- ------ ----- --------- --------- ------- ------- ------- ------- ------- ------- ----
1 ! 303.6 1.0 7.3e-95 4.5e-92 1 173 [] 1 172 [. 1 172 [. 0.99
2 ? -0.9 0.0 0.24 1.5e+02 136 169 .. 279 312 .. 220 314 .. 0.72
3 ? -0.0 4.4 0.13 84 52 114 .. 501 560 .. 460 598 .. 0.71

Alignments for each domain:
== domain 1 score: 303.6 bits; conditional E-value: 7.3e-95
hsp70 1 mekilGidlGttnsalavleggkptiipnaeGarttpsvvafskdgeklvGepakrqavsnpentiasikrkmGeedykvklegkeytpqeisal 95
m+k +GidlGttns+++v+egg+p++ipnaeG rttpsvvafskdge++vGepakrqav+np++tiasikr+mG d+kv+++gk+y+pqeisa+
WP_013362005.1 1 MAKTIGIDLGTTNSCVSVMEGGEPVVIPNAEGMRTTPSVVAFSKDGERIVGEPAKRQAVTNPDRTIASIKREMG-RDHKVTIDGKDYSPQEISAI 94
789***********************************************************************.9******************* PP

hsp70 96 ilqkikkdaeaylGeevekavitvpayfndkqrqatkdaGeiaGleveriineptaaslayGldkeekdqkilvydlg 173
ilqk+k+daeaylG++v++avitvpayf d+qrqatkdaG+iaGl+v+riineptaaslayGldk+++++kilv+dlg
WP_013362005.1 95 ILQKLKSDAEAYLGDTVTEAVITVPAYFTDAQRQATKDAGKIAGLNVKRIINEPTAASLAYGLDKTDHEEKILVFDLG 172
****************************************************************************98 PP

== domain 2 score: -0.9 bits; conditional E-value: 0.24
hsp70 136 eiaGleveriineptaasla.yGldkeekdqkilv 169
ei+ + ve+ + ept +la Gl +e d+ ilv
WP_013362005.1 279 EITAFLVEKTM-EPTRKALAdSGLSMSEVDKVILV 312
56666666654.78888887468999999988887 PP

== domain 3 score: -0.0 bits; conditional E-value: 0.13
hsp70 52 epakrqavsnpentiasikrkmGeedykvklegkeytpqeisalilqkikkdaeaylGeevek 114
+ k +a+++ e+ti+ + + + kv+ +ke i+ l+ +k+ a+a Ge+++
WP_013362005.1 501 KKEKMEALNQAESTIYQTEKTIKDMGDKVSAAEKEAVEAAIAG--LKEVKDKADA-TGEQIRA 560
5567889999***********9999999999999988888876..5555555544.3554443 PP

>> WP_013360607.1 molecular chaperone HscC
# score bias c-Evalue i-Evalue hmmfrom hmm to alifrom ali to envfrom env to acc
--- ------ ----- --------- --------- ------- ------- ------- ------- ------- ------- ----
1 ! 177.8 0.0 3.3e-56 2e-53 5 173 .] 4 171 .. 2 171 .. 0.99

Alignments for each domain:
== domain 1 score: 177.8 bits; conditional E-value: 3.3e-56
hsp70 5 lGidlGttnsalavleggkptiipnaeGarttpsvvafskdgeklvGepakrqavsnpentiasikrkmGeedykvklegkeytpqeisalilqk 99
+GidlGttns ++ + gkp++ipn+ G+ tps +a +d++ lvG+pak+ v+n ++ +++ kr mG ++ ++++g++++p e+sal+l
WP_013360607.1 4 IGIDLGTTNSLVSFWNDGKPQLIPNNYGSFLTPSAIAIDNDNKVLVGQPAKEWLVNNSNDGVICFKRFMG-TEKIYNIKGHTFSPTELSALVLST 97
8*********************************************************************.999********************* PP

hsp70 100 ikkdaeaylGeevekavitvpayfndkqrqatkdaGeiaGleveriineptaaslayGldkeekdqkilvydlg 173
+k+da++y+ eev++a+i++payfn+ qr+at +aG++aGl+v+++i eptaa+layGl + + + k +v dlg
WP_013360607.1 98 LKEDAKNYFNEEVSDAIISIPAYFNEFQRTATINAGKMAGLNVVKLITEPTAAALAYGLHNADAEAKFMVLDLG 171
************************************************************************98 PP

>> WP_013362571.1 rod shape-determining protein
# score bias c-Evalue i-Evalue hmmfrom hmm to alifrom ali to envfrom env to acc
--- ------ ----- --------- --------- ------- ------- ------- ------- ------- ------- ----
1 ! 13.5 1.7 9.4e-06 0.0059 5 171 .. 7 157 .. 4 159 .. 0.67
2 ? 2.1 0.1 0.03 19 6 55 .. 155 207 .. 151 218 .. 0.69

Alignments for each domain:
== domain 1 score: 13.5 bits; conditional E-value: 9.4e-06
hsp70 5 lGidlGttnsalavleggkptiipnaeGarttpsvvafskdgekl..vGepakrqavsnpentiasikrkmGeedykvklegkeytpqeisalil 97
+GidlGt+ + v + gk ++ psvva +k+ vGe a+r + p n +a k G +++ + t + + + +
WP_013362571.1 7 IGIDLGTAS--VLVYVKGKGIVL-------QEPSVVAIDTSTNKVlaVGEEAQRMLGRTPGNIVAIRPLKDG------VISDYDVTEKMLK-HFI 85
566776653..233344444444.......358888886655543348899988888888876544334444......4556665554444.445 PP

hsp70 98 qkikkdaeaylGeevekavitvpayfndkqrqatkdaGeiaGleveriineptaaslayGldkeekdqkilvyd 171
+k+ + + + ++ vp+ + +++a da aG + +i+ep aa++ G++ ++ + +v d
WP_013362571.1 86 EKVTGGVGLFRFFK-PQIIVCVPSGVTEVEKRAVIDATMEAGARDVFLIEEPIAAAIGAGIEISQPNGS-MVVD 157
67776666554332.467899***********************9****************96665544.4445 PP

== domain 2 score: 2.1 bits; conditional E-value: 0.03
hsp70 6 GidlGttnsalavleggkptiipna..eGarttpsvvafs.kdgeklvGepak 55
+d+G s +av+ g ++ ++ G++ ++v + k+ l+Ge +
WP_013362571.1 155 VVDIGGGTSDVAVISLGGIVVSTSIkiAGDKFDEAIVKYMrKKHSILIGERTA 207
57889999999999888777766541158888888888762455677887654 PP

>> WP_013360481.1 ethanolamine utilization protein EutJ
# score bias c-Evalue i-Evalue hmmfrom hmm to alifrom ali to envfrom env to acc
--- ------ ----- --------- --------- ------- ------- ------- ------- ------- ------- ----
1 ? 3.0 0.0 0.016 10 6 26 .. 36 56 .. 32 72 .. 0.85
2 ! 11.7 0.1 3.4e-05 0.021 95 154 .. 79 138 .. 65 148 .. 0.92

Alignments for each domain:
== domain 1 score: 3.0 bits; conditional E-value: 0.016
hsp70 6 GidlGttnsalavleggkpti 26
G+dlGt+ +lavl +k +
WP_013360481.1 36 GVDLGTAYVVLAVLDENKKPV 56
9*************8877655 PP

== domain 2 score: 11.7 bits; conditional E-value: 3.4e-05
hsp70 95 lilqkikkdaeaylGeevekavitvpayfndkqrqatkdaGeiaGleveriineptaasl 154
i++ +k++ e+ l ++ a ++p a k + aG+e++ +++eptaa
WP_013360481.1 79 KIVRELKNEIEEKLDAKLVYAAAALPPGTTSLDSGAIKHVVQGAGFELTALLDEPTAANA 138
5899*****************************************************975 PP



Internal pipeline statistics summary:
-------------------------------------
Query model(s): 1 (173 nodes)
Target sequences: 2486 (800122 residues searched)
Passed MSV filter: 118 (0.0474658); expected 49.7 (0.02)
Passed bias filter: 72 (0.0289622); expected 49.7 (0.02)
Passed Vit filter: 7 (0.00281577); expected 2.5 (0.001)
Passed Fwd filter: 4 (0.00160901); expected 0.0 (1e-05)
Initial search space (Z): 2486 [actual number of targets]
Domain search space (domZ): 4 [number of targets reported over threshold]
# CPU time: 0.06u 0.00s 00:00:00.06 Elapsed: 00:00:00.03
# Mc/sec: 3681.13
//
[ok]
# hmmsearch :: search profile(s) against a sequence database
# HMMER 3.2.1 (June 2018); http://hmmer.org/
# Copyright (C) 2018 Howard Hughes Medical Institute.
# Freely distributed under the BSD open source license.
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# query HMM file: hsp90HMM
# target sequence database: proteome_01V1.fasta
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Query: hsp70 [M=173]
Scores for complete sequences (score includes all domains):
--- full sequence --- --- best 1 domain --- -#dom-
E-value score bias E-value score bias exp N Sequence Description
------- ------ ----- ------- ------ ----- ---- -- -------- -----------
2e-52 174.5 12.5 2.9e-41 138.2 0.2 4.1 4 WP_013362005.1 molecular chaperone DnaK
1.1e-22 77.7 0.1 5.6e-18 62.4 0.0 3.1 3 WP_013360607.1 molecular chaperone HscC


Domain annotation for each sequence (and alignments):
>> WP_013362005.1 molecular chaperone DnaK
# score bias c-Evalue i-Evalue hmmfrom hmm to alifrom ali to envfrom env to acc
--- ------ ----- --------- --------- ------- ------- ------- ------- ------- ------- ----
1 ! 25.9 0.1 7.5e-10 9.3e-07 1 28 [. 203 230 .. 203 230 .. 0.96
2 ! 138.2 0.2 2.3e-44 2.9e-41 32 122 .. 392 481 .. 392 481 .. 0.99
3 ! 11.8 0.5 1.6e-05 0.02 123 139 .. 549 565 .. 549 565 .. 0.97
4 ! 5.5 0.1 0.0014 1.7 156 172 .. 922 938 .. 922 938 .. 0.97

Alignments for each domain:
== domain 1 score: 25.9 bits; conditional E-value: 7.5e-10
hsp70 1 mekilGidlGttnsalavleggkptiip 28
m+k +GidlGttns+++v+egg+p++ip
WP_013362005.1 203 MAKTIGIDLGTTNSCVSVMEGGEPVVIP 230
789***********************97 PP

== domain 2 score: 138.2 bits; conditional E-value: 2.3e-44
hsp70 32 GarttpsvvafskdgeklvGepakrqavsnpentiasikrkmGeedykvklegkeytpqeisalilqkikkdaeaylGeevekavitvpay 122
G rttpsvvafskdge++vGepakrqav+np++tiasikr+mG d+kv+++gk+y+pqeisa+ilqk+k+daeaylG++v++avitvpay
WP_013362005.1 392 GMRTTPSVVAFSKDGERIVGEPAKRQAVTNPDRTIASIKREMG-RDHKVTIDGKDYSPQEISAIILQKLKSDAEAYLGDTVTEAVITVPAY 481
789****************************************.9*********************************************9 PP

== domain 3 score: 11.8 bits; conditional E-value: 1.6e-05
hsp70 123 fndkqrqatkdaGeiaG 139
f d+qrqatkdaG+iaG
WP_013362005.1 549 FTDAQRQATKDAGKIAG 565
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar
Imágen de perfil de joel
Val: 17
Ha mantenido su posición en Unix (en relación al último mes)
Gráfica de Unix

Extraer tablas de un archivo txt

Publicado por joel (7 intervenciones) el 18/10/2019 08:31:15
Hola Claudia, la unica manera que he encontrado ha sido con este script:
1
2
3
4
5
6
7
#!/bin/bash
 
inicio=`grep -n 'Query:' archivo.txt | cut -d: -f1`
fin=`grep -n 'Domain annotation for each sequence' archivo.txt | cut -d: -f1`
lineas=$(($fin-$inicio))
 
tail -n +$inicio archivo.txt | head -$lineas

Devuelve:
1
2
3
4
5
6
7
8
9
Query: hsp70 [M=173]
Scores for complete sequences (score includes all domains):
--- full sequence --- --- best 1 domain --- -#dom-
E-value score bias E-value score bias exp N Sequence Description
------- ------ ----- ------- ------ ----- ---- -- -------- -----------
4.5e-92 303.6 1.0 4.5e-92 303.6 1.0 2.9 3 WP_013362005.1 molecular chaperone DnaK
1.2e-53 178.5 0.0 2e-53 177.8 0.0 1.3 1 WP_013360607.1 molecular chaperone HscC
0.00028 17.8 5.1 0.0059 13.5 1.7 3.2 2 WP_013362571.1 rod shape-determining protein
0.00049 17.0 0.2 0.021 11.7 0.1 2.3 2 WP_013360481.1 ethanolamine utilization protein EutJ

Espero que te sirva!!!
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar
sin imagen de perfil
Val: 5
Ha mantenido su posición en Unix (en relación al último mes)
Gráfica de Unix

Extraer tablas de un archivo txt

Publicado por Claudia (3 intervenciones) el 18/10/2019 14:51:24
muchas gracias :)
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar