Search Results

Search: Posts Made By: dineshkumarsrk
2,713
Posted By RudiC
For exactly the one line FASTA example above, try...
For exactly the one line FASTA example above, try
sed '/^>/ !{s/^/CTGA/; s/$/TAGTA/}' file
4,647
Posted By RudiC
Wouldn't it make more sense to use the...
Wouldn't it make more sense to use the directories' suffixes for the target files' prefixes?
for FP in org*/dnaG.fasta; do TMP=${FP#org}; echo cp $FP fastconcatg/${TMP%%/*}_${FP##*/}; done
cp...
4,647
Posted By MadeInGermany
Your problem is the wrong destination in the cp...
Your problem is the wrong destination in the cp command; it must be dir/file.
Together with a few improvements:
a=1
for i in */dnaG.fasta
do
cp "$i" fastcancatg/"$a"_"$i"
a=$(( a + 1 ))...
4,647
Posted By rbatte1
Okay, I'm sure we can help with that. A few...
Okay, I'm sure we can help with that. A few questions for clarity though:-
Must the filename in the fastconcatg directory be the prefix of the directory that the source was found in?
What do we...
6,430
Posted By MadeInGermany
If you also want to print the >id then you can do...
If you also want to print the >id then you can do it with perl:
perl -ne '/^>.*/ and $id=$&; /.{5}AAGC[^T].{16}AAGC[^T].{5}/ and printf "%s\n%s\n",$id,$&' gene.fasta
6,430
Posted By RudiC
How about (given there are only A, C, G, T in the...
How about (given there are only A, C, G, T in the fasta sequences, so no test for other chars needed)
grep -oE ".{5}AAGC[^T].{16}AAGC[^T].{5}" file
ATAGAAAGCCATAGATAGTAGTAGATAAGCATATAG...
2,525
Posted By Scrutinizer
Also try: awk -F= '/^>/{if(getline<f>0) $0=">"...
Also try:
awk -F= '/^>/{if(getline<f>0) $0=">" $2}1' f=list.txt gene1.fasta

or without the check:
awk -F= '/^>/{getline<f; $0=">" $2}1' f=list.txt gene1.fasta
2,525
Posted By RudiC
For the easy case that your replacements are in...
For the easy case that your replacements are in lines in increasing order, try
awk 'FNR==NR {REP[NR] = $2; next} /^>/ {$0 = ">" REP[++CNT]}1' FS="=" list.txt gene1.fasta
>org5
ATGTAGC
>amylase...
2,743
Posted By anbu23
$ awk ' FNR == NR { ky=$4; sub("_.*","",ky);...
$ awk ' FNR == NR { ky=$4; sub("_.*","",ky); arr[ky]=$0; next } {print arr[$1]} ' content.xls id.txt
NC_020815.1 1891831 1894692 virb4_A0A0H2X8Z4_ 1 954 1945
NC_020815.1 ...
2,743
Posted By RudiC
For reading the keywords from file, try grep -f...
For reading the keywords from file, try grep -f id.txt


For keeping the sequence as given in id.txt, you could write e.g. an awk or perl script. Or try this very inefficient shell (untested):...
2,932
Posted By Don Cragun
Note that RudiC's and Scrutinizer's suggestions...
Note that RudiC's and Scrutinizer's suggestions both depend on the fact that the orgX and orgXX strings in file2 are distinct. Had file2 also contained the line:
org2=japan
both of those...
2,932
Posted By RudiC
This problem has been solved umpteen times in...
This problem has been solved umpteen times in these fora. Did you bother to search, or look into the proposals given below under "More UNIX and Linux Forum Topics You Might Find Helpful"?

...
6,059
Posted By Scrutinizer
awk version you could try: awk 'BEGIN{FS=RS;...
awk version you could try:
awk 'BEGIN{FS=RS; RS=">"; ORS=""} FNR>1{A[$1]=RS $0} END{for(i in A) print A[i]}' file1 file2

note: ensure that there are no excess trailing spaces as is the case with...
6,059
Posted By RudiC
May I paraphrase your request: You want file2's...
May I paraphrase your request: You want file2's sequences to prevail and file1's sequences inserted only if there's no equivalent in file2. If so, try
tr $'\n>' $' \n' <file1| grep -vf <(sed -n...
6,059
Posted By vgersh99
My previously posted attempt was for the provided...
My previously posted attempt was for the provided sample files ONLY - 2 lines for each sequence: 1 header and 1 "data" lines.
Had the OP elaborated on the possible other sample data files, an...
6,059
Posted By yifangt
combine and upgrade by the second fasta file
I put my answer back as I met the scenarios:
1) when file2.fasta contains more entries than in file1.fasta and vice versa. and
2) when the sequence part can have more than one row;
awk...
6,059
Posted By vgersh99
not sure if I follow your samples and the desired...
not sure if I follow your samples and the desired output, but I think you might want this.

awk -f dinesh.awk file2 file1 where dinesh.awk is:

FNR==NR {
if (FNR%2)
head=$0
else
...
2,761
Posted By anbu23
$ awk -F'\\]|\\[|-|:' -v RS='\n>' ' NR == FNR {...
$ awk -F'\\]|\\[|-|:' -v RS='\n>' ' NR == FNR { gsub(" ",""); arr[$3]=1;next} arr[$2]{print ">" $0} ' f1 f2
>Contig_152:50833-51615
CGGAGTAGCTTCGATCAGCGTGACCGGTACCGAGCGACCGTCTTCAGTGAAGACGCGGCT...
2,761
Posted By RudiC
No surprise "it is not working" as none of your...
No surprise "it is not working" as none of your attempts is addressing your problem if at all syntactically correct.



awk 'FNR == NR {SRCH[$3 "-" $2]; next} $2 in SRCH {print ">" $0}' FS="[]-...
3,240
Posted By Don Cragun
I haven't seen where you mentioned anything at...
I haven't seen where you mentioned anything at all about changing your sample input file format nor about changing the code RudiC suggested.

Please show us your new sample input file and the...
3,240
Posted By Don Cragun
That is not surprising. In post #1 in this...
That is not surprising. In post #1 in this thread you said you had CSV input files and used an example that used <tab> characters as the character that separates values. The code RudiC provided...
3,240
Posted By RudiC
I don't think you get very far with sort. Try...
I don't think you get very far with sort. Try instead
awk -F"\t" '
NR==FNR {for (i=1; i<=3; i++) {IX = (i-1)*3+1
split ($IX, T, "_")
...
2,022
Posted By RavinderSingh13
Hello dineshkumarsrk, Ok sure try following....
Hello dineshkumarsrk,

Ok sure try following.

awk 'FNR==1{print;next} {for(i=1;i<=NF;i++){if($i+0>=100){$i="True"}}} 1' Input_file | column -t


Thanks,
R. Singh
2,022
Posted By anbu23
sed "s/[1-9][0-9]\{2,\}/TRUE/g" file
sed "s/[1-9][0-9]\{2,\}/TRUE/g" file
2,022
Posted By RavinderSingh13
Hello dineshkumarsrk, Could you please try...
Hello dineshkumarsrk,

Could you please try following.

awk 'FNR==1{print;next} {for(i=1;i<=NF;i++){if($i+0>100){$i="True"}}} 1' Input_file | column -t


Thanks,
R. Singh
Showing results 1 to 25 of 48

 
All times are GMT -4. The time now is 03:53 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy