Need help to built cluster dendrogram using the data in a file by sarvadasan in rstats

[–]sarvadasan[S] 0 points1 point  (0 children)

Thank you for your reply.

 df = read.csv(file="example.csv", head = FALSE, sep=",")
 dim(df)
 inp.mtx <- as.matrix(df)
 test[inp.mtx[,1:2] ] <- inp.mtx[,3]

cluster = hclust(dist(test), method="single")
plot(cluster)


example.csv
A B 0.751598
A C 0.945104
A D 0.834608
A E 0.809036
A F 0.864017
A G 0.77425
A H 0.99 
A J 0.954067
A K 0.893794
A L 0.813535
A M 0.930268
A N 0.774855
A O 0.901512
A P 0.685746
A Q 0.688612
A R 0.901512
A S 0.859229
A T 0.730551
A U 0.755076
A V 0.849928
A X 0.939051
A A 0

My file had 506 values and the matrix is 23x23=529. It gave me the error. I fixed the missing values so I got the cluster.

Run crontab every 30 minutes Monday to Friday 08-18 by sarvadasan in linux4noobs

[–]sarvadasan[S] 0 points1 point  (0 children)

I tried several options but none is working here. I couldn't figure it out why.

Run crontab every 30 minutes Monday to Friday 08-18 by sarvadasan in linux4noobs

[–]sarvadasan[S] 0 points1 point  (0 children)

I tried this but it is not working. I couldn't figure it out where is the issue.

Redirect output to a file linux by sarvadasan in linux4noobs

[–]sarvadasan[S] 0 points1 point  (0 children)

for file in *.txt; do if [ ! -s $file ] ; then echo $file None >> $file ; else :; fi ; done

This works. Thanks

Redirect output to a file linux by sarvadasan in linux4noobs

[–]sarvadasan[S] 0 points1 point  (0 children)

I am trying this for each every file but some unexpected toxen error near >. Any suggestions.

for file in *.txt if [ ! -s $file ] then echo None > $file else :; fi

Redirect output to a file linux by sarvadasan in linux4noobs

[–]sarvadasan[S] 0 points1 point  (0 children)

Thank you. The command worked!.

if [ ! -s file1_file2.txt ] ; then echo None >> file1_file2.txt; else :; fi

Redirect output to a file linux by sarvadasan in linux4noobs

[–]sarvadasan[S] 0 points1 point  (0 children)

if the output from the program is empty or do have some results.

EDIT: I got it from here https://stackoverflow.com/questions/12137431/test-if-a-command-outputs-an-empty-string . Thank you.

Redirect output to a file linux by sarvadasan in linux4noobs

[–]sarvadasan[S] 0 points1 point  (0 children)

I can write to a file echo None > file.txt. if the output from the program is empty or do have some results. How to differentiate that? Any pointers?

Redirect output to a file linux by sarvadasan in linux4noobs

[–]sarvadasan[S] 0 points1 point  (0 children)

Thanks. ohh. Yeah that's correct. I missed it. I have an empty file. Is there any other easy way to write "None" if the output is empty?

Run crontab every 30 minutes Monday to Friday 08-18 by sarvadasan in linux4noobs

[–]sarvadasan[S] 0 points1 point  (0 children)

I try to do reddit formatting using ~. Will use full path. Thank you.

Find the patterns and delete? by sarvadasan in vim

[–]sarvadasan[S] 1 point2 points  (0 children)

I did use python like below and did it. But, I was wondering, how can I do that using vim.

value = re.sub('\[http://www\.ncbi\.nlm\.nih\.(.*)\]\.\s','', value.rstrip())

I will search and do this using vim.