collecting specific genome data from a file and collect it in the same title
Clash Royale CLAN TAG#URR8PPP
up vote
4
down vote
favorite
I have genomes data in a file genomes-seq.txt, the titles of the sequences begain with>then the genome name
>genome.1
atcg
atcg
atcggtc
>genome.2
atct
tgcgtgctt
attttt
>genome.
sdkf
sdf;ksdf
sdlfkjdslc
edsfsfv
>genome.3
as;ldkhaskjd
asdkljdsl
asdkljasdk;l
>genome.4
ekjfhdhsa
dsfkjskajd
asdknasd
>genome.1
iruuwi
sdkljbh
sdfljnsdl
>genome.234
efijhusidh
siduhygfhuji
>genome.1
ljhdcj
sdljhsdil
fweusfhygc
I want to collect the similar data for genome.1 in one file so it look like this
>genome.1
atcg
atcggtc
iruuwi
sdkljbh
sdfljnsdl
ljhdcj
sdljhsdil
fweusfhygc
but every time I do it using sed I get
>genome.1
atcg
atcg
atcggtc
>genome.1
iruuwi
sdkljbh
sdfljnsdl
>genome.1
ljhdcj
sdljhsdil
fweusfhygc
multiple genome.1 how can I do it correctly so on large data set I don't need to remove all the repetitions.
bash
New contributor
add a comment |Â
up vote
4
down vote
favorite
I have genomes data in a file genomes-seq.txt, the titles of the sequences begain with>then the genome name
>genome.1
atcg
atcg
atcggtc
>genome.2
atct
tgcgtgctt
attttt
>genome.
sdkf
sdf;ksdf
sdlfkjdslc
edsfsfv
>genome.3
as;ldkhaskjd
asdkljdsl
asdkljasdk;l
>genome.4
ekjfhdhsa
dsfkjskajd
asdknasd
>genome.1
iruuwi
sdkljbh
sdfljnsdl
>genome.234
efijhusidh
siduhygfhuji
>genome.1
ljhdcj
sdljhsdil
fweusfhygc
I want to collect the similar data for genome.1 in one file so it look like this
>genome.1
atcg
atcggtc
iruuwi
sdkljbh
sdfljnsdl
ljhdcj
sdljhsdil
fweusfhygc
but every time I do it using sed I get
>genome.1
atcg
atcg
atcggtc
>genome.1
iruuwi
sdkljbh
sdfljnsdl
>genome.1
ljhdcj
sdljhsdil
fweusfhygc
multiple genome.1 how can I do it correctly so on large data set I don't need to remove all the repetitions.
bash
New contributor
Hi @paul, what is yoursed
command that you used?
â Goro
58 mins ago
I tried but it didn't work
â paul
54 mins ago
Show what you tried and we can help fix your errors.
â glenn jackman
24 mins ago
add a comment |Â
up vote
4
down vote
favorite
up vote
4
down vote
favorite
I have genomes data in a file genomes-seq.txt, the titles of the sequences begain with>then the genome name
>genome.1
atcg
atcg
atcggtc
>genome.2
atct
tgcgtgctt
attttt
>genome.
sdkf
sdf;ksdf
sdlfkjdslc
edsfsfv
>genome.3
as;ldkhaskjd
asdkljdsl
asdkljasdk;l
>genome.4
ekjfhdhsa
dsfkjskajd
asdknasd
>genome.1
iruuwi
sdkljbh
sdfljnsdl
>genome.234
efijhusidh
siduhygfhuji
>genome.1
ljhdcj
sdljhsdil
fweusfhygc
I want to collect the similar data for genome.1 in one file so it look like this
>genome.1
atcg
atcggtc
iruuwi
sdkljbh
sdfljnsdl
ljhdcj
sdljhsdil
fweusfhygc
but every time I do it using sed I get
>genome.1
atcg
atcg
atcggtc
>genome.1
iruuwi
sdkljbh
sdfljnsdl
>genome.1
ljhdcj
sdljhsdil
fweusfhygc
multiple genome.1 how can I do it correctly so on large data set I don't need to remove all the repetitions.
bash
New contributor
I have genomes data in a file genomes-seq.txt, the titles of the sequences begain with>then the genome name
>genome.1
atcg
atcg
atcggtc
>genome.2
atct
tgcgtgctt
attttt
>genome.
sdkf
sdf;ksdf
sdlfkjdslc
edsfsfv
>genome.3
as;ldkhaskjd
asdkljdsl
asdkljasdk;l
>genome.4
ekjfhdhsa
dsfkjskajd
asdknasd
>genome.1
iruuwi
sdkljbh
sdfljnsdl
>genome.234
efijhusidh
siduhygfhuji
>genome.1
ljhdcj
sdljhsdil
fweusfhygc
I want to collect the similar data for genome.1 in one file so it look like this
>genome.1
atcg
atcggtc
iruuwi
sdkljbh
sdfljnsdl
ljhdcj
sdljhsdil
fweusfhygc
but every time I do it using sed I get
>genome.1
atcg
atcg
atcggtc
>genome.1
iruuwi
sdkljbh
sdfljnsdl
>genome.1
ljhdcj
sdljhsdil
fweusfhygc
multiple genome.1 how can I do it correctly so on large data set I don't need to remove all the repetitions.
bash
bash
New contributor
New contributor
edited 35 mins ago
Rui F Ribeiro
37k1273117
37k1273117
New contributor
asked 1 hour ago
paul
233
233
New contributor
New contributor
Hi @paul, what is yoursed
command that you used?
â Goro
58 mins ago
I tried but it didn't work
â paul
54 mins ago
Show what you tried and we can help fix your errors.
â glenn jackman
24 mins ago
add a comment |Â
Hi @paul, what is yoursed
command that you used?
â Goro
58 mins ago
I tried but it didn't work
â paul
54 mins ago
Show what you tried and we can help fix your errors.
â glenn jackman
24 mins ago
Hi @paul, what is your
sed
command that you used?â Goro
58 mins ago
Hi @paul, what is your
sed
command that you used?â Goro
58 mins ago
I tried but it didn't work
â paul
54 mins ago
I tried but it didn't work
â paul
54 mins ago
Show what you tried and we can help fix your errors.
â glenn jackman
24 mins ago
Show what you tried and we can help fix your errors.
â glenn jackman
24 mins ago
add a comment |Â
2 Answers
2
active
oldest
votes
up vote
3
down vote
accepted
$sed -nr />genome.1/,/^$/p file | sed '2,$/^>genome.1$/d'
>genome.1
atcg
atcggtc
iruuwi
sdkljbh
sdfljnsdl
ljhdcj
sdljhsdil
fweusfhygc
genome.1 is the key word, change depending on the list you would like to generate.
add a comment |Â
up vote
1
down vote
With perl
perl -00 -ne 'if (/^>genome.1n/) s/// if $. > 1; print' file
add a comment |Â
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
3
down vote
accepted
$sed -nr />genome.1/,/^$/p file | sed '2,$/^>genome.1$/d'
>genome.1
atcg
atcggtc
iruuwi
sdkljbh
sdfljnsdl
ljhdcj
sdljhsdil
fweusfhygc
genome.1 is the key word, change depending on the list you would like to generate.
add a comment |Â
up vote
3
down vote
accepted
$sed -nr />genome.1/,/^$/p file | sed '2,$/^>genome.1$/d'
>genome.1
atcg
atcggtc
iruuwi
sdkljbh
sdfljnsdl
ljhdcj
sdljhsdil
fweusfhygc
genome.1 is the key word, change depending on the list you would like to generate.
add a comment |Â
up vote
3
down vote
accepted
up vote
3
down vote
accepted
$sed -nr />genome.1/,/^$/p file | sed '2,$/^>genome.1$/d'
>genome.1
atcg
atcggtc
iruuwi
sdkljbh
sdfljnsdl
ljhdcj
sdljhsdil
fweusfhygc
genome.1 is the key word, change depending on the list you would like to generate.
$sed -nr />genome.1/,/^$/p file | sed '2,$/^>genome.1$/d'
>genome.1
atcg
atcggtc
iruuwi
sdkljbh
sdfljnsdl
ljhdcj
sdljhsdil
fweusfhygc
genome.1 is the key word, change depending on the list you would like to generate.
edited 17 mins ago
answered 52 mins ago
Goro
7,86653473
7,86653473
add a comment |Â
add a comment |Â
up vote
1
down vote
With perl
perl -00 -ne 'if (/^>genome.1n/) s/// if $. > 1; print' file
add a comment |Â
up vote
1
down vote
With perl
perl -00 -ne 'if (/^>genome.1n/) s/// if $. > 1; print' file
add a comment |Â
up vote
1
down vote
up vote
1
down vote
With perl
perl -00 -ne 'if (/^>genome.1n/) s/// if $. > 1; print' file
With perl
perl -00 -ne 'if (/^>genome.1n/) s/// if $. > 1; print' file
answered 20 mins ago
glenn jackman
48.4k366105
48.4k366105
add a comment |Â
add a comment |Â
paul is a new contributor. Be nice, and check out our Code of Conduct.
paul is a new contributor. Be nice, and check out our Code of Conduct.
paul is a new contributor. Be nice, and check out our Code of Conduct.
paul is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f474268%2fcollecting-specific-genome-data-from-a-file-and-collect-it-in-the-same-title%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Hi @paul, what is your
sed
command that you used?â Goro
58 mins ago
I tried but it didn't work
â paul
54 mins ago
Show what you tried and we can help fix your errors.
â glenn jackman
24 mins ago