Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add pdb2fasta #52973

Merged
merged 8 commits into from
Dec 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions recipes/pdb2fasta/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash -euo

mkdir -p ${PREFIX}/bin
${CC} -O2 pdb2fasta.c -o pdb2fasta
mv pdb2fasta ${PREFIX}/bin
38 changes: 38 additions & 0 deletions recipes/pdb2fasta/meta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{% set name = "pdb2fasta" %}
{% set version = "1.0" %}

package:
name: {{ name }}
version: {{ version }}

source:
url: https://github.com/kad-ecoli/{{ name }}/archive/refs/tags/{{ version }}.tar.gz
sha256: 63c22998df75c0a1ee9c00051d4d401e45b13651a09b98bb2885a86bc342b7bf
patches:
- pdb2fasta.patch

build:
number: 0
run_exports:
- {{ pin_subpackage('pdb2fasta', max_pin="x.x") }}

requirements:
build:
- {{ compiler('c') }}

test:
commands:
- pdb2fasta --help

about:
home: "https://github.com/kad-ecoli/pdb2fasta"
license: "GPL-2-only"
license_family: GPL2
license_file: License.txt
summary: "Convert PDB structures to FASTA sequences."
dev_url: "https://github.com/kad-ecoli/pdb2fasta"

extra:
additional-platforms:
- linux-aarch64
- osx-arm64
40 changes: 40 additions & 0 deletions recipes/pdb2fasta/pdb2fasta.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
diff --git a/pdb2fasta.c b/pdb2fasta.c
index 9642d03..9e8eef1 100644
--- a/pdb2fasta.c
+++ b/pdb2fasta.c
@@ -1,3 +1,4 @@
+#include<stdlib.h>
#include<stdio.h>
#include<string.h>

@@ -99,14 +100,24 @@ char *pdb2fasta(char *pdb_file){
}

int main(int argc, char** argv){
- if (argc<2){
- printf("pdb2fasta pdb.pdb > seq.fasta\n");
- printf(" convert PDB file pdb.pdb to FASTA sequence file seq.fasta\n");
+ if (argc < 2){
+ printf("Usage: pdb2fasta pdb.pdb > seq.fasta\n");
+ printf(" Convert PDB file pdb.pdb to FASTA sequence file seq.fasta\n");
return argc;
}
-
- int i;
- for (i=1;i<argc;i++){
+
+ if (argc == 2 && strcmp(argv[1], "--help") == 0) {
+ printf("Usage: pdb2fasta [options] pdb.pdb\n");
+ printf("Options:\n");
+ printf(" --help Display this help dialogue and exit\n");
+ printf("\nDescription:\n");
+ printf(" Convert a PDB file to a FASTA sequence format. Output is printed to stdout.\n");
+ printf(" Example:\n");
+ printf(" pdb2fasta pdb.pdb > seq.fasta\n");
+ return 0;
+ }
+
+ for (int i=1; i<argc; i++){
char *pdb_file=argv[i];
printf("%s",pdb2fasta(pdb_file));
}